From ed2cf32df97a75fe462a26dc6b72ce0b6f3e2db0 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 29 Jun 2018 14:09:07 -0300 Subject: [PATCH] Bug 21009: Fix max length of inputs on editing/adding items There is a "max length" value you can define at framework level to limit the size of the input. But it is not taken into account on the add/edit item form. It is a regression that has been introduced by commit 47d2de9c024bfb93d56184f298f334b20685cd86 Bug 12176: Remove HTML from additem.pl max_length vs maxlength Test plan: - Define a maximum length for an item subfield - Add or edit an item => Without this patch the maxlength attribute of the inputs are not defined (maxlength="") => With this fix you will see the maxlength attributes correctly set with the value you defined in the framework Note: We could/should set this value to the size of the DB column when mapped For instance 952$u is mapped with items.uri, which is a varchar(255). This length restriction should done at framework level Signed-off-by: Pierre-Luc Lapointe Signed-off-by: Katrin Fischer Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize (cherry picked from commit 73e9c077f6543a4b08f3d2e7394c1e667f0d24e5) Signed-off-by: Fridolin Somers --- cataloguing/additem.pl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index c9e38d0b2a..131d79e2b2 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -221,7 +221,7 @@ sub generate_subfield_form { $subfield_data{marc_value} = { type => 'hidden', id => $subfield_data{id}, - maxlength => $subfield_data{max_length}, + maxlength => $subfield_data{maxlength}, value => $value, }; } @@ -240,7 +240,7 @@ sub generate_subfield_form { $subfield_data{marc_value} = { type => 'text_auth', id => $subfield_data{id}, - maxlength => $subfield_data{max_length}, + maxlength => $subfield_data{maxlength}, value => $value, authtypecode => $subfieldlib->{authtypecode}, }; @@ -260,7 +260,7 @@ sub generate_subfield_form { $subfield_data{marc_value} = { type => 'text_plugin', id => $subfield_data{id}, - maxlength => $subfield_data{max_length}, + maxlength => $subfield_data{maxlength}, value => $value, class => $class, nopopup => $plugin->noclick, @@ -271,7 +271,7 @@ sub generate_subfield_form { $subfield_data{marc_value} = { type => 'text', id => $subfield_data{id}, - maxlength => $subfield_data{max_length}, + maxlength => $subfield_data{maxlength}, value => $value, }; # supply default input form } @@ -280,7 +280,7 @@ sub generate_subfield_form { $subfield_data{marc_value} = { type => 'hidden', id => $subfield_data{id}, - maxlength => $subfield_data{max_length}, + maxlength => $subfield_data{maxlength}, value => $value, }; } @@ -288,7 +288,7 @@ sub generate_subfield_form { $subfield_data{marc_value} = { type => 'text', id => $subfield_data{id}, - maxlength => $subfield_data{max_length}, + maxlength => $subfield_data{maxlength}, value => $value, }; } @@ -314,7 +314,7 @@ sub generate_subfield_form { $subfield_data{marc_value} = { type => 'text', id => $subfield_data{id}, - maxlength => $subfield_data{max_length}, + maxlength => $subfield_data{maxlength}, value => $value, }; } -- 2.39.5