Bugzilla – Attachment 40025 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.97 KB, created by
Kyle M Hall (khall)
on 2015-06-09 16:33:46 UTC
(
hide
)
Description:
Bug 13517 - Show waiting date on reserve/request.pl
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-06-09 16:33:46 UTC
Size:
11.97 KB
patch
obsolete
>From 1bb25981f80ffa999dd30bf313b5675de1f80f49 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 >--- > Koha/Hold.pm | 48 +++++++- > .../prog/en/modules/reserve/request.tt | 10 ++- > reserve/request.pl | 128 ++++++++++--------- > 3 files changed, 121 insertions(+), 65 deletions(-) > >diff --git a/Koha/Hold.pm b/Koha/Hold.pm >index b874f13..1b743e8 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); > >@@ -62,6 +64,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 >@@ -71,9 +87,23 @@ Returns true if hold is a waiting hold > sub is_waiting { > my ($self) = @_; > >+ return 0 unless $self->found(); > return $self->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 >@@ -116,6 +146,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 80be359..5077637 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -732,12 +732,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 62f82a8..c754814 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -44,6 +44,7 @@ use C4::Utils::DataTables::Members; > use C4::Members; > use C4::Search; # enabled_staff_search_views > use Koha::DateUtils; >+use Koha::Holds; > > my $dbh = C4::Context->dbh; > my $sth; >@@ -461,87 +462,92 @@ 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'} = format_date( $res->{'expirationdate'} ) >- unless ( !defined($res->{'expirationdate'}) || $res->{'expirationdate'} eq '0000-00-00' ); >- $reserve{'date'} = format_date( $res->{'reservedate'} ); >- $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{'constrainttypea'} = ( $res->{'constrainttype'} eq 'a' ); >- $reserve{'constrainttypeo'} = ( $res->{'constrainttype'} eq 'o' ); >- $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'} = format_date( $res-expirationdate() ) >+ unless ( !defined( $res->expirationdate() ) || $res->expirationdate() eq '0000-00-00' ); >+ $reserve{'date'} = format_date( $res->reservedate() ); >+ $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{'constrainttypea'} = ( $res->constrainttype() eq 'a' ); >+ $reserve{'constrainttypeo'} = ( $res->constrainttype() eq 'o' ); >+ $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