From c32d91207595799ebfcaa0121359deb1ba4b5860 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Thu, 4 Aug 2022 15:20:59 +1200 Subject: [PATCH] Bug 15516: Allow to reserve first available item from a group of titles It can be useful, for instance, if a library has the same title from different publishers (so 1 title but several biblio records) but the user only wants a copy of the book, regardless of the publisher. Test plan: 0. Run updatedatabase.pl and misc/devel/update_dbix_class_files.pl 1. Go to intranet search, display some results, click on some checkboxes and click on 'Place hold' button at the top of the results. 2. Search for a patron 3. Check the 'Treat as hold group' checkbox 4. Click on 'Place hold' 5. In the next screen you should see all the holds you placed with the additional text '(part of a hold group)' in Details column. 6. Click on the "hold group" link. A modal window should appear with the content of the hold group (a list of holds) 7. Check in an item of one of the reserved biblios and confirm the hold 8. The hold status is changed to Waiting, and all other holds are deleted. The other holds will also be removed from the holds queue. 9. Confirm tests pass - t/db_dependent/Koha/Holds.t - t/db_dependent/Reserves/HoldGroup.t Note: the "hold group" link is displayed in the following pages: - reserve/request.pl - circ/circulation.pl - members/moremember.pl - circ/pendingreserves.pl - circ/view_holdsqueue.pl Note: A hold group is counted as only one hold Sponsored-by: Catalyst IT Signed-off-by: Michal Denar Signed-off-by: Victor Grousset/tuxayo Signed-off-by: Michal Denar --- circ/circulation.pl | 2 +- circ/view_holdsqueue.pl | 10 +++++ .../prog/en/includes/hold-group-modal.inc | 15 +++++++ .../prog/en/includes/holds_table.inc | 3 ++ .../prog/en/modules/circ/circulation.tt | 3 ++ .../prog/en/modules/circ/pendingreserves.tt | 6 +++ .../prog/en/modules/circ/view_holdsqueue.tt | 6 +++ .../prog/en/modules/members/moremember.tt | 3 ++ .../prog/en/modules/reserve/hold-group.tt | 30 +++++++++++++ .../prog/en/modules/reserve/request.tt | 13 +++++- koha-tmpl/intranet-tmpl/prog/js/hold-group.js | 8 ++++ koha-tmpl/intranet-tmpl/prog/js/holds.js | 6 +++ members/moremember.pl | 4 +- opac/opac-reserve.pl | 2 +- reserve/hold-group.pl | 42 +++++++++++++++++++ reserve/placerequest.pl | 10 +++++ reserve/request.pl | 3 +- svc/holds | 1 + 18 files changed, 160 insertions(+), 7 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/hold-group-modal.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/reserve/hold-group.tt create mode 100644 koha-tmpl/intranet-tmpl/prog/js/hold-group.js create mode 100755 reserve/hold-group.pl diff --git a/circ/circulation.pl b/circ/circulation.pl index da5e2b566a..a957146d6f 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -503,7 +503,7 @@ if ($patron) { my $holds = Koha::Holds->search( { borrowernumber => $borrowernumber } ); # FIXME must be Koha::Patron->holds my $waiting_holds = $holds->waiting; $template->param( - holds_count => $holds->count(), + holds_count => $holds->count_holds, WaitingHolds => $waiting_holds, ); diff --git a/circ/view_holdsqueue.pl b/circ/view_holdsqueue.pl index 241697ab03..1d2231ca16 100755 --- a/circ/view_holdsqueue.pl +++ b/circ/view_holdsqueue.pl @@ -56,6 +56,16 @@ if ($run_report) { locationslimit => $locationslimit } ); + for my $item (@$items) { + my $related_hold = Koha::Holds->search( + { + borrowernumber => $item->{borrowernumber}, reservedate => $item->{reservedate}, + biblionumber => $item->{biblionumber} + }, + { order_by => 'reservedate' } + )->next; + $item->{hold_group_id} = $related_hold ? $related_hold->hold_group_id : undef; + } $template->param( branchlimit => $branchlimit, diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/hold-group-modal.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/hold-group-modal.inc new file mode 100644 index 0000000000..2b011dbf46 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/hold-group-modal.inc @@ -0,0 +1,15 @@ + diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc index 27c080009e..b22c5e4ec9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc @@ -220,6 +220,9 @@ [%- IF hold.non_priority -%]
Non priority hold [%- END -%] + [%- IF hold.hold_group_id -%] +
(part of a hold group)
+ [%- END -%] [%- IF ( CAN_user_reserveforothers_modify_holds_priority ) -%] [%- UNLESS hold.found -%] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index 979f916cd8..85e357ef5e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -951,6 +951,8 @@ +[% INCLUDE 'hold-group-modal.inc' %] + [% MACRO jsinclude BLOCK %] [% INCLUDE 'datatables.inc' %] [% INCLUDE 'columns_settings.inc' %] @@ -990,6 +992,7 @@ [% END %] [% Asset.js("js/holds.js") | $raw %] [% INCLUDE 'calendar.inc' %] + [% Asset.js("js/hold-group.js") | $raw %]