Bug 22284: Opac pickup_locations
authorAgustin Moyano <agustinmoyano@theke.io>
Fri, 12 Apr 2019 10:32:48 +0000 (10:32 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 3 Jan 2020 12:58:04 +0000 (12:58 +0000)
commitf668fecec3771b633068f89dcead2312471f9425
tree6560acb72e787cb4ed13a3d8096f23fcf44ad2a8
parent13322855088ed073acce531742460e57e109ef0e
Bug 22284: Opac pickup_locations

This patch modifies Koha::Libraries->pickup_location and moves most of the logic to
Koha::Item and Koha::Biblio in preparation for api endpoints in the future.

There where 2 methods added

1) Koha::Item->pickup_locations that given a patron, returns all pickup locations of
this item, considering hold fulfillment rules, and hold allowed rules.

2) Koha::Biblio->pickup_locations that given a patron, returns a distinct list of
libraries returned by each of this biblio items pickup location.

Koha::Libraries->pickup_location analyzes input param and calls Koha::Item->pickup_locations
or Koha::Biblio->pickup_locations as needed.

Also in opac-reserve.tt the way options where obtained to fill the pickup location select
was modified to pass the patron as a parameter.

To test:
1) opac: try to place hold on a item and check that all libraries are shown in the
pickup location select.
2) intranet: in Library groups, add 2 root groups marked as local hold group and
add different libraries to each.
3) opac: login as a user of a library belonging to one hold group, and search try to
place a hold on an item belongin to the other hold group.
4) intranet: in Circulation and fines rules, play with 'Hold policy' and 'Hold pickup
library match' rules.
5) opac: On each modification of the rules reload the page.
SUCCESS => Every time you reload the page, the number of pickup locations showed in
select varies.
6) prove t/db_dependent/Koha/Biblios.t t/db_dependent/Koha/Items.t
SUCCESS => Result: PASS
7) Sign off

Sponsored-by: VOKAL
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/Biblio.pm
Koha/Item.pm
Koha/Libraries.pm
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt
t/db_dependent/Koha/Biblios.t
t/db_dependent/Koha/Items.t