Bugzilla – Attachment 37271 Details for
Bug 13918
Add waiting expiration date to opac list of holds for user
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13918 - Add waiting expiration date to opac list of holds for user
Bug-13918---Add-waiting-expiration-date-to-opac-li.patch (text/plain), 13.80 KB, created by
Kyle M Hall (khall)
on 2015-03-26 13:52:57 UTC
(
hide
)
Description:
Bug 13918 - Add waiting expiration date to opac list of holds for user
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-03-26 13:52:57 UTC
Size:
13.80 KB
patch
obsolete
>From e12ebf5107ebc7318e69141d3927625372ac05f2 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 18 Mar 2015 11:45:07 -0400 >Subject: [PATCH] Bug 13918 - Add waiting expiration date to opac list of holds for user > >Waiting holds for patrons in the opac should display the hold expiration >date based on the max pickup delay if it is set. > >Test Plan: >1) Ensure ReservesMaxPickUpDelay is set >2) Place a hold on a record >3) Check in the item, use it to fill the hold >4) Log into the opac as that user >5) View the holds list, note the 'until <date>' addition to the > waiting hold line. >--- > Koha/Biblio.pm | 13 +++++ > Koha/Hold.pm | 25 ++++++++++ > .../opac-tmpl/bootstrap/en/modules/opac-user.tt | 50 ++++++++++++-------- > opac/opac-user.pl | 18 +++++-- > 4 files changed, 80 insertions(+), 26 deletions(-) > >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index 9c467d7..2145a04 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -21,6 +21,8 @@ use Modern::Perl; > > use Carp; > >+use C4::Biblio qw( GetRecordValue GetMarcBiblio GetFrameworkCode ); >+ > use Koha::Database; > > use base qw(Koha::Object); >@@ -35,6 +37,17 @@ Koha::Biblio - Koha Biblio Object class > > =cut > >+=head3 subtitle >+ >+=cut >+ >+sub subtitle { >+ my ( $self ) = @_; >+ >+ return GetRecordValue( 'subtitle', GetMarcBiblio( $self->id() ), GetFrameworkCode( $self->id() ) ); >+} >+ >+ > =head3 type > > =cut >diff --git a/Koha/Hold.pm b/Koha/Hold.pm >index 253acce..30f269f 100644 >--- a/Koha/Hold.pm >+++ b/Koha/Hold.pm >@@ -91,6 +91,19 @@ sub is_waiting { > return $self->found() eq 'W'; > } > >+=head3 is_cancelable >+ >+Returns true if hold is a cancelable hold >+ >+=cut >+ >+sub is_cancelable { >+ my ($self) = @_; >+ >+ return ( $self->is_waiting() && !$self->is_found() ) >+ || ( !$self->is_waiting() && !$self->is_in_transit() ); >+} >+ > =head3 is_in_transit > > Returns true if hold is a in_transit hold >@@ -104,6 +117,18 @@ sub is_in_transit { > return $self->found() eq 'T'; > } > >+=head3 is_at_destination >+ >+Returns true if hold is a in_transit hold >+ >+=cut >+ >+sub is_at_destination { >+ my ($self) = @_; >+ >+ return $self->is_waiting() && ( $self->branchcode() eq $self->item()->holdingbranch() ); >+} >+ > =head3 biblio > > Returns the related Koha::Biblio object for this hold >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 f4cbddb..9496360 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >@@ -511,9 +511,9 @@ > </thead> > <tbody> > [% FOREACH RESERVE IN RESERVES %] >- [% IF ( RESERVE.wait ) %] >- [% IF ( RESERVE.atdestination ) %] >- [% IF ( RESERVE.found ) %] >+ [% IF ( RESERVE.is_waiting ) %] >+ [% IF ( RESERVE.is_at_destination ) %] >+ [% IF ( RESERVE.is_found ) %] > <tr class="reserved"> > [% ELSE %] > <tr> >@@ -525,8 +525,8 @@ > <tr> > [% END %] > <td class="title"> >- <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% RESERVE.biblionumber %]">[% RESERVE.reserves_title %] [% FOREACH subtitl IN RESERVE.subtitle %] [% subtitl.subfield %][% END %]</a> >- [% RESERVE.author %] >+ <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% RESERVE.biblionumber %]">[% RESERVE.biblio.title %] [% FOREACH subtitl IN RESERVE.biblio.subtitle %] [% subtitl.subfield %][% END %]</a> >+ [% RESERVE.biblio.author %] > </td> > <td class="reservedate"> > <span title="[% RESERVE.reservedate %]"> >@@ -535,19 +535,23 @@ > </span> > </td> > <td class="expirationdate"> >- [% IF ( RESERVE.expirationdate ) %] >- <span> >+ [% IF ! RESERVE.found %] >+ [% IF ( RESERVE.expirationdate ) %] >+ <span> >+ <span class="tdlabel">Expiration:</span> >+ [% RESERVE.expirationdate | $KohaDates %] >+ </span> >+ [% ELSE %] > <span class="tdlabel">Expiration:</span> >- [% RESERVE.expirationdate | $KohaDates %] >- </span> >+ Never expires >+ [% END %] > [% ELSE %] >- <span class="tdlabel">Expiration:</span> >- Never expires >+ - > [% END %] > </td> > <td class="branch"> > <span class="tdlabel">Pick up location:</span> >- [% RESERVE.branch %] >+ [% RESERVE.branch.branchname %] > </td> > [% IF ( showpriority ) %] > <td class="priority"> >@@ -557,11 +561,17 @@ > [% END %] > <td class="status"> > <span class="tdlabel">Status:</span> >- [% IF ( RESERVE.wait ) %] >- [% IF ( RESERVE.atdestination ) %] >+ [% IF ( RESERVE.is_waiting ) %] >+ [% IF ( RESERVE.is_at_destination ) %] > [% IF ( RESERVE.found ) %] >- Item waiting at <b> [% RESERVE.wbrname %]</b>[% IF ( RESERVE.waitingdate ) %] since [% RESERVE.waitingdate | $KohaDates %][% END %] >- <input type="hidden" name="pickup" value="[% RESERVE.wbrcd %]" /> >+ Item waiting at <b> [% RESERVE.branch.branchname %]</b> >+ [% IF ( RESERVE.waitingdate ) %] >+ since [% RESERVE.waitingdate | $KohaDates %] >+ [% IF RESERVE.waiting_expires_on %] >+ until [% RESERVE.waiting_expires_on | $KohaDates %] >+ [% END %] >+ [% END %] >+ <input type="hidden" name="pickup" value="[% RESERVE.branchcode %]" /> > [% ELSE %] > Item waiting to be pulled from <b> [% RESERVE.wbrname %]</b> > [% END %] >@@ -569,7 +579,7 @@ > Item in transit to <b> [% RESERVE.wbrname %]</b> <input type="hidden" name="pickup" value="[% RESERVE.wbrcd %]" /> > [% END %] > [% ELSE %] >- [% IF ( RESERVE.intransit ) %] >+ [% IF ( RESERVE.is_in_transit ) %] > Item in transit from <b> [% RESERVE.frombranch %]</b> since > [% RESERVE.datesent | $KohaDates %] > [% ELSIF ( RESERVE.suspend ) %] >@@ -581,7 +591,7 @@ > </td> > [% IF SuspendHoldsOpac %] > <td> >- [% IF ( RESERVE.cancelable ) %] >+ [% IF ( RESERVE.is_cancelable ) %] > [% IF RESERVE.suspend %] > <form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post"> > <input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" /> >@@ -622,11 +632,11 @@ > </form> > [% END # / IF AutoResumeSuspendedHolds %] > [% END # / IF RESERVE.suspend %] >- [% END # / IF ( RESERVE.cancelable )%] >+ [% END # / IF ( RESERVE.is_cancelable )%] > </td> > [% END # / IF SuspendHoldsOpac %] > <td class="modify"> >- [% IF ( RESERVE.cancelable ) %] >+ [% IF ( RESERVE.is_cancelable ) %] > <form action="/cgi-bin/koha/opac-modrequest.pl" method="post"> > <input type="hidden" name="biblionumber" value="[% RESERVE.biblionumber %]" /> > <input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" /> >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index 995db7b..a132842 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -36,6 +36,7 @@ use C4::Letters; > use C4::Branch; # GetBranches > use Koha::DateUtils; > use Koha::Borrower::Debarments qw(IsDebarred); >+use Koha::Holds; > > use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE'; > >@@ -277,14 +278,17 @@ for my $branch_hash ( sort keys %{$branches} ) { > $template->param( branchloop => \@branch_loop ); > > # now the reserved items.... >-my @reserves = GetReservesFromBorrowernumber( $borrowernumber ); >+my $reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } ); >+=head1 > foreach my $res (@reserves) { >+ my $hold = Koha::Holds->find( $res->{reserve_id} ); > > if ( $res->{'expirationdate'} eq '0000-00-00' ) { > $res->{'expirationdate'} = ''; > } > $res->{'subtitle'} = GetRecordValue('subtitle', GetMarcBiblio($res->{'biblionumber'}), GetFrameworkCode($res->{'biblionumber'})); > $res->{'waiting'} = 1 if $res->{'found'} eq 'W'; >+ $res->{'waiting_since'} = > $res->{'branch'} = $branches->{ $res->{'branchcode'} }->{'branchname'}; > my $biblioData = GetBiblioData($res->{'biblionumber'}); > $res->{'reserves_title'} = $biblioData->{'title'}; >@@ -295,15 +299,17 @@ foreach my $res (@reserves) { > } > $res->{'suspend_until'} = C4::Dates->new( $res->{'suspend_until'}, "iso")->output("syspref") if ( $res->{'suspend_until'} ); > } >+=cut > > # use Data::Dumper; > # warn Dumper(@reserves); > >-$template->param( RESERVES => \@reserves ); >-$template->param( reserves_count => $#reserves+1 ); >-$template->param( showpriority=>$show_priority ); >+$template->param( RESERVES => $reserves ); >+$template->param( reserves_count => $reserves->count() ); >+$template->param( showpriority => $show_priority ); > > my @waiting; >+=head1 > my $wcount = 0; > foreach my $res (@reserves) { > if ( $res->{'itemnumber'} ) { >@@ -345,8 +351,9 @@ foreach my $res (@reserves) { > $res->{'cancelable'} = 1 if ($res->{wait} and not $res->{found}) or (not $res->{wait} and not $res->{intransit}); > > } >+=cut > >-$template->param( WAITING => \@waiting ); >+$template->param( WAITING => $reserves->waiting() ); > > # current alert subscriptions > my $alerts = getalert($borrowernumber); >@@ -384,7 +391,6 @@ if ( $borr->{'opacnote'} ) { > > $template->param( > bor_messages_loop => GetMessages( $borrowernumber, 'B', 'NONE' ), >- waiting_count => $wcount, > patronupdate => $patronupdate, > OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"), > userview => 1, >-- >1.7.2.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 13918
:
37271
|
37272
|
40033
|
40035
|
41862
|
41863
|
41864
|
41865
|
41945
|
41946
|
41947
|
41948
|
42652
|
42653
|
42654
|
42655
|
42656
|
42745
|
42746
|
42747
|
42748
|
42749
|
42779
|
42780
|
42781
|
42782
|
42783
|
43429
|
43430
|
43431
|
43432
|
43433
|
43438
|
43502
|
43503
|
43504
|
43505
|
43506
|
43507
|
46130
|
46131
|
46132
|
46133
|
46134
|
46135