Bugzilla – Attachment 43066 Details for
Bug 13517
Show waiting date on reserve/request.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13517 - Show waiting date on reserve/request.pl
Bug-13517---Show-waiting-date-on-reserverequestpl.patch (text/plain), 11.98 KB, created by
Kyle M Hall (khall)
on 2015-10-02 14:24:39 UTC
(
hide
)
Description:
Bug 13517 - Show waiting date on reserve/request.pl
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-10-02 14:24:39 UTC
Size:
11.98 KB
patch
obsolete
>From b2e58c90ad281cc4ec8bd0db95af80432efb5613 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 18 Mar 2015 08:50:21 -0400 >Subject: [PATCH] Bug 13517 - Show waiting date on reserve/request.pl > >The holds table should show the waiting date for a hold in s similar >manner to the way it does on catalogue/detail.pl In addition, if the >ReservesMaxPickUpDelay syspref is set, we should display the date >when the waiting hold expires. > >Test Plan: >1) Apply this patch >2) Set ReservesMaxPickUpDelay to 7 >3) Find a waiting hold >4) Browse to reserve/request.pl for that record >5) Notice the "Item waiting" message now has "since <waitingdate>" >6) Notice the expiration field now has the date of <waitingdate> + 7 days > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> > >Signed-off-by: Cathi Wiggins <CWIGGINS@ci.arcadia.ca.us> > >Signed-off-by: Megan Wianecki <mwianecki@mplmain.mtpl.org> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > Koha/Hold.pm | 47 +++++++- > .../prog/en/modules/reserve/request.tt | 10 ++- > reserve/request.pl | 124 ++++++++++--------- > 3 files changed, 118 insertions(+), 63 deletions(-) > >diff --git a/Koha/Hold.pm b/Koha/Hold.pm >index ad84af3..975f699 100644 >--- a/Koha/Hold.pm >+++ b/Koha/Hold.pm >@@ -22,10 +22,12 @@ use Modern::Perl; > use Carp; > > use C4::Context qw(preference); >-use Koha::Branches; >+use Koha::DateUtils qw(dt_from_string); >+ >+use Koha::Borrowers; > use Koha::Biblios; >+use Koha::Branches; > use Koha::Items; >-use Koha::DateUtils qw(dt_from_string); > > use base qw(Koha::Object); > >@@ -63,6 +65,20 @@ sub waiting_expires_on { > return $dt; > } > >+=head3 is_found >+ >+Returns true if hold is a waiting or in transit >+ >+=cut >+ >+sub is_found { >+ my ($self) = @_; >+ >+ return 0 unless $self->found(); >+ return 1 if $self->found() eq 'W'; >+ return 1 if $self->found() eq 'T'; >+} >+ > =head3 is_waiting > > Returns true if hold is a waiting hold >@@ -76,6 +92,19 @@ sub is_waiting { > return $found && $found eq 'W'; > } > >+=head3 is_in_transit >+ >+Returns true if hold is a in_transit hold >+ >+=cut >+ >+sub is_in_transit { >+ my ($self) = @_; >+ >+ return 0 unless $self->found(); >+ return $self->found() eq 'T'; >+} >+ > =head3 biblio > > Returns the related Koha::Biblio object for this hold >@@ -118,6 +147,20 @@ sub branch { > return $self->{_branch}; > } > >+=head3 borrower >+ >+Returns the related Koha::Borrower object for this Hold >+ >+=cut >+ >+sub borrower { >+ my ($self) = @_; >+ >+ $self->{_borrower} ||= Koha::Borrowers->find( $self->borrowernumber() ); >+ >+ return $self->{_borrower}; >+} >+ > =head3 type > > =cut >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 fd05887..3e98d54 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -741,12 +741,18 @@ function checkMultiHold() { > </td> > <td>[% reserveloo.notes %]</td> > <td>[% reserveloo.date %]</td> >- <td>[% reserveloo.expirationdate %]</td> >+ <td> >+ [% IF reserveloo.waiting_until %] >+ [% reserveloo.waiting_until | $KohaDates %] >+ [% ELSE %] >+ [% reserveloo.expirationdate %] >+ [% END %] >+ </td> > <td> > [% IF ( reserveloo.wait ) %] > [% IF ( reserveloo.atdestination ) %] > [% IF ( reserveloo.found ) %] >- Item waiting at <b> [% reserveloo.wbrname %]</b> <input type="hidden" name="pickup" value="[% reserveloo.wbrcode %]" /> >+ Item waiting at <b> [% reserveloo.wbrname %]</b> <input type="hidden" name="pickup" value="[% reserveloo.wbrcode %]" /> since [% reserveloo.waiting_date | $KohaDates %] > [% ELSE %] > Waiting to be pulled <input type="hidden" name="pickup" value="[% reserveloo.wbrcode %]" /> > [% END %] >diff --git a/reserve/request.pl b/reserve/request.pl >index 4544ad2..483081a 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -45,6 +45,7 @@ use C4::Members; > use C4::Search; # enabled_staff_search_views > use Koha::DateUtils; > use Koha::Borrower::Debarments qw(IsDebarred); >+use Koha::Holds; > > my $dbh = C4::Context->dbh; > my $sth; >@@ -465,85 +466,90 @@ foreach my $biblionumber (@biblionumbers) { > > # existingreserves building > my @reserveloop; >- $reserves = GetReservesFromBiblionumber({ biblionumber => $biblionumber, all_dates => 1 }); >- foreach my $res ( sort { >- my $a_found = $a->{found} || ''; >- my $b_found = $a->{found} || ''; >+ my @reserves = Koha::Holds->search( { biblionumber => $biblionumber }, { order_by => 'priority' } ); >+ foreach my $res ( >+ sort { >+ my $a_found = $a->found() || ''; >+ my $b_found = $a->found() || ''; > $a_found cmp $b_found; >- } @$reserves ) { >+ } @reserves >+ ) >+ { > my %reserve; > my @optionloop; > for ( my $i = 1 ; $i <= $totalcount ; $i++ ) { > push( >- @optionloop, >- { >- num => $i, >- selected => ( $i == $res->{priority} ), >- } >- ); >+ @optionloop, >+ { >+ num => $i, >+ selected => ( $i == $res->priority() ), >+ } >+ ); > } > >- if ( defined $res->{'found'} && ($res->{'found'} eq 'W' || $res->{'found'} eq 'T' )) { >- my $item = $res->{'itemnumber'}; >- $item = GetBiblioFromItemNumber($item,undef); >- $reserve{'wait'}= 1; >- $reserve{'holdingbranch'}=$item->{'holdingbranch'}; >- $reserve{'biblionumber'}=$item->{'biblionumber'}; >- $reserve{'barcodenumber'} = $item->{'barcode'}; >- $reserve{'wbrcode'} = $res->{'branchcode'}; >- $reserve{'itemnumber'} = $res->{'itemnumber'}; >- $reserve{'wbrname'} = $branches->{$res->{'branchcode'}}->{'branchname'}; >- if($reserve{'holdingbranch'} eq $reserve{'wbrcode'}){ >+ if ( $res->is_found() ) { >+ $reserve{'wait'} = 1; >+ $reserve{'holdingbranch'} = $res->item()->holdingbranch(); >+ $reserve{'biblionumber'} = $res->item()->biblionumber(); >+ $reserve{'barcodenumber'} = $res->item()->barcode(); >+ $reserve{'wbrcode'} = $res->branchcode(); >+ $reserve{'itemnumber'} = $res->itemnumber(); >+ $reserve{'wbrname'} = $res->branch()->branchname(); >+ >+ if ( $reserve{'holdingbranch'} eq $reserve{'wbrcode'} ) { >+ > # Just because the holdingbranch matches the reserve branch doesn't mean the item > # has arrived at the destination, check for an open transfer for the item as well >- my ( $transfertwhen, $transfertfrom, $transferto ) = C4::Circulation::GetTransfers( $res->{itemnumber} ); >- if ( not $transferto or $transferto ne $res->{branchcode} ) { >+ my ( $transfertwhen, $transfertfrom, $transferto ) = >+ C4::Circulation::GetTransfers( $res->itemnumber() ); >+ if ( not $transferto or $transferto ne $res->branchcode() ) { > $reserve{'atdestination'} = 1; > } > } >+ > # set found to 1 if reserve is waiting for patron pickup >- $reserve{'found'} = 1 if $res->{'found'} eq 'W'; >- $reserve{'intransit'} = 1 if $res->{'found'} eq 'T'; >- } elsif ($res->{priority} > 0) { >- if (defined($res->{itemnumber})) { >- my $item = GetItem($res->{itemnumber}); >- $reserve{'itemnumber'} = $res->{'itemnumber'}; >- $reserve{'barcodenumber'} = $item->{'barcode'}; >+ $reserve{'found'} = $res->is_found(); >+ $reserve{'intransit'} = $res->is_in_transit(); >+ } >+ elsif ( $res->priority() > 0 ) { >+ if ( my $item = $res->item() ) { >+ $reserve{'itemnumber'} = $item->id(); >+ $reserve{'barcodenumber'} = $item->barcode(); > $reserve{'item_level_hold'} = 1; > } > } > > # get borrowers reserve info >- my $reserveborrowerinfo = GetMember( borrowernumber => $res->{'borrowernumber'} ); >- if (C4::Context->preference('HidePatronName')){ >- $reserve{'hidename'} = 1; >- $reserve{'cardnumber'} = $reserveborrowerinfo->{'cardnumber'}; >- } >- $reserve{'expirationdate'} = output_pref({ dt => dt_from_string( $res->{'expirationdate'} ), dateonly => 1 }) >- unless ( !defined($res->{'expirationdate'}) || $res->{'expirationdate'} eq '0000-00-00' ); >- $reserve{'date'} = output_pref({ dt => dt_from_string( $res->{'reservedate'} ), dateonly => 1 }); >- $reserve{'borrowernumber'} = $res->{'borrowernumber'}; >- $reserve{'biblionumber'} = $res->{'biblionumber'}; >- $reserve{'borrowernumber'} = $res->{'borrowernumber'}; >- $reserve{'firstname'} = $reserveborrowerinfo->{'firstname'}; >- $reserve{'surname'} = $reserveborrowerinfo->{'surname'}; >- $reserve{'notes'} = $res->{'reservenotes'}; >- $reserve{'wait'} = >- ( ( defined $res->{'found'} and $res->{'found'} eq 'W' ) or ( $res->{'priority'} eq '0' ) ); >- $reserve{'voldesc'} = $res->{'volumeddesc'}; >- $reserve{'ccode'} = $res->{'ccode'}; >- $reserve{'barcode'} = $res->{'barcode'}; >- $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'}; >+ if ( C4::Context->preference('HidePatronName') ) { >+ $reserve{'hidename'} = 1; >+ $reserve{'cardnumber'} = $res->borrower()->cardnumber(); >+ } >+ $reserve{'expirationdate'} = output_pref( { dt => dt_from_string( $res->expirationdate ), dateonly => 1 } ) >+ unless ( !defined( $res->expirationdate ) || $res->expirationdate eq '0000-00-00' ); >+ $reserve{'date'} = output_pref( { dt => dt_from_string( $res->reservedate ), dateonly => 1 } ); >+ $reserve{'borrowernumber'} = $res->borrowernumber(); >+ $reserve{'biblionumber'} = $res->biblionumber(); >+ $reserve{'borrowernumber'} = $res->borrowernumber(); >+ $reserve{'firstname'} = $res->borrower()->firstname(); >+ $reserve{'surname'} = $res->borrower()->surname(); >+ $reserve{'notes'} = $res->reservenotes(); >+ $reserve{'wait'} = $res->is_waiting(); >+ $reserve{'waiting_date'} = $res->waitingdate(); >+ $reserve{'waiting_until'} = $res->is_waiting() ? $res->waiting_expires_on() : undef; >+ $reserve{'ccode'} = $res->item() ? $res->item()->ccode() : undef; >+ $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(); > > if ( C4::Context->preference('IndependentBranches') && $flags->{'superlibrarian'} != 1 ) { >- $reserve{'branchloop'} = [ GetBranchDetail($res->{'branchcode'}) ]; >- } else { >- $reserve{'branchloop'} = GetBranchesLoop($res->{'branchcode'}); >+ $reserve{'branchloop'} = [ GetBranchDetail( $res->branchcode() ) ]; >+ } >+ else { >+ $reserve{'branchloop'} = GetBranchesLoop( $res->branchcode() ); > } > > push( @reserveloop, \%reserve ); >-- >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 13517
:
34958
|
34959
|
35454
|
35834
|
35861
|
35862
|
35863
|
36983
|
36986
|
40025
|
40032
|
40036
|
40676
|
40677
|
40892
|
40893
|
40898
|
40899
|
40900
|
42604
|
42605
|
42606
| 43066 |
43067
|
43068