]> git.koha-community.org Git - koha.git/commit
Bug 27745: prevent warning for uninitialized value as a hash key
authorPetro Vashchuk <stalkernoid@gmail.com>
Wed, 3 Mar 2021 09:32:48 +0000 (11:32 +0200)
committerAndrew Fuerste-Henry <andrew@bywatersolutions.com>
Sun, 14 Mar 2021 19:52:43 +0000 (19:52 +0000)
commit632f4600e0d80c27366aa4af603f709f5ada3fe8
treea5f33852431f82aec6b82000e12f12be7543cd2e
parent7599a6c4dca9cb2744b8695edef8192202d37b9d
Bug 27745: prevent warning for uninitialized value as a hash key

When you edit and save items with an empty "c - Shelving location"
field, it gets stored into the database as "NULL",
which is allowed in the database, and the field is not "required",
so this seems expected.

But when the search page is rendered, it gets value by location key
($shelflocations->{ $item->{location} }) which gives undef warning.

Solved by checking if $item->{location} is perl true.

To reproduce:
    1) Edit the book or create new one with an empty shelving location.
    2) Use the search feature to have that book in the searched list.
    3) Check plack-intranet-error.log to find "Use of uninitialized
value in hash element" error.
    4) Apply the patch.
    5) Repeat the search and check the logs again to ensure that error
didn't appear again.

Signed-off-by: Didier Gautheron <didier.gautheron@biblibre.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ebf123bf139b28d274ade70016c1af0e3aeffb1b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 4b6e421f1f40bd99cba0c380510824f4a45894cd)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
C4/Search.pm