]> git.koha-community.org Git - koha.git/commit
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)
committerPedro Amorim <pedro.amorim@ptfs-europe.com>
Tue, 18 Jul 2023 08:58:45 +0000 (08:58 +0000)
commit46ef2e6f04192b35c2148eb247139c1aed53d8c6
tree8b21ec3dcf1d98aeddd3beca6426f7dd6d7aea69
parent27d5e594bc2ae3ff274ec975f0838bbbb05efdeb
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>
(cherry picked from commit ab1cb8a3c09c8ec8fb26cc1e2a2321eff939cc64)
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
C4/Context.pm
t/Context.t