From 6ab6938be28cac6194efdaaaaf0ed7bcf9a6dcee 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 Content-Type: text/plain; charset=utf-8 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 --- C4/Items.pm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index 611c63e740..547d8358c9 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -2412,6 +2412,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') ) { @@ -2549,17 +2551,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 @@ -2568,9 +2570,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.11.0