From 7735d57ff1d60d22d9102076a2be9afa71894209 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 --- circ/circulation.pl | 2 +- circ/view_holdsqueue.pl | 2 ++ .../prog/en/includes/hold-group-modal.inc | 15 ++++++++ .../intranet-tmpl/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 | 17 ++++++--- 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 | 40 ++++++++++++++++++++++ reserve/placerequest.pl | 10 ++++++ reserve/request.pl | 3 +- svc/holds | 1 + 18 files changed, 152 insertions(+), 9 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 d4b5dcfe94..2e1bf90cee 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -446,7 +446,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 b7070fd7a1..9125f6ef2a 100755 --- a/circ/view_holdsqueue.pl +++ b/circ/view_holdsqueue.pl @@ -56,6 +56,8 @@ if ( $run_report ) { }); for my $item ( @$items ) { $item->{patron} = Koha::Patrons->find( $item->{borrowernumber} ); + 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 be1d4fe101..a17b68bc3c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc @@ -186,6 +186,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 f01738f4f7..bb433a8ded 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -1024,6 +1024,8 @@ +[% INCLUDE 'hold-group-modal.inc' %] + [% MACRO jsinclude BLOCK %] [% INCLUDE 'datatables.inc' %] [% INCLUDE 'columns_settings.inc' %] @@ -1058,6 +1060,7 @@ [% END %] [% Asset.js("js/holds.js") | $raw %] [% INCLUDE 'calendar.inc' %] + [% Asset.js("js/hold-group.js") | $raw %]