Bug 29807: Make Branches plugin handle empty pickup locations list
authorTomas Cohen Arazi <tomascohen@theke.io>
Thu, 6 Jan 2022 11:53:30 +0000 (08:53 -0300)
committerFridolin Somers <fridolin.somers@biblibre.com>
Wed, 19 Jan 2022 22:13:49 +0000 (12:13 -1000)
commitfe0a0ee83490103d49711d2afaacb9803e9b9740
tree9ef3052a0d24892163a3a3502b770e1fedcc2d4e
parentfa1e67ecc7177544a60fd438b60e3a9d4e142e9d
Bug 29807: Make Branches plugin handle empty pickup locations list

This patch makes the plugin handle empty Koha::Biblio->pickup_locations
and Koha::Item->pickup_locations correctly.

It does so by explicitly calling ->as_list. It also restores the logic
that was changed by 6cd1ffab4e491349c99769018a7df33dc8a8aabf so, now
that ->empty is handled correctly, it doesn't return ALL the pickup
locations when the item/biblio doesn't have valid pickup locations.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Template/Plugin/Branches.t
=> FAIL: Awful error
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Koha/Template/Plugin/Branches.pm