From c1e7da6eed89bf36646355aa1c80838453568a16 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 Signed-off-by: Lucas Gass --- 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 67cd533daf..23ac7e4541 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 0162b93707..3997826396 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 19ad42c216..0e84982fb1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -619,14 +619,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 %]
    @@ -1097,6 +1089,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 c6a11c06cc..aea8958b32 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') ) %]