Bugzilla – Attachment 184054 Details for
Bug 15516
Allow to place a hold on first available item from a group of titles
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15516: (follow-up) Tweaks to new feature
Bug-15516-follow-up-Tweaks-to-new-feature.patch (text/plain), 13.75 KB, created by
Pedro Amorim
on 2025-07-14 16:11:28 UTC
(
hide
)
Description:
Bug 15516: (follow-up) Tweaks to new feature
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2025-07-14 16:11:28 UTC
Size:
13.75 KB
patch
obsolete
>From db1dc23e0392b0f9a8dbd0b1021167e4d4dea521 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >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 <pedro.amorim@openfifth.co.uk> >--- > 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 f2b6d940cc0..7cc71ffde0c 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 9cd73cfe859..2643ed75665 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 47b9e1379eb..09fe7106a5a 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 @@ > <input name="non_priority" id="non_priority" type="checkbox" /> > <span class="hint">A non priority hold doesn't prevent a current checkout from renewing</span> > </li> >- >- [% IF ( Koha.Preference('DisplayAddHoldGroups') && ( multi_hold ) ) %] >- <li id="hold_group_list_item"> >- <label for="hold_group">Treat as hold group: </label> >- <input name="hold_group" id="hold_group" type="checkbox" /> >- <span class="hint">Place a hold on the next available title from this group</span> >- </li> >- [% END %] > </ol> > </fieldset> > <fieldset class="rows any_specific"> >@@ -1089,6 +1081,14 @@ > <label for="to">Hold expires on date:</label> > <input id="expiration_date" name="expiration_date" id="to" size="10" type="text" class="flatpickr" data-flatpickr-futuredate="true" /> > </li> >+ >+ [% IF ( Koha.Preference('DisplayAddHoldGroups') ) %] >+ <li id="hold_group_list_item"> >+ <label for="hold_group">Treat as hold group: </label> >+ <input name="hold_group" id="hold_group" type="checkbox" /> >+ <span class="hint">Place a hold on the next available title from this group</span> >+ </li> >+ [% END %] > </ol> > <table id="requesttitles"> > <tr> >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 %] > <p class="hint">Item on hold: [% HOLD.item.barcode | html %]</p> > [% END %] >+ [% IF HOLD.hold_group_id %] >+ <div class="group_hold"> >+ <span class="hint">(part of a hold group)</span> >+ <div class="group_hold_list" style="display:none"> >+ [% group_holds = HOLD.hold_group.holds %] >+ [% IF ( group_holds.count ) %] >+ <span class="hint">Containing the following:</span> >+ <ul> >+ [% FOREACH hg_member IN group_holds %] >+ <li>[% INCLUDE 'biblio-title.inc' biblio=hg_member.biblio link=>1 %]</li> >+ [% END %] >+ </ul> >+ [% END %] >+ </div> >+ </div> >+ [% END %] > </td> > <td class="reservedate" data-order="[% HOLD.reservedate | html %]"> [% HOLD.reservedate | $KohaDates %] </td> > <td class="expirationdate" data-order="[% !HOLD.found ? HOLD.expirationdate : '0000-00-00' | html %]"> >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' %] > <legend class="sr-only">Hold requests</legend> > <input type="hidden" name="op" value="cud-place_reserve" /> >+ [% IF ( Koha.Preference('DisplayAddHoldGroups') && ( multi_hold ) ) %] >+ <div id="hold_group"> >+ <fieldset class="rows"> >+ <ul> >+ <li> >+ <label for="add_to_hold_group_control">Treat as hold group (next available item fulfills all holds):</label> >+ <input type="checkbox" id="add_to_hold_group_control" name="add_to_hold_group" value="add_to_hold_group" /> >+ </li> >+ </ul> >+ </fieldset> >+ </div> >+ [% END %] > <!-- These values are set dynamically by js --> > <input type="hidden" name="biblionumbers" id="biblionumbers" /> > <input type="hidden" name="selecteditems" id="selections" /> >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" %] >- <span>Holds ([% RESERVES.count | html %])</span> >+ <span>Holds ([% reserves_count | html %])</span> > [% END %] > [% END %] > [% IF Koha.Preference('UseRecalls') && RECALLS.count %] >@@ -1443,4 +1443,5 @@ > }); > </script> > [% 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 2e8d7b46c4e..6b4241940d0 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 @@ > }); > }); > </script> >+ [% Asset.js("js/holds.js") | $raw %] > [% IF ( Koha.Preference('SCOUserJS') ) %] > <script> > [% Koha.Preference('SCOUserJS') | $raw %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/holds.js b/koha-tmpl/opac-tmpl/bootstrap/js/holds.js >new file mode 100644 >index 00000000000..24f7b2d011b >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/holds.js >@@ -0,0 +1,5 @@ >+$(document).ready(function () { >+ $("div.group_hold").click(function () { >+ $(this).find("div.group_hold_list").toggle(); >+ }); >+}); >diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl >index 316004c3cd0..0ba22c25f32 100755 >--- a/opac/opac-reserve.pl >+++ b/opac/opac-reserve.pl >@@ -160,7 +160,8 @@ $template->param( branch => $branch ); > # > # > if ( $op eq 'cud-place_reserve' ) { >- my $reserve_cnt = 0; >+ my $add_to_hold_group = $query->param('add_to_hold_group'); >+ my $reserve_cnt = 0; > if ($maxreserves) { > $reserve_cnt = $patron->holds->count_holds; > } >@@ -194,6 +195,7 @@ if ( $op eq 'cud-place_reserve' ) { > } > > my @failed_holds; >+ my $hold_group; > while (@selectedItems) { > my $biblioNum = shift(@selectedItems); > my $itemNum = shift(@selectedItems); >@@ -290,6 +292,13 @@ if ( $op eq 'cud-place_reserve' ) { > > # Here we actually do the reserveration. Stage 3. > if ($canreserve) { >+ if ($add_to_hold_group) { >+ >+ #NOTE: We wait to create a hold group until we know that we can actually place a hold/reserve >+ if ( !$hold_group ) { >+ $hold_group = Koha::HoldGroup->new->store; >+ } >+ } > my $reserve_id = AddReserve( > { > branchcode => $branch, >@@ -304,6 +313,7 @@ if ( $op eq 'cud-place_reserve' ) { > found => undef, > itemtype => $itemtype, > item_group_id => $item_group_id, >+ hold_group_id => $hold_group ? $hold_group->id : undef, > } > ); > if ($reserve_id) { >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index be5f63896b2..63561f3a26b 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -347,8 +347,9 @@ $template->param( show_barcode => 1 ) if $show_barcode; > my $reserves = $patron->holds->filter_out_has_cancellation_requests; > > $template->param( >- RESERVES => $reserves, >- showpriority => $show_priority, >+ RESERVES => $reserves, >+ reserves_count => $reserves->count_holds, >+ showpriority => $show_priority, > ); > > if ( C4::Context->preference('UseRecalls') ) { >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15516
:
46392
|
47498
|
47570
|
47961
|
47962
|
47963
|
48097
|
48098
|
48448
|
48449
|
50094
|
50095
|
50096
|
53742
|
53743
|
53744
|
53770
|
53771
|
53772
|
53774
|
53775
|
53776
|
54977
|
55300
|
55304
|
55305
|
55306
|
55307
|
55308
|
55768
|
55769
|
55770
|
55771
|
55772
|
58799
|
58800
|
58801
|
58802
|
58803
|
59314
|
59315
|
59316
|
59317
|
59318
|
69902
|
69903
|
69904
|
69905
|
69906
|
72485
|
72486
|
72487
|
72488
|
72489
|
72491
|
79077
|
79078
|
79080
|
79081
|
79082
|
79083
|
79213
|
79214
|
79215
|
79216
|
79217
|
79218
|
79219
|
79220
|
79221
|
79222
|
81453
|
81454
|
81455
|
81456
|
81457
|
81458
|
81459
|
81460
|
81461
|
81462
|
81463
|
84554
|
84555
|
84556
|
84557
|
84558
|
84559
|
84560
|
84561
|
84562
|
84563
|
84564
|
87828
|
87829
|
87830
|
87831
|
87832
|
87833
|
87834
|
87835
|
87836
|
87837
|
87838
|
88038
|
88039
|
88125
|
88173
|
88174
|
88175
|
88176
|
88177
|
88178
|
88179
|
88180
|
88181
|
88182
|
88183
|
88184
|
88185
|
88186
|
90289
|
90290
|
90291
|
90292
|
90293
|
90294
|
90295
|
90296
|
90297
|
90298
|
90299
|
90300
|
90301
|
90302
|
90303
|
90829
|
90830
|
90831
|
90832
|
90833
|
90834
|
90835
|
90836
|
90837
|
90838
|
90839
|
90840
|
90841
|
90842
|
90843
|
90844
|
92783
|
92784
|
92785
|
92786
|
92787
|
92788
|
92789
|
92790
|
92791
|
92792
|
92793
|
92794
|
92795
|
92796
|
92797
|
92798
|
114513
|
114514
|
114515
|
114516
|
114517
|
114518
|
114585
|
114586
|
114603
|
114624
|
114625
|
114626
|
114627
|
114628
|
114629
|
114630
|
114631
|
114632
|
114633
|
114634
|
114635
|
114636
|
114637
|
114638
|
114639
|
114640
|
114641
|
114642
|
114643
|
114644
|
114645
|
114647
|
114648
|
114649
|
114650
|
114651
|
114652
|
114653
|
114654
|
114655
|
114656
|
114657
|
114658
|
114659
|
117423
|
117424
|
117425
|
117426
|
118281
|
118282
|
118283
|
118284
|
118285
|
118286
|
118350
|
118351
|
118352
|
118353
|
118354
|
118355
|
120368
|
120369
|
120370
|
120371
|
120372
|
120373
|
120574
|
120643
|
120644
|
120645
|
120646
|
120647
|
120648
|
120649
|
120650
|
120651
|
121523
|
121623
|
122097
|
122102
|
122627
|
128189
|
128190
|
128191
|
128192
|
128193
|
128194
|
128195
|
128196
|
128197
|
128198
|
128199
|
128200
|
128201
|
128202
|
128255
|
128256
|
128257
|
128258
|
128259
|
128260
|
128261
|
128262
|
128263
|
128264
|
128265
|
128266
|
128267
|
128268
|
128269
|
128285
|
128286
|
128287
|
128288
|
128289
|
128290
|
128291
|
128292
|
128293
|
128294
|
128295
|
128296
|
128297
|
128298
|
128299
|
138576
|
138577
|
138578
|
138579
|
138580
|
138581
|
138582
|
138583
|
138584
|
138585
|
138586
|
138587
|
138588
|
138589
|
138593
|
138594
|
138595
|
138596
|
138597
|
138738
|
138739
|
138740
|
138741
|
138742
|
138772
|
138868
|
138869
|
162076
|
162077
|
162078
|
162079
|
162080
|
162081
|
162082
|
162083
|
162084
|
183876
|
183877
|
183878
|
183879
|
183880
|
183915
|
184047
|
184048
|
184050
|
184051
|
184052
|
184053
|
184054
|
184055
|
184056
|
184057
|
184058
|
184066
|
184530
|
184534
|
185135
|
185456
|
185457
|
185458
|
185459
|
185460
|
185461
|
185462
|
185463
|
185464
|
185465
|
185466
|
185492
|
185509