Bug 32478: (QA follow-up) Keep current hashref behavior
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Fri, 26 May 2023 09:28:28 +0000 (09:28 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Fri, 9 Jun 2023 19:05:07 +0000 (16:05 -0300)
commitab1cb8a3c09c8ec8fb26cc1e2a2321eff939cc64
tree85787a774c73d55d3f82d1ae59dc99fa7a6b5c02
parentb4192a6525bd4680b844a2e844d709558168565d
Bug 32478: (QA follow-up) Keep current hashref behavior

Prevent a crash on wrong contents for ItemsDeniedRenewal pref
as we did before.
Note: Could be a provisional measure (no band aid to repeat anywhere)
until we resolve this in preferences.pl.

Test plan:
Without this patch:
Change ItemsDeniedRenewal to 'nonsense'
Run perl -MKoha::Items -e'Koha::Items->find(X)->is_denied_renewal; print "OK\n"'
=> Replace X by a valid itemnumber
Crashes with: Can't use string ("nonsense") as a HASH ref ... No OK print.

Apply this patch
Run perl -MKoha::Items -e'Koha::Items->find(X)->is_denied_renewal; print "OK\n"'
=> Replace X by a valid itemnumber
Warns only with: Hashref expected for ItemsDeniedRenewal. You got OK.
Clear ItemsDeniedRenewal
Try again. No warning anymore.
Run t/Context.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
C4/Context.pm
t/Context.t