Bugzilla – Attachment 88042 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: UNFINISHED PATCH
Bug-21528-UNFINISHED-PATCH.patch (text/plain), 17.12 KB, created by
Aleisha Amohia
on 2019-04-16 05:10:06 UTC
(
hide
)
Description:
Bug 21528: UNFINISHED PATCH
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2019-04-16 05:10:06 UTC
Size:
17.12 KB
patch
obsolete
>From 277bbb13708319f31aa8c4339fb9d9bdeebd9a3f Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Tue, 16 Apr 2019 05:14:32 +0000 >Subject: [PATCH] Bug 21528: UNFINISHED PATCH > >--- > Koha/Hold.pm | 14 ++++++ > .../intranet-tmpl/prog/en/includes/holds_table.inc | 17 ++++--- > koha-tmpl/intranet-tmpl/prog/js/holds.js | 57 ++++++++++++++++------ > .../bootstrap/en/includes/holds-table.inc | 13 ++++- > .../opac-tmpl/bootstrap/en/modules/opac-user.tt | 9 +++- > opac/opac-user.pl | 20 +++++++- > reserve/request.pl | 53 ++++++++++++++------ > svc/holds | 29 +++++++++-- > 8 files changed, 164 insertions(+), 48 deletions(-) > >diff --git a/Koha/Hold.pm b/Koha/Hold.pm >index bfd3434..cf28cbd 100644 >--- a/Koha/Hold.pm >+++ b/Koha/Hold.pm >@@ -386,6 +386,20 @@ sub cancel { > return $self; > } > >+=head3 hold_group >+ >+Returns the Koha::Hold objects with this hold_group_id >+ >+=cut >+ >+sub hold_group { >+ my ($self) = @_; >+ >+ $self->{_hold_group} ||= Koha::Holds->search({ hold_group_id => $self->hold_group_id }); >+ >+ return $self->{_hold_group}; >+} >+ > =head3 _move_to_old > > my $is_moved = $hold->_move_to_old; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >index 7426da2..b776d4a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >@@ -38,9 +38,7 @@ > [% ELSE %] > <option value="W" selected="selected">Waiting</option> > [% END %] >- [% END %] >- >- [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %] >+ [% ELSIF ( CAN_user_reserveforothers_modify_holds_priority ) %] > [% IF Koha.Preference('HoldsSplitQueueNumbering') == 'actual' %] > [% FOREACH optionloo IN hold.optionloop %] > [% IF ( optionloo.selected ) %] >@@ -136,7 +134,15 @@ > [% END %] > </a> > [% ELSE %] >- [% IF ( hold.item_level_hold ) %] >+ [% IF ( hold.hold_group ) %] >+ <i><a id="group_hold_link_[% hold.hold_group_id %]" title="[% hold.hold_group_id %]" class="group_hold_link">Group hold</a></i> >+ <div id="group_hold_[% hold.hold_group_id %]" title="[% hold.hold_group_id %]" class="group_hold"> >+ Containing the following items: >+ [% FOREACH h in hold.hold_group %] >+ <br><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% h.biblionumber %]">[% h.item.barcode %]</a> >+ [% END %] >+ </div> >+ [% ELSIF ( hold.item_level_hold ) %] > <i> > Only item > <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% hold.biblionumber | uri %]&itemnumber=[% hold.itemnumber | uri %]#item[% hold.itemnumber | uri %]"> >@@ -158,9 +164,6 @@ > <input type="hidden" name="itemnumber" value="" /> > [% END %] > [% END %] >- [% IF hold.hold_group_id %] >- <div>(part of a <a href="/cgi-bin/koha/reserve/hold-group.pl?hold_group_id=[% hold.hold_group_id | uri %]" class="hold-group">hold group</a>)</div> >- [% END %] > </td> > > [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/holds.js b/koha-tmpl/intranet-tmpl/prog/js/holds.js >index 2f4924b..67c244c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/holds.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/holds.js >@@ -42,12 +42,6 @@ $(document).ready(function() { > title += " - <span class='" + span_class + "'>" + oObj.itemnotes.escapeHtml() + "</span>" > } > >- if (oObj.hold_group_id) { >- title += '<br>'; >- var link = '<a class="hold-group" href="/cgi-bin/koha/reserve/hold-group.pl?hold_group_id=' + oObj.hold_group_id + '">' + PART_OF_A_HOLD_GROUP +'</a>' >- title += '<span>(' + link + ')</span>'; >- } >- > return title; > } > }, >@@ -59,16 +53,40 @@ $(document).ready(function() { > { > "mDataProp": function( oObj ) { > var data = ""; >- if ( oObj.barcode ) { >- data += " <a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber=" >- + oObj.biblionumber >- + "&itemnumber=" >- + oObj.itemnumber >- + "#" >- + oObj.itemnumber >- + "'>" >- + oObj.barcode.escapeHtml() >- + "</a>"; >+ if ( oObj.hold_group_id ) { >+ data+= "<i><a id='group_hold_link_" >+ + oObj.hold_group_id >+ + "' title='" >+ + oObj.hold_group_id >+ + "' class='group_hold_link'>Group hold</a></i>" >+ + "<div id='group_hold_" >+ + oObj.hold_group_id >+ + "' title='" >+ + oObj.hold_group_id >+ + "' class='group_hold'>" >+ + "Containing the following items:"; >+ oObj.hold_group.forEach( function( hold ) { >+ if ( oObj.barcode ) { >+ data+= "<br><a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber=" >+ + oObj.biblionumber >+ + "'>" >+ + oObj.barcode.escapeHtml() >+ + "</a>"; >+ } >+ }); >+ data += "</div>"; >+ } else { >+ if ( oObj.barcode ) { >+ data += " <a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber=" >+ + oObj.biblionumber >+ + "&itemnumber=" >+ + oObj.itemnumber >+ + "#" >+ + oObj.itemnumber >+ + "'>" >+ + oObj.barcode.escapeHtml() >+ + "</a>"; >+ } > } > return data; > } >@@ -229,6 +247,13 @@ $(document).ready(function() { > }); > }); > >+ $(".group_hold").hide(); >+ >+ $(".group_hold_link").click(function(e){ >+ var group_hold_id = $(this).attr("title"); >+ $("#group_hold_"+group_hold_id).toggle(); >+ }); >+ > }); > > if ( $("#holds-table").length ) { >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 9673d5b..f5fe4c8 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc >@@ -2,10 +2,10 @@ > [% USE ItemTypes %] > [% USE KohaDates %] > >-[% IF ( HOLDS.count ) %] >+[% IF ( HOLDS.size ) %] > <div id="opac-user-holds"> > <table id="holdst" class="table table-bordered table-striped"> >- <caption>Holds <span class="count">([% HOLDS.count | html %] total)</span></caption> >+ <caption>Holds <span class="count">([% HOLDS.size | html %] total)</span></caption> > <!-- HOLDS TABLE ROWS --> > <thead> > <tr> >@@ -65,6 +65,15 @@ > </strong> > [% END %] > [% HOLD.biblio.author | html %] >+ [% IF HOLD.hold_group_id %] >+ <br><i><a id="group_hold_link_[% HOLD.hold_group_id %]" title="[% HOLD.hold_group_id %]" class="group_hold_link">Group hold</a></i> >+ <div id="group_hold_[% HOLD.hold_group_id %]" title="[% HOLD.hold_group_id %]" class="group_hold"> >+ Containing the following items: >+ [% FOREACH h in HOLD.hold_group %] >+ <br><a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% h.biblionumber %]">[% h.item.barcode %]</a> >+ [% END %] >+ </div> >+ [% END %] > </td> > <td class="reservedate"> > <span title="[% HOLD.reservedate | html %]"> >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 6f074a8..4cf5fde 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >@@ -162,7 +162,7 @@ > </li> > [% END %] > >- [% IF ( RESERVES.count ) %]<li><a href="#opac-user-holds">Holds ([% RESERVES.count | html %])</a></li>[% END %] >+ [% IF ( RESERVES.size ) %]<li><a href="#opac-user-holds">Holds ([% RESERVES.size | html %])</a></li>[% END %] > [% IF Koha.Preference('ArticleRequests') && logged_in_user.article_requests_current %]<li><a href="#opac-user-article-requests">Article requests ([% logged_in_user.article_requests_current.count | html %])</a></li>[% END %] > [% IF ( OverDriveCirculation ) %] > <li><a href="#opac-user-overdrive">OverDrive Account</a></li> >@@ -922,6 +922,13 @@ > <script> > var OD_password_required = [% IF Koha.Preference('OverDrivePasswordRequired') %]1[% ELSE %]0[% END %]; > $(document).ready(function() { >+ $(".group_hold").hide(); >+ >+ $(".group_hold_link").click(function(e){ >+ var group_hold_id = $(this).attr("title"); >+ $("#group_hold_"+group_hold_id).toggle(); >+ }); >+ > [% IF ( overdrive_error ) %] > KOHA.OverDriveCirculation.display_error("#opac-user-overdrive", "[% overdrive_error.dquote | html %]"); > [% END %] >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index 1fde24b..0821dd5 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -301,10 +301,26 @@ if ($show_barcode) { > $template->param( show_barcode => 1 ) if $show_barcode; > > # now the reserved items.... >-my $reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } ); >+my @all_reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } ); >+ >+my @hold_group_ids = (); >+my @reserves = (); >+while ( my $hold = shift @all_reserves ){ >+ warn($hold->hold_group_id); >+ if ( defined $hold->hold_group_id ){ >+ if ( grep(/$hold->hold_group_id/, @hold_group_ids) ){ >+ # don't add to filtered loop >+ } else { >+ push @hold_group_ids, $hold->hold_group_id; >+ push @reserves, $hold; >+ } >+ } else { >+ push @reserves, $hold; >+ } >+} > > $template->param( >- RESERVES => $reserves, >+ RESERVES => \@reserves, > showpriority => $show_priority, > ); > >diff --git a/reserve/request.pl b/reserve/request.pl >index e55c9d5..2d1b1bd 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -539,18 +539,8 @@ foreach my $biblionumber (@biblionumbers) { > } @reserves > ) > { >- my $priority = $res->priority(); >+ > my %reserve; >- my @optionloop; >- for ( my $i = 1 ; $i <= $totalcount ; $i++ ) { >- push( >- @optionloop, >- { >- num => $i, >- selected => ( $i == $priority ), >- } >- ); >- } > > if ( $res->is_found() ) { > $reserve{'holdingbranch'} = $res->item()->holdingbranch(); >@@ -595,18 +585,51 @@ foreach my $biblionumber (@biblionumbers) { > $reserve{'barcode'} = $res->item() ? $res->item()->barcode() : undef; > $reserve{'priority'} = $res->priority(); > $reserve{'lowestPriority'} = $res->lowestPriority(); >- $reserve{'optionloop'} = \@optionloop; > $reserve{'suspend'} = $res->suspend(); > $reserve{'suspend_until'} = $res->suspend_until(); > $reserve{'reserve_id'} = $res->reserve_id(); > $reserve{itemtype} = $res->itemtype(); > $reserve{branchcode} = $res->branchcode(); > $reserve{object} = $res; >+ $reserve{'hold_group'} = $res->hold_group_id ? Koha::Holds->search({ hold_group_id => $res->hold_group_id }) : undef; > $reserve{'hold_group_id'} = $res->hold_group_id; > > push( @reserveloop, \%reserve ); > } > >+ my @hold_group_ids = (); >+ my @filtered_reserveloop = (); >+ while ( my $hold = shift @reserveloop ){ >+ if ( defined $hold->{hold_group_id} ){ >+ if ( grep(/$hold->{hold_group_id}/, @hold_group_ids) ){ >+ # don't add to filtered loop >+ } else { >+ push @hold_group_ids, $hold->{hold_group_id}; >+ push @filtered_reserveloop, $hold; >+ } >+ } else { >+ push @filtered_reserveloop, $hold; >+ } >+ } >+ >+ my $row_count = scalar @filtered_reserveloop; >+ >+ my $row_num = 0; >+ foreach my $hold (@filtered_reserveloop){ >+ $row_num++; >+ my @optionloop; >+ for ( my $i = 1 ; $i <= $row_count ; $i++ ) { >+ push( >+ @optionloop, >+ { >+ num => $i, >+ selected => ( $i == $row_num ), >+ } >+ ); >+ } >+ $hold->{optionloop} = \@optionloop; >+ } >+ > # get the time for the form name... > my $time = time(); > >@@ -633,10 +656,10 @@ foreach my $biblionumber (@biblionumbers) { > $biblioloopiter{biblionumber} = $biblionumber; > $biblioloopiter{title} = $biblio->title; > $biblioloopiter{rank} = $fixedRank; >- $biblioloopiter{reserveloop} = \@reserveloop; >+ $biblioloopiter{reserveloop} = \@filtered_reserveloop; > >- if (@reserveloop) { >- $template->param( reserveloop => \@reserveloop ); >+ if (@filtered_reserveloop) { >+ $template->param( reserveloop => \@filtered_reserveloop ); > } > > push @biblioloop, \%biblioloopiter; >diff --git a/svc/holds b/svc/holds >index 4006583..af61e4b 100755 >--- a/svc/holds >+++ b/svc/holds >@@ -100,9 +100,9 @@ while ( my $h = $holds_rs->next() ) { > waiting => $h->is_waiting(), > waiting_at => $h->branch()->branchname(), > waiting_here => $h->branch()->branchcode() eq $branch, >- priority => $h->priority(), > itemtype_limit => $itemtype_limit, >- hold_group_id => $h->hold_group_id, >+ hold_group => Koha::Holds->search({ hold_group_id => $h->hold_group_id })->unblessed, >+ hold_group_id => $h->hold_group_id, > subtitle => GetRecordValue( > 'subtitle', > GetMarcBiblio({ biblionumber => $biblionumber }), >@@ -150,10 +150,29 @@ while ( my $h = $holds_rs->next() ) { > push( @holds, $hold ); > } > >+my @hold_group_ids = (); >+my @filtered_holds = (); >+my $row_counter = 1; >+while ( my $h = shift @holds ){ >+ if ( defined $h->{hold_group_id} ){ >+ if ( grep(/$h->{hold_group_id}/, @hold_group_ids) ){ >+ # don't add to filtered loop >+ } else { >+ push @hold_group_ids, $h->{hold_group_id}; >+ $h->{priority} = $row_counter; >+ push @filtered_holds, $h; >+ } >+ } else { >+ $h->{priority} = $row_counter; >+ push @filtered_holds, $h; >+ } >+ $row_counter++; >+} >+ > my $data; >-$data->{'iTotalRecords'} = scalar @holds; >-$data->{'iTotalDisplayRecords'} = scalar @holds; >+$data->{'iTotalRecords'} = scalar @filtered_holds; >+$data->{'iTotalDisplayRecords'} = scalar @filtered_holds; > $data->{'sEcho'} = $input->param('sEcho') || undef; >-$data->{'aaData'} = \@holds; >+$data->{'aaData'} = \@filtered_holds; > > print to_json($data); >-- >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