From 73e9c077f6543a4b08f3d2e7394c1e667f0d24e5 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 --- cataloguing/additem.pl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index f66c0007ad..52f56b6b7a 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -224,7 +224,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, }; } @@ -243,7 +243,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}, }; @@ -263,7 +263,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, @@ -274,7 +274,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 } @@ -283,7 +283,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, }; } @@ -291,7 +291,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, }; } @@ -319,7 +319,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