From 858ce86a261872e3181ed4478f79a5e46f5a0c87 Mon Sep 17 00:00:00 2001 From: David Cook Date: Tue, 13 Feb 2024 05:35:54 +0000 Subject: [PATCH] Bug 15516: (follow-up) Tweaks to new feature Bug 15516: Add ability to create and view hold groups from OPAC This patch adds a "Treat as hold group" to opac-reserve.pl, which lets OPAC users create a hold group which can include 1+ bibs and either bib-level holds, or item-level holds, or both. This patch shows the item-level and bib-level holds in a hold group for the user's holds in the OPAC. This includes both the opac-user.pl page and the self-checkout hold display. Bug 15516: (follow-up) Only show hold groups for multi hold in OPAC Bug 15516: (follow-up) Only show hold groups for multi hold in staff interface Bug 15516: Add 'DisplayAddHoldGroups' system preference to toggle ability to add titles to hold groups These patches add the ability to create hold groups across multiple bibs in the staff interface or OPAC. These hold groups are fulfilled by the first item checked in across the hold group. --- Koha/Holds.pm | 6 ++---- installer/data/mysql/mandatory/sysprefs.sql | 1 + .../modules/admin/preferences/circulation.pref | 6 ++++++ .../prog/en/modules/reserve/request.tt | 16 ++++++++-------- .../bootstrap/en/includes/holds-table.inc | 16 ++++++++++++++++ .../bootstrap/en/modules/opac-reserve.tt | 12 ++++++++++++ .../opac-tmpl/bootstrap/en/modules/opac-user.tt | 3 ++- .../bootstrap/en/modules/sco/sco-main.tt | 1 + koha-tmpl/opac-tmpl/bootstrap/js/holds.js | 5 +++++ opac/opac-reserve.pl | 12 +++++++++++- opac/opac-user.pl | 5 +++-- 11 files changed, 67 insertions(+), 16 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/bootstrap/js/holds.js diff --git a/Koha/Holds.pm b/Koha/Holds.pm index dcdd08584d..300c10d4b1 100644 --- a/Koha/Holds.pm +++ b/Koha/Holds.pm @@ -218,10 +218,8 @@ Return the number of holds, where a hold group is counted as one hold. sub count_holds { my ( $self, $search_params ) = @_; - - $search_params = { - hold_group_id => undef, - }; + $search_params = {} if !$search_params; + $search_params->{hold_group_id} = undef; my $holds_without_group_count = $self->search($search_params)->count(); $search_params = { diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index f9f419c39d..1cda056062 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -220,6 +220,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('DefaultToLoggedInLibraryNoticesSlips', '0', NULL , 'If enabled,slips and notices editor will default to the logged in library''s rules, rather than the ''all libraries'' rules.', 'YesNo'), ('DefaultToLoggedInLibraryOverdueTriggers', '0', NULL , 'If enabled, overdue status triggers editor will default to the logged in library''s rules, rather than the ''default'' rules.', 'YesNo'), ('Display856uAsImage','OFF','OFF|Details|Results|Both','Display the URI in the 856u field as an image, the corresponding staff interface XSLT option must be on','Choice'), +('DisplayAddHoldGroups','1','','Display the ability to create hold groups which are fulfilled by one item','YesNo'), ('DisplayClearScreenButton','no','no|issueslip|issueqslip','If set to ON, a clear screen button will appear on the circulation page.','Choice'), ('displayFacetCount','0',NULL,NULL,'YesNo'), ('DisplayIconsXSLT','1','','If ON, displays the format, audience, and material type icons in XSLT MARC21 results and detail pages.','YesNo'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index 9cd73cfe85..2643ed7566 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -960,6 +960,12 @@ Circulation: 1: Enable 0: "Don't enable" - "the ability to place holds on different items at the same time in staff interface and OPAC." + - + - pref: DisplayAddHoldGroups + choices: + 1: Enable + 0: "Don't enable" + - "the ability to create hold groups which are fulfilled by one item" - - pref: TransferWhenCancelAllWaitingHolds choices: diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt index 47b9e1379e..09fe7106a5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -611,14 +611,6 @@ A non priority hold doesn't prevent a current checkout from renewing - - [% IF ( Koha.Preference('DisplayAddHoldGroups') && ( multi_hold ) ) %] -
  • - - - Place a hold on the next available title from this group -
  • - [% END %]
    @@ -1089,6 +1081,14 @@ + + [% IF ( Koha.Preference('DisplayAddHoldGroups') ) %] +
  • + + + Place a hold on the next available title from this group +
  • + [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc index 2df921a1db..43cc5e75d0 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc @@ -64,6 +64,22 @@ [% IF HOLD.item_level_hold %]

    Item on hold: [% HOLD.item.barcode | html %]

    [% END %] + [% IF HOLD.hold_group_id %] +
    + (part of a hold group) + +
    + [% END %]
    [% HOLD.reservedate | $KohaDates %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt index 6a7fb94e4f..b5c5120c23 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt @@ -110,6 +110,18 @@ [% INCLUDE 'csrf-token.inc' %] Hold requests + [% IF ( Koha.Preference('DisplayAddHoldGroups') && ( multi_hold ) ) %] +
    +
    +
      +
    • + + +
    • +
    +
    +
    + [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt index 1c63a78d03..e17f760b01 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -272,7 +272,7 @@ [% IF ( RESERVES.count ) %] [% WRAPPER tab_item tabname= "opac-user-holds" %] - Holds ([% RESERVES.count | html %]) + Holds ([% reserves_count | html %]) [% END %] [% END %] [% IF Koha.Preference('UseRecalls') && RECALLS.count %] @@ -1443,4 +1443,5 @@ }); [% END %] + [% Asset.js("js/holds.js") | $raw %] [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt index 52227a6b42..e7deecb529 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt @@ -533,6 +533,7 @@ }); }); + [% Asset.js("js/holds.js") | $raw %] [% IF ( Koha.Preference('SCOUserJS') ) %]