Bugzilla – Attachment 80443 Details for
Bug 21528
Combine all reserves in a biblio hold-group into a single line entry
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21528: Single line for hold groups in intranet side
Bug-21528-Single-line-for-hold-groups-in-intranet-.patch (text/plain), 27.62 KB, created by
Alex Buckley
on 2018-10-12 02:23:23 UTC
(
hide
)
Description:
Bug 21528: Single line for hold groups in intranet side
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2018-10-12 02:23:23 UTC
Size:
27.62 KB
patch
obsolete
>From 61caf25689086bd0b786950ffa2f3bb333faf96f Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Wed, 10 Oct 2018 10:05:33 +0000 >Subject: [PATCH] Bug 21528: Single line for hold groups in intranet side > >Sponsored-By: Brimbank Library, Australia >--- > C4/Reserves.pm | 3 +- > .../prog/en/modules/reserve/hold-group.tt | 4 + > .../prog/en/modules/reserve/request.tt | 50 ++++++- > .../opac-tmpl/bootstrap/en/modules/opac-user.tt | 159 +++++++++++++++++++-- > opac/opac-user.pl | 38 +++++ > reserve/hold-group.pl | 2 + > reserve/request.pl | 41 +++++- > 7 files changed, 277 insertions(+), 20 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 95b489e..b6fcfbb 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -2505,7 +2505,8 @@ sub GetHoldGroupHolds { > my $dbh = C4::Context->dbh; > > my $reserves = $dbh->selectall_arrayref(q{ >- SELECT * FROM reserves >+ SELECT * FROM reserves LEFT JOIN items >+ ON reserves.itemnumber = items.itemnumber > WHERE hold_group_id = ? > }, { Slice => {} }, $hold_group_id); > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/hold-group.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/hold-group.tt >index cf7ebaf..09287e3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/hold-group.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/hold-group.tt >@@ -13,6 +13,8 @@ > <th>Title</th> > <th>Priority</th> > <th>Notes</th> >+ <th>Barcode</th> >+ <th>Enumchron</th> > </tr> > </thead> > <tbody> >@@ -22,6 +24,8 @@ > <td><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblio.biblionumber %]">[% biblio.title %]</a></td> > <td>[% hold.priority %]</td> > <td>[% hold.reservenotes %]</td> >+ <td>[% hold.barcode %]</td> >+ <td>[% hold.enumchron %]</td> > </tr> > [% END %] > </tbody> >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 c70969b..f70283d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -809,6 +809,52 @@ function checkMultiHold() { > <th> </th> > [% IF SuspendHoldsIntranet %]<th> </th><!-- Suspend Holds Column Header -->[% END %] > </tr> >+ [% IF (grouped_holds) %] >+ [% FOREACH group_level_hold IN grouped_holds %] >+ <tr> >+ <td>Group hold: <a href="/cgi-bin/koha/reserve/hold-group.pl?hold_group_id=[% group_level_hold.hold.hold_group_id %]">hold group</a></td> >+ <td></td> >+ <td>[% INCLUDE 'patron-title.inc' patron=group_level_hold.patron hide_patron_infos_if_needed=1 %]</td> >+ <td>[% group_level_hold.hold.reservenotes %]</td> >+ <td>[% group_level_hold.hold.reservedate | $KohaDates %]</td> >+ <td>[% group_level_hold.hold.expirationdate | $KohaDates %]</td> >+ <td> >+ [% IF ( group_level_hold.hold.found ) %] >+ [% IF ( group_level_hold.hold.atdestination ) %] >+ [% IF ( group_level_hold.hold.found ) %] >+ Item waiting at <b> [% group_level_hold.hold.wbrname %]</b> <input type="hidden" name="pickup" value="[% group_level_hold.hold.wbrcode %]" /> since [% group_level_hold.hold.waiting_date | $KohaDates %] >+ [% ELSE %] >+ Waiting to be pulled <input type="hidden" name="pickup" value="[% group_level_hold.hold.wbrcode %]" /> >+ [% END %] >+ [% ELSE %] >+ Item being transferred to <b> [% group_level_hold.hold.wbrname %]</b> <input type="hidden" name="pickup" value="[% group_level_hold.hold.wbrcode %]" /> >+ [% END %] >+ [% ELSE %] >+ [% IF Koha.Preference('IndependentBranches') && Branches.all().size == 1 %] >+ [% Branches.GetName(group_level_hold.hold.branchcode) %] <input type="hidden" name="pickup" value="[% group_level_hold.hold.branchcode %]" /> >+ [% ELSE %] >+ <select name="pickup"> >+ [% PROCESS options_for_libraries libraries => Branches.all( selected => group_level_hold.hold.branchcode ) %] >+ </select> >+ [% END %] >+ [% END %] >+ </td> >+ <td> >+ [% IF group_level_hold.hold.hold_group_id %] >+ <div>(part of a <a href="/cgi-bin/koha/reserve/hold-group.pl?hold_group_id=[% group_level_hold.hold.hold_group_id %]">hold group</a>)</div> >+ [% END %] >+ </td> >+ <td></td> >+ <td> >+ <a class="cancel-hold" title="Cancel hold" href="request.pl?action=cancel_group_hold&borrowernumber=[% group_level_hold.hold.borrowernumber %]&biblionumber=[% group_level_hold.hold.biblionumber %]&group_hold_id=[% group_level_hold.hold.hold_group_id %]"> >+ <img src="[% interface %]/[% theme %]/img/x.png" alt="Cancel" /> >+ </a> >+ </td> >+ <td></td> >+ </tr> >+ [% END %] >+ [% END %] >+ > [% FOREACH reserveloo IN biblioloo.reserveloop %] > <tr> > <td> >@@ -917,9 +963,6 @@ function checkMultiHold() { > <input type="hidden" name="itemnumber" value="" /> > [% END %] > [% END %] >- [% IF reserveloo.hold_group_id %] >- <div>(part of a <a href="/cgi-bin/koha/reserve/hold-group.pl?hold_group_id=[% reserveloo.hold_group_id %]">hold group</a>)</div> >- [% END %] > </td> > > [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %] >@@ -959,7 +1002,6 @@ function checkMultiHold() { > [% END # IF SuspendHoldsIntranet %] > > </tr> >- > [% END %] <!-- existing reserveloop --> > </table> > [% END %]<!-- /reserveloop --> >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 0e05092..2c0e069 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >@@ -4,6 +4,7 @@ > [% USE Branches %] > [% USE ItemTypes %] > [% USE Price %] >+[% USE Biblio %] > > [% SET borrower_club_enrollments = borrower.get_club_enrollments(1) %] > [% SET borrower_enrollable_clubs = borrower.get_enrollable_clubs(1,1) %] >@@ -585,20 +586,152 @@ > </tr> > </thead> > <tbody> >- [% FOREACH RESERVE IN RESERVES %] >- [% IF ( RESERVE.is_waiting ) %] >- [% IF ( RESERVE.is_at_destination ) %] >- [% IF ( RESERVE.is_found ) %] >+ [% IF (grouped_holds) %] >+ [% FOREACH group_level_hold IN grouped_holds %] >+ <tr> >+ <td class="title"> >+ [% biblio = Biblio.Get(group_level_hold.hold.biblionumber) %] >+ <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber %]"> >+ [% biblio.title %] >+ </a> >+ [% biblio.author %] >+ </td> >+ <td class="reservedate"> >+ <span title="[% group_level_hold.hold.reservedate %]"> >+ <span class="tdlabel">Hold date:</span> >+ [% group_level_hold.hold.reservedate | $KohaDates %] >+ </span> >+ </td> >+ <td class="expirationdate"> >+ [% IF ! group_level_hold.hold.found %] >+ [% IF ( group_level_hold.hold.expirationdate ) %] >+ <span title="[% group_level_hold.hold.expirationdate %]"> >+ <span class="tdlabel">Expiration:</span> >+ [% group_level_hold.hold.expirationdate | $KohaDates %] >+ </span> >+ [% ELSE %] >+ <span title="0000-00-00"> >+ <span class="tdlabel">Expiration:</span> >+ Never expires >+ </span> >+ [%END %] >+ [% ELSE %] >+ <span title="0000-00-00">-</span> >+ [% END %] >+ </td> >+ [% UNLESS( singleBranchMode) %] >+ <td class="branch"> >+ <span class="tdlabel">Pick up location:</span> >+ [% Branches.GetName(group_level_hold.hold.branchcode ) %] >+ </td> >+ [% END %] >+ [% IF ( showpriority ) %] >+ <td class="priority"> >+ </td> >+ [% END %] >+ <td class="status"> >+ <span class="tdlabel">Status:</span> >+ [% IF ( group_level_hold.hold.is_waiting ) %] >+ [% IF ( group_level_hold.hold.is_at_destination ) %] >+ [% IF ( group_level_hold.hold.found ) %] >+ Item waiting at <b> [% group_level_hold.hold.branch.branchname %]</b> >+ [% IF ( group_level_hold.hold.waitingdate ) %] >+ since [% group_level_hold.hold.waitingdate | $KohaDates %] until [% group_level_hold.hold.lastpickupdate | $KohaDates %] >+ [% END %] >+ <input type="hidden" name="pickup" value="[% group_level_hold.hold.branchcode %]" /> >+ [% ELSE %] >+ Item waiting to be pulled from <b> [% Branches.GetName( group_level_hold.hold.branchcode ) %]</b> >+ [% END %] >+ [% ELSE %] >+ Item in transit to <b> [% Branches.GetName(group_level_hold.hold.branchcode ) %]</b> <input type="hidden" name="pickup" value="[% group_level_hold.hold.branchcode %]" /> >+ [% END %] >+ [% ELSE %] >+ [% IF ( group_level_hold.hold.is_in_transit ) %] >+ [% SET transfer = group_level_hold.hold.item.get_transfer %] >+ Item in transit from <b> [% Branches.GetName( transfer.frombranch ) %]</b> since >+ [% transfer.datesent | $KohaDates %] >+ [% ELSIF ( group_level_level.hold.suspend ) %] >+ Suspended [% IF ( group_level_hold.hold.suspend_until ) %] until [% grou_level_hold.hold.suspend_until %] [% END %] >+ [% ELSE %] >+ [% IF group_level_hold.hold.itemtype %] >+ Pending for next available item of itemtype '[% ItemTypes.GetDescription( group_level_hold.hold.itemtype ) %]' >+ [% ELSE %] >+ Pending >+ [% END %] >+ [% END %] >+ [% END %] >+ </td> >+ [% IF SuspendHoldsOpac %] >+ <td> >+ [% IF ( group_level_hold.hold.is_cancelable_from_opac ) %] >+ [% IF group_level_hold.hold.suspend %] >+ <form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post"> >+ <input type="hidden" name="reserve_id" value="[% group_level_hold.hold.reserve_id %]" /> >+ <button class="btn btn-link" type="submit" name="submit"><i class="icon-play"></i> Resume</button> >+ </form> >+ [% ELSE %] >+ [% IF AutoResumeSuspendedHolds %] >+ <a class="btn btn-link js-show" href="#suspendModal[% group_level_hold.hold.reserve_id %]" role="button" data-toggle="modal"><i class="icon-pause"></i> Suspend</a> >+ [% # hold suspend modal form %] >+ <div id="suspendModal[% group_level_hold.hold.reserve_id %]" class="modal-nojs" tabindex="-1" role="dialog" aria-labelledby="suspendModal[% group_level_hold.hold.reserve_id %]Label" aria-hidden="true"> >+ <form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post"> >+ <div class="modal-header"> >+ <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">Ã</button> >+ [% IF group_level_hold.hold.suspend %] >+ <h3 id="suspendModal[% group_level_hold.hold.reserve_id %]Label">Resume your hold on <i>[% group_level_hold.hold.biblio.title %]</i></h3> >+ [% ELSE %] >+ <h3 id="suspendModal[% group_level_hold.hold.reserve_id %]Label">Suspend your hold on <i>[% group_level_hold.hold.biblio.title %]</i></h3> >+ [% END %] >+ </div> >+ <div class="modal-body"> >+ <input type="hidden" name="reserve_id" value="[% group_level_hold.hold.reserve_id %]" /> >+ <label for="suspend_until_[% group_level_hold.hold.reserve_id %]">Suspend until:</label> >+ <input name="suspend_until" id="suspend_until_[% group_level_hold.hold.reserve_id %]" class="suspend-until" size="10" /> >+ [% INCLUDE 'date-format.inc' %] >+ <p class="js-show"><a href="#" onclick="document.getElementById('suspend_until_[% group_level_hold.hold.reserve_id %]').value='';return false;">Clear date to suspend indefinitely</a></p> >+ <button class="btn btn-mini js-hide" type="submit" name="submit">Suspend</button> >+ </div> >+ <div class="modal-footer"> >+ <button class="btn btn-primary" type="submit" name="submit">Suspend</button> >+ <a href="#" data-dismiss="modal" aria-hidden="true" class="cancel">Cancel</a> >+ </div> >+ </form> >+ [% ELSE %] >+ <form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post"> >+ <input type="hidden" name="reserve_id" value="[% group_level_hold.hold.reserve_id %]" /> >+ <button class="btn btn-link" type="submit" name="submit"><i class="icon-pause"></i> Suspend</button> >+ </form> >+ [% END # / IF AutoResumeSuspendedHolds %] >+ [% END # / IF RESERVE.suspend %] >+ [% END # / IF ( RESERVE.is_cancelable_from_opac)%] >+ </td> >+ [% END # / IF SuspendHoldsOpac %] >+ <td class="modify"> >+ [% IF ( RESERVE.is_cancelable_from_opac ) %] >+ <form action="/cgi-bin/koha/opac-modrequest.pl"method="post"> >+ <input type="hidden" name="biblionumber" value="[% group_level_hold.hold.biblionumber %]" /> >+ <input type="hidden" name="reserve_id" value="[% group_level_hold.hold.reserve_id %]" /> >+ <button type="submit" name="submit" class="btn btn-mini btn-danger" onclick="return confirmDelete(MSG_CONFIRM_DELETE_HOLD);"><i class="icon-remove icon-white"></i> Cancel</button></form> >+ [% END %] >+ </td> >+ </tr> >+ [% END # /FOREACH grouped reserves %] >+ [% END %] >+ [% FOREACH RESERVE IN RESERVES %] >+ [% IF ( RESERVE.is_waiting ) %] >+ [% IF ( RESERVE.is_at_destination ) %] >+ [% IF ( RESERVE.is_found ) %] > <tr class="reserved"> >- [% ELSE %] >+ [% ELSE %] > <tr> >- [% END %] >- [% ELSE %] >- <tr class="transfered"> >- [% END %] >- [% ELSE %] >- <tr> >- [% END %] >+ [% END %] >+ [% ELSE %] >+ <tr class="transfered"> >+ [% END %] >+ [% ELSE %] >+ <tr> >+ [% END %] >+ > <td class="title"> > <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% RESERVE.biblionumber %]"> > [% RESERVE.biblio.title %] >@@ -732,6 +865,7 @@ > </td> > </tr> > [% END # /FOREACH RESERVES %] >+ [% END %] > </tbody> > </table> > >@@ -755,7 +889,6 @@ > <input type="hidden" name="suspend" value="0" /> > </form> > </div> >- [% END %] > </div> <!-- / #opac-user-holds --> > [% END # / #RESERVES.count %] > >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index 2ba7496..ca3beea 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -42,6 +42,7 @@ use Koha::Patron::Attribute::Types; > use Koha::Patron::Messages; > use Koha::Patron::Discharge; > use Koha::Patrons; >+use Data::Dumper; > > use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE'; > >@@ -298,6 +299,43 @@ if ($show_barcode) { > $template->param( show_barcode => 1 ) if $show_barcode; > > # now the reserved items.... >+my @reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } ); >+my $reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } ); >+ >+my %reserve_records; >+my $count = 0; >+foreach my $reserve ( @reserves ) { >+ warn Dumper($reserve->hold_group_id); >+ if ($reserve->hold_group_id) { >+ # Keep track of which hold_group_id (duplicated field) go with each reserve_id (unique field) >+ $reserve_records{ $reserve->hold_group_id }->{ $reserve->reserve_id }++; >+ warn $reserve->reserve_id; >+ $reserves = grep { $_->{'reserve_id'} != $reserve->reserve_id } $reserves; >+ }else { >+ warn $reserve->reserve_id; >+ warn $reserve->hold_group_id; >+ } >+} >+my @grouped_parts; >+for my $hold_group ( sort { $a <=> $b } keys %reserve_records ) { >+ my @reserveids = sort { $a <=> $b } keys %{ $reserve_records{ $hold_group } }; >+ my @holds = GetHoldGroupHolds($hold_group); >+ my $hold = $holds[0]; >+ my $patron = Koha::Patrons->find( {borrowernumber => $hold->{borrowernumber}} ); >+ # Merge the itemnumbers with each hold_group_id >+ push @grouped_parts, { >+ hold_group_id => $hold_group, >+ reserve_id => join(', ', sort { $a <=> $b } @reserveids), >+ hold => $hold, >+ patron => $patron, >+ }; >+} >+ >+warn Dumper(@grouped_parts); >+if (@grouped_parts) { >+ $template->param( grouped_holds => \@grouped_parts ); >+} >+ > my $reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } ); > > $template->param( >diff --git a/reserve/hold-group.pl b/reserve/hold-group.pl >index 49d33e4..b24c417 100755 >--- a/reserve/hold-group.pl >+++ b/reserve/hold-group.pl >@@ -21,6 +21,8 @@ use CGI qw( -utf8 ); > use C4::Auth; > use C4::Output; > use C4::Reserves; >+use C4::Items; >+use Data::Dumper; > > my $cgi = new CGI; > my ($template, $loggedinuser, $cookie) = get_template_and_user({ >diff --git a/reserve/request.pl b/reserve/request.pl >index 4cf6c07..15c7725 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -42,6 +42,7 @@ use Koha::DateUtils; > use C4::Utils::DataTables::Members; > use C4::Members; > use C4::Search; # enabled_staff_search_views >+use Data::Dumper; > > use Koha::Biblios; > use Koha::DateUtils; >@@ -115,6 +116,9 @@ if ( $action eq 'move' ) { > my $reserve_id = $input->param('reserve_id'); > my $suspend_until = $input->param('suspend_until'); > ToggleSuspend( $reserve_id, $suspend_until ); >+} elsif ( $action eq 'cancel_group_hold' ) { >+ >+ > } > > if ($findborrower) { >@@ -568,6 +572,7 @@ foreach my $biblionumber (@biblionumbers) { > } @reserves > ) > { >+ > my $priority = $res->priority(); > my %reserve; > my @optionloop; >@@ -580,7 +585,6 @@ foreach my $biblionumber (@biblionumbers) { > } > ); > } >- > if ( $res->is_found() ) { > $reserve{'holdingbranch'} = $res->item()->holdingbranch(); > $reserve{'biblionumber'} = $res->item()->biblionumber(); >@@ -631,10 +635,43 @@ foreach my $biblionumber (@biblionumbers) { > $reserve{itemtype} = $res->itemtype(); > $reserve{branchcode} = $res->branchcode(); > $reserve{'hold_group_id'} = $res->hold_group_id; >- > push( @reserveloop, \%reserve ); > } > >+ my %reserve_records; >+ my $count = 0; >+ foreach my $reserve ( @reserves ) { >+ warn $reserve->reserve_id; >+ if ($reserve->hold_group_id) { >+ # Keep track of which hold_group_id (duplicated field) go with each reserve_id (unique field) >+ $reserve_records{ $reserve->hold_group_id }->{ $reserve->reserve_id }++; >+ warn $reserve->reserve_id; >+ @reserveloop = grep { $_->{reserve_id} != $reserve->reserve_id } @reserveloop; >+ }else { >+ warn $reserve->reserve_id; >+ warn $reserve->hold_group_id; >+ } >+ } >+ my @grouped_parts; >+ for my $hold_group ( sort { $a <=> $b } keys %reserve_records ) { >+ my @reserveids = sort { $a <=> $b } keys %{ $reserve_records{ $hold_group } }; >+ >+ my @holds = GetHoldGroupHolds($hold_group); >+ my $hold = $holds[0]; >+ my $patron = Koha::Patrons->find( {borrowernumber => $hold->{borrowernumber}} ); >+ >+ # Merge the itemnumbers with each hold_group_id >+ push @grouped_parts, { >+ hold_group_id => $hold_group, >+ reserve_id => join(', ', sort { $a <=> $b } @reserveids), >+ hold => $hold, >+ patron => $patron, >+ }; >+ } >+ if (@grouped_parts) { >+ $template->param( grouped_holds => \@grouped_parts ); >+ } >+ > # get the time for the form name... > my $time = time(); > >-- >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 21528
:
80317
|
80319
|
80376
|
80443
|
88042
|
88124