Bugzilla – Attachment 83381 Details for
Bug 15565
Place multiple item-level holds at once for the same record
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15565: (follow-up) Place multiple holds from opac-search.pl
Bug-15565-follow-up-Place-multiple-holds-from-opac.patch (text/plain), 6.95 KB, created by
Alex Buckley
on 2018-12-19 03:32:27 UTC
(
hide
)
Description:
Bug 15565: (follow-up) Place multiple holds from opac-search.pl
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2018-12-19 03:32:27 UTC
Size:
6.95 KB
patch
obsolete
>From 6ad4c5177b423956426e415f162be45e3c4407d9 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Wed, 21 Nov 2018 10:55:39 +0000 >Subject: [PATCH] Bug 15565: (follow-up) Place multiple holds from > opac-search.pl > >Previously before this patch if you selected multiple bibliographic >results from opac-search.pl and selected 'Place hold' and confirmed the >hold only 1 hold on the first of the selected biblios would be placed. > >This patch fixes this bug and enables users to be able to place holds on >multiple bibliographic records in opac-search.pl, select 'Place hold', select if they want >each of these holds to be on 'Next available', 'Next available from >group', or 'A specific item' and place their holds and all the holds >they placed will be placed correctly. > >Test plan: >1. Follow test plan on the last patch - (Don't apply this patch) >2. Try to select multiple bibliographic record checkboxes and select >'Place hold' >3. Confirm holds and notice you are re-directed to opac-user.pl and only >the first hold has been placed > >4. Apply this patch >5. Restart memcached and plack if running >6. Repeat steps 2 and 3 and notice all holds were placed >7. Repeat step 2 and then select a variety of 'A specific item' and 'Next >available item' holds for each of the bibliographic holds and >confirm they are all placed correctly >8. Confirm you can still place multiple holds correctly in opac-reserve >accessing from a OPAC biblio detail page > >Sponsored-By: Brimbank Library, Australia >--- > .../opac-tmpl/bootstrap/en/modules/opac-reserve.tt | 8 +++++--- > opac/opac-reserve.pl | 21 +++++++++++++++++---- > 2 files changed, 22 insertions(+), 7 deletions(-) > >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 3136300..de19cd0 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >@@ -146,6 +146,7 @@ > <form action="/cgi-bin/koha/opac-reserve.pl" method="post" id="hold-request-form"> > <input type="hidden" name="place_reserve" value="1"/> > <!-- These values are set dynamically by js --> >+ <input type="hidden" name="biblionumbers" id="biblionumbers"/> > <div id="bigloop"> > > [% FOREACH bibitemloo IN bibitemloop %] >@@ -614,7 +615,7 @@ > total += parseInt($("input[name='checkitem_'"+biblioNum+"]:checked").length); > total -= 2; > } else { >- total += parseInt($("select[name='holds_to_place_count_"+biblioNum+"']").val()); >+ total += parseInt($("input[name='holds_to_place_count_"+biblioNum+"']").val()); > } > }); > return total; >@@ -655,6 +656,7 @@ > > // When 'Place Hold' button is clicked > $(".placehold").click(function(){ >+ var biblionumbers = ""; > if (total_requested() + [% reserves_count | html %] > [% maxreserves | html %]) { > alert(MSG_MAX_HOLDS_EXCEEDED); > return false; >@@ -669,7 +671,7 @@ > var badBib = null; > $("input[name='biblionumbers']:checked").each(function() { > var biblioNum = $(this).val(); >- >+ biblionumbers += biblioNum + "/"; > // If required hold note is empty, make it visible > if( $("#holdnotes_"+biblioNum).attr( 'required' ) && $("#holdnotes_"+biblioNum).val() == '' ) { > if( !$("#hold-options-"+biblioNum).is(':visible')) { >@@ -693,7 +695,7 @@ > if (badBib) { // alert has been raised already > return false; > } >- >+ $("#biblionumbers").val(biblionumbers); > return true; > }); > >diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl >index 1667697..748fe62 100755 >--- a/opac/opac-reserve.pl >+++ b/opac/opac-reserve.pl >@@ -112,7 +112,8 @@ my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_l > > # Coming from opac-search biblionumbers param is a string, coming from > # opac-reserve, it's an array. >-my @biblionumbers = ref($query->param('biblionumbers')) eq 'Array' >+ >+my @biblionumbers = ref($query->multi_param('biblionumbers')) eq 'Array' > ? $query->param('biblionumbers') > : split(/\//, $query->param('biblionumbers')); > >@@ -120,6 +121,11 @@ unless (@biblionumbers) { > push(@biblionumbers, $query->multi_param('biblionumber')); > } > >+my $multiBibHolds; >+if (scalar(@biblionumbers) > 1) { >+ $multiBibHolds = 1; >+} >+ > # Pass the numbers to the page so they can be fed back > # when the hold is confirmed. TODO: Not necessary? > $template->param( biblionumbers => @biblionumbers ); >@@ -137,6 +143,7 @@ $template->param( branch => $branch ); > > my %biblioDataHash; # Hash of biblionumber to biblio/biblioitems record. > my %itemInfoHash; # Hash of itemnumber to item info. >+ > foreach my $biblioNumber (@biblionumbers) { > > my $biblioData = GetBiblioData($biblioNumber); >@@ -159,7 +166,6 @@ foreach my $biblioNumber (@biblionumbers) { > foreach my $itemInfo (@itemInfos) { > $itemInfoHash{$itemInfo->{itemnumber}} = $itemInfo; > } >- > # Compute the priority rank. > my $biblio = Koha::Biblios->find( $biblioNumber ); > my $holds = $biblio->holds; >@@ -190,11 +196,13 @@ if ( $query->param('place_reserve') ) { > } > > my $failed_holds = 0; >+ > foreach my $biblioNum (@biblionumbers) { > my $itemNum = $query->param("checkitem_$biblioNum"); > my @itemnumbers = $query->param("checkitem_$biblioNum"); > my $branch = $query->param("branch"); > my $reqtype = $query->param("reqtype_$biblioNum"); >+ > if (!$reqtype) { > #If no $reqtype value has been passed from the form this means both reqany and reqspecific radio buttons are disabled because a hold has been placed on this biblio previously and so a forced_hold_level exists. > # Determine what the forced_hold_level is. >@@ -283,8 +291,13 @@ if ( $query->param('place_reserve') ) { > ++$reserve_cnt; > } > } >- print $query->redirect("/cgi-bin/koha/opac-user.pl?" . ( $failed_holds ? "failed_holds=$failed_holds" : q|| ) . "#opac-user-holds"); >- exit; >+ >+ # $multiBibHolds indicates if holds on multiple biblio records has been placed >+ # If not set then can exit and re-direct out of loop otherwise loop through other biblionumbers in @biblionumbers >+ if (!$multiBibHolds) { >+ print $query->redirect("/cgi-bin/koha/opac-user.pl?" . ( $failed_holds ? "failed_holds=$failed_holds" : q|| ) . "#opac-user-holds"); >+ exit; >+ } > } > $canreserve = 0 unless CanBookBeReserved( $borrowernumber, $biblioNum )->{status} eq 'OK'; > unless ( $can_place_hold_if_available_at_pickup ) { >-- >2.1.4
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 15565
:
47527
|
47551
|
47552
|
50068
|
50069
|
50392
|
50393
|
56229
|
56230
|
56231
|
56232
|
56458
|
56510
|
56511
|
56512
|
56513
|
56514
|
56515
|
56517
|
56518
|
56519
|
56520
|
56521
|
56522
|
56523
|
56524
|
61244
|
61245
|
61246
|
61247
|
61248
|
61576
|
61577
|
61578
|
61579
|
61580
|
64590
|
64591
|
64592
|
64593
|
64594
|
66594
|
66595
|
66596
|
66597
|
66598
|
68759
|
68760
|
68761
|
68762
|
68763
|
71643
|
71644
|
71645
|
71646
|
71647
|
71648
|
72644
|
72645
|
72646
|
72647
|
72648
|
72649
|
78242
|
78243
|
78244
|
78245
|
78246
|
78247
|
78248
|
78266
|
78305
|
78417
|
78418
|
78419
|
78420
|
78421
|
78422
|
78423
|
78424
|
78425
|
78426
|
78712
|
78713
|
78714
|
78715
|
78716
|
78717
|
78718
|
78719
|
78720
|
78815
|
78816
|
78817
|
78818
|
78819
|
78820
|
78821
|
78822
|
78823
|
81419
|
81420
|
81421
|
81422
|
81423
|
81424
|
81425
|
81426
|
81427
|
81431
|
81449
|
81570
|
81571
|
81572
|
81573
|
81574
|
81575
|
81576
|
81577
|
81578
|
81579
|
81580
|
81581
|
82205
|
82206
|
82207
|
82208
|
82209
|
82210
|
82211
|
82212
|
82213
|
82214
|
82215
|
82216
|
82220
|
82221
|
83331
|
83332
|
83333
|
83334
|
83335
|
83336
|
83337
|
83338
|
83339
|
83340
|
83341
|
83342
|
83378
|
83380
|
83381
|
84541
|
84542
|
84543
|
84544
|
84545
|
84546
|
84547
|
84548
|
84549
|
84550
|
84551
|
84552
|
84553
|
87979
|
87980
|
87981
|
87982
|
87983
|
87984
|
87985
|
87986
|
87987
|
87988
|
87989
|
87990
|
87991
|
117128
|
117129
|
117130
|
117131
|
117132
|
117133
|
120365
|
120366
|
120367
|
120639
|
120640
|
120641
|
121941
|
122098
|
162071
|
162072
|
162073
|
162074
|
163052
|
163053
|
163054
|
163055
|
163092
|
163093
|
166005
|
166006
|
166007
|
166008
|
166009