Bug 28533 - Requesting whole field in 'itemcallnumber' system preference causes internal server error
Summary: Requesting whole field in 'itemcallnumber' system preference causes internal ...
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Nick Clemens
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-09 12:59 UTC by Nick Clemens
Modified: 2021-06-11 15:59 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 28533: Set subfields to 'undef' if whole field request in itemcallnumebr system preference (1.72 KB, patch)
2021-06-09 13:06 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 28533: Set subfields to 'undef' if whole field request in itemcallnumebr system preference (1.76 KB, patch)
2021-06-10 18:59 UTC, Salman Ali
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens 2021-06-09 12:59:19 UTC
To recreate:
1 - Set 'itemcallnumber' system preference to 082
2 - Find/Create a record with an 082 field
3 - Add items to the record
4 - Error:
Unmatched [ in regex; marked by <-- HERE in m/^[ <-- HERE ]$/ at /usr/share/perl5/MARC/Field.pm line 643.
Comment 1 Nick Clemens 2021-06-09 13:06:37 UTC
Created attachment 121738 [details] [review]
Bug 28533: Set subfields to 'undef' if whole field request in itemcallnumebr system preference

This patch undefines the CNsubfields variable when the whole field is requested

Note that the substr returns '' when no characters are found, so we test if the string eq ''

Testing 'truth' doesn't work because "0" is a valid option

To test:
 1 - Edit a record, add an 082 field
     082 0 0 ‡aalpha‡bbeta‡0delta
 2 - Set itemcallnumber system preference to 082
 3 - Attempt to add/edit items
 4 - ISE
 5 - Apply patch, restart all the things
 6 - Add/edit items - no error
 7 - Confirm the itemcallnumber field is populated with "alpha beta delta"
 8 - Set itemcallnumber system preference to '0820'
 9 - Add/edit items
10 - Confirm itemcallnumber is populated with 'delta'
Comment 2 Salman Ali 2021-06-10 18:59:05 UTC
Created attachment 121808 [details] [review]
Bug 28533: Set subfields to 'undef' if whole field request in itemcallnumebr system preference

This patch undefines the CNsubfields variable when the whole field is requested

Note that the substr returns '' when no characters are found, so we test if the string eq ''

Testing 'truth' doesn't work because "0" is a valid option

To test:
 1 - Edit a record, add an 082 field
     082 0 0 ‡aalpha‡bbeta‡0delta
 2 - Set itemcallnumber system preference to 082
 3 - Attempt to add/edit items
 4 - ISE
 5 - Apply patch, restart all the things
 6 - Add/edit items - no error
 7 - Confirm the itemcallnumber field is populated with "alpha beta delta"
 8 - Set itemcallnumber system preference to '0820'
 9 - Add/edit items
10 - Confirm itemcallnumber is populated with 'delta'

Signed-off-by: Salman Ali <salman@outaouais>