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 47d2de9c02
  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 <pierreluc.lapointe@inLibro.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 73e9c077f6)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Jonathan Druart 2018-06-29 14:09:07 -03:00 committed by Fridolin Somers
parent 4d5e9c7833
commit ed2cf32df9
1 changed files with 7 additions and 7 deletions

View File

@ -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,
};
}