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>
Wed, 7 Jun 2023 18:25:23 +0000 (15:25 -0300)
commitba06af4974e58fb100e335ebd47fd078bb508fa9
tree26be1a5a71292434c3a4b2ed91f3fd26efab74ee
parentc50dda0d475544f35a6dc08b1beb5f8a26e5302f
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