Bugzilla – Attachment 85019 Details for
Bug 13735
Item form in serials module doesn't respect max length set in the frameworks
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13735: Update PrepareItemrecordDisplay to use maxlength
Bug-13735-Update-PrepareItemrecordDisplay-to-use-m.patch (text/plain), 5.33 KB, created by
Martin Renvoize (ashimema)
on 2019-02-12 14:02:12 UTC
(
hide
)
Description:
Bug 13735: Update PrepareItemrecordDisplay to use maxlength
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-02-12 14:02:12 UTC
Size:
5.33 KB
patch
obsolete
>From e1e8c540f8c5d3d6d6bf8e9421c58ff2c499507c Mon Sep 17 00:00:00 2001 >From: Katrin Fischer <katrin.fischer.83@web.de> >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 <martin.renvoize@ptfs-europe.com> >--- > C4/Items.pm | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index 0f75cb1b20..52a5c435b2 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -2464,6 +2464,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') ) { >@@ -2601,17 +2603,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[<input type="text" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="50" maxlength="255" value="$defaultvalue" /><a href="#" id="buttonDot_$subfield_data{id}" tabindex="$tab" class="buttonDot $class" title="$title">...</a>\n].$plugin->javascript; >+ $subfield_data{marc_value} = qq[<input type="text" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="50" maxlength="$maxlength" value="$defaultvalue" /><a href="#" id="buttonDot_$subfield_data{id}" tabindex="$tab" class="buttonDot $class" title="$title">...</a>\n].$plugin->javascript; > } else { > warn $plugin->errstr; >- $subfield_data{marc_value} = qq(<input type="text" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="50" maxlength="255" value="$defaultvalue" />); # supply default input form >+ $subfield_data{marc_value} = qq(<input type="text" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="50" maxlength="$maxlength" value="$defaultvalue" />); # supply default input form > } > } > elsif ( $tag eq '' ) { # it's an hidden field >- $subfield_data{marc_value} = qq(<input type="hidden" tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="50" maxlength="255" value="$defaultvalue" />); >+ $subfield_data{marc_value} = qq(<input type="hidden" tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="50" maxlength="$maxlength" value="$defaultvalue" />); > } > elsif ( $tagslib->{$tag}->{$subfield}->{'hidden'} ) { # FIXME: shouldn't input type be "hidden" ? >- $subfield_data{marc_value} = qq(<input type="text" tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="50" maxlength="255" value="$defaultvalue" />); >+ $subfield_data{marc_value} = qq(<input type="text" tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="50" maxlength="$maxlength" value="$defaultvalue" />); > } > elsif ( length($defaultvalue) > 100 > or (C4::Context->preference("marcflavour") eq "UNIMARC" and >@@ -2620,9 +2622,9 @@ sub PrepareItemrecordDisplay { > 500 <= $tag && $tag < 600 ) > ) { > # oversize field (textarea) >- $subfield_data{marc_value} = qq(<textarea tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="50" maxlength="255">$defaultvalue</textarea>\n"); >+ $subfield_data{marc_value} = qq(<textarea tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="50" maxlength="$maxlength">$defaultvalue</textarea>\n"); > } else { >- $subfield_data{marc_value} = "<input type=\"text\" name=\"field_value\" value=\"$defaultvalue\" size=\"50\" maxlength=\"255\" />"; >+ $subfield_data{marc_value} = "<input type=\"text\" name=\"field_value\" value=\"$defaultvalue\" size=\"50\" maxlength=\"$maxlength\" />"; > } > push( @loop_data, \%subfield_data ); > } >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 13735
:
84945
|
85019
|
86881