From 7fb9acb357b86a20b9a82e19d6f954cb8f795968 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. Signed-off-by: Pedro Amorim Signed-off-by: Andrew Fuerste Henry --- 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 dcdd08584dc..300c10d4b13 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 67cd533dafb..23ac7e45416 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -221,6 +221,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 ef3c7acc011..4ef156d30cf 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 b8059b3e7dc..7b45e1bd9aa 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 2df921a1dbc..43cc5e75d02 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 6a7fb94e4f8..b5c5120c237 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 1c63a78d035..e17f760b01c 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 c6a11c06cc1..aea8958b32c 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 @@ -522,6 +522,7 @@ }); }); + [% Asset.js("js/holds.js") | $raw %] [% IF ( Koha.Preference('SCOUserJS') ) %]