Bug 29243 - PrepareItemrecordDisplay should not be called with empty string in defaultvalues
Summary: PrepareItemrecordDisplay should not be called with empty string in defaultvalues
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Nick Clemens
QA Contact: Testopia
URL:
Keywords:
Depends on: 27545
Blocks:
  Show dependency treegraph
 
Reported: 2021-10-14 11:21 UTC by Nick Clemens
Modified: 2022-06-06 20:27 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.11.00,21.05.05


Attachments
Bug 29243: Correct call when adding items from staged records (2.20 KB, patch)
2021-10-14 11:34 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 29243: Correct call when adding items from staged records (2.27 KB, patch)
2021-10-14 15:49 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 29243: Correct call when adding items from staged records (2.33 KB, patch)
2021-10-15 08:35 UTC, Martin Renvoize
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-10-14 11:21:33 UTC
Bug 27545 expanded the use of NewItemsDefaultLocation, however, it checks for $defaultvalues undefined.

There are several calls that pass '' (empty string) for default values.

It is expected to be a hashref, so we should pass undef if we don't have defaults.

Otherwise, we get an error when NewItemsDefaultLocation is set:
Can't use string ("") as a HASH ref while "strict refs" in use at /usr/share/koha/lib/C4/Items.pm line 1605.
Comment 1 Nick Clemens 2021-10-14 11:34:46 UTC
Created attachment 126271 [details] [review]
Bug 29243: Correct call when adding items from staged records

To test:
1 - Populate system preference  NewItemsDefaultLocation
2 - Stage a file of marc records
3 - Create an acquisitions basket with 'AcqCreateItems' set to 'ordering'
4 - Attempt to add to basket from your staged file
5 - You get a 500 error, and in the logs:
    Can't use string ("") as a HASH ref while "strict refs" in use at /usr/share/koha/lib/C4/Items.pm line 1605.
6 - Apply patch
7 - Repeat #4
8 - Success!
Comment 2 Andrew Fuerste-Henry 2021-10-14 15:49:08 UTC
Created attachment 126297 [details] [review]
Bug 29243: Correct call when adding items from staged records

To test:
1 - Populate system preference  NewItemsDefaultLocation
2 - Stage a file of marc records
3 - Create an acquisitions basket with 'AcqCreateItems' set to 'ordering'
4 - Attempt to add to basket from your staged file
5 - You get a 500 error, and in the logs:
    Can't use string ("") as a HASH ref while "strict refs" in use at /usr/share/koha/lib/C4/Items.pm line 1605.
6 - Apply patch
7 - Repeat #4
8 - Success!

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Comment 3 Martin Renvoize 2021-10-15 08:35:04 UTC
Created attachment 126311 [details] [review]
Bug 29243: Correct call when adding items from staged records

To test:
1 - Populate system preference  NewItemsDefaultLocation
2 - Stage a file of marc records
3 - Create an acquisitions basket with 'AcqCreateItems' set to 'ordering'
4 - Attempt to add to basket from your staged file
5 - You get a 500 error, and in the logs:
    Can't use string ("") as a HASH ref while "strict refs" in use at /usr/share/koha/lib/C4/Items.pm line 1605.
6 - Apply patch
7 - Repeat #4
8 - Success!

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize 2021-10-15 08:35:34 UTC
Clear patch, works as expected. QA Scripts are happy.

Passing QA
Comment 5 Jonathan Druart 2021-10-18 09:34:20 UTC
Pushed to master for 21.11, thanks to everybody involved!
Comment 6 Kyle M Hall 2021-10-22 15:07:10 UTC
Pushed to 21.05.x for 21.05.05
Comment 7 Fridolin Somers 2021-10-23 01:47:18 UTC
Depends on Bug 27545 not in 20.11.x