From 1c267af1438d31a967593f942321d040cd26d34e Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Wed, 6 Feb 2019 02:02:11 +0000 Subject: [PATCH] Bug 13735: Update PrepareItemrecordDisplay to use maxlength The PrepareItemrecordDisplay method used to generate the item display on receiving serials was using a hardcoded maxlength of 255 on input fields. This patch updates it to use the maxlength defined in the frameworks instead as the normal item form does. To test: - Create or reuse an existing subscription - Make note of the framework the record uses - Add an item on receive - Check the maxlength on the various fields is set to 255 (check source code or use developer tools) - You can also verify that by adding a long note to one of the note fields - Apply patch - Repeat tests, the maxlength should now be 9999 - In your framework settings, change the length of one of the subfields to another value - Verify that the item form reflects the change Signed-off-by: Martin Renvoize Signed-off-by: Marcel de Rooy Signed-off-by: Nick Clemens (cherry picked from commit 0429aadc217f05a98bbaa51f955b835ac552fd7a) Signed-off-by: Martin Renvoize --- C4/Items.pm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index 0c4aed9bce..e0cc72f690 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -2468,6 +2468,8 @@ sub PrepareItemrecordDisplay { $defaultvalue =~ s/"/"/g; } + my $maxlength = $tagslib->{$tag}->{$subfield}->{maxlength}; + # search for itemcallnumber if applicable if ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber' && C4::Context->preference('itemcallnumber') ) { @@ -2605,17 +2607,17 @@ sub PrepareItemrecordDisplay { my $tab= $plugin->noclick? '-1': ''; my $class= $plugin->noclick? ' disabled': ''; my $title= $plugin->noclick? 'No popup': 'Tag editor'; - $subfield_data{marc_value} = qq[...\n].$plugin->javascript; + $subfield_data{marc_value} = qq[...\n].$plugin->javascript; } else { warn $plugin->errstr; - $subfield_data{marc_value} = qq(); # supply default input form + $subfield_data{marc_value} = qq(); # supply default input form } } elsif ( $tag eq '' ) { # it's an hidden field - $subfield_data{marc_value} = qq(); + $subfield_data{marc_value} = qq(); } elsif ( $tagslib->{$tag}->{$subfield}->{'hidden'} ) { # FIXME: shouldn't input type be "hidden" ? - $subfield_data{marc_value} = qq(); + $subfield_data{marc_value} = qq(); } elsif ( length($defaultvalue) > 100 or (C4::Context->preference("marcflavour") eq "UNIMARC" and @@ -2624,9 +2626,9 @@ sub PrepareItemrecordDisplay { 500 <= $tag && $tag < 600 ) ) { # oversize field (textarea) - $subfield_data{marc_value} = qq(\n"); + $subfield_data{marc_value} = qq(\n"); } else { - $subfield_data{marc_value} = ""; + $subfield_data{marc_value} = ""; } push( @loop_data, \%subfield_data ); } -- 2.39.5