Bugzilla – Attachment 31585 Details for
Bug 12353
Reserves last pickup date needs to respect holidays, and everybody need to know the last pickup date for reserves, even notices.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12353 - Displaying the last pickup date in OPAC and staff client and waitingholds.pl
0004-Bug-12353-Displaying-the-last-pickup-date-in-OPAC-an.patch (text/plain), 11.47 KB, created by
Olli-Antti Kivilahti
on 2014-09-14 10:37:16 UTC
(
hide
)
Description:
Bug 12353 - Displaying the last pickup date in OPAC and staff client and waitingholds.pl
Filename:
MIME Type:
Creator:
Olli-Antti Kivilahti
Created:
2014-09-14 10:37:16 UTC
Size:
11.47 KB
patch
obsolete
>From 11a0146df2408195dcdf0f2e012359e705c18638 Mon Sep 17 00:00:00 2001 >From: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> >Date: Sun, 14 Sep 2014 12:28:15 +0300 >Subject: [PATCH 4/6] Bug 12353 - Displaying the last pickup date in OPAC and > staff client and waitingholds.pl >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >TEST PLAN: > >1. Create a reservation for a Borrower with pickup branch >2. Check-in the corresponding Item in the pickup branch and confirm the hold > for the Borrower >3. Go to circ/circulation.pl for the Borrower and verify that the reservation > is "Waiting for pickup" >4. In the > Home ⺠Circulation ⺠Checkouts -tab (circ/circulation.pl) > and in the > Home ⺠Patrons ⺠Patron details -tab > and in the > OPAC your summary > and in the > circ/waitingreserves.pl > When looking at reserves, you will find a last pickup date -column added > which has a value if the reservation is waiting for pickup. >--- > circ/waitingreserves.pl | 19 +++++++------------ > koha-tmpl/intranet-tmpl/prog/en/js/holds.js | 1 + > .../prog/en/modules/circ/circulation.tt | 1 + > .../prog/en/modules/circ/waitingreserves.tt | 4 ++++ > .../prog/en/modules/members/moremember.tt | 1 + > .../opac-tmpl/bootstrap/en/modules/opac-user.tt | 7 +++++++ > opac/opac-user.pl | 4 ++++ > svc/holds | 18 +++++++++++++++--- > 8 files changed, 40 insertions(+), 15 deletions(-) > >diff --git a/circ/waitingreserves.pl b/circ/waitingreserves.pl >index fb7a3d1..f4a93f0 100755 >--- a/circ/waitingreserves.pl >+++ b/circ/waitingreserves.pl >@@ -31,11 +31,8 @@ use C4::Members; > use C4::Biblio; > use C4::Items; > >-use Date::Calc qw( >- Today >- Add_Delta_Days >- Date_to_Days >-); >+use DateTime; >+ > use C4::Reserves; > use C4::Koha; > >@@ -86,7 +83,7 @@ my ($reservcount, $overcount); > my @getreserves = $all_branches ? GetReservesForBranch() : GetReservesForBranch($default); > # get reserves for the branch we are logged into, or for all branches > >-my $today = Date_to_Days(&Today); >+my $today = DateTime->now(); > foreach my $num (@getreserves) { > next unless ($num->{'waitingdate'} && $num->{'waitingdate'} ne '0000-00-00'); > >@@ -106,13 +103,11 @@ foreach my $num (@getreserves) { > my $getborrower = GetMember(borrowernumber => $num->{'borrowernumber'}); > my $itemtypeinfo = getitemtypeinfo( $gettitle->{'itemtype'} ); # using the fixed up itype/itemtype > $getreserv{'waitingdate'} = $num->{'waitingdate'}; >- my ( $waiting_year, $waiting_month, $waiting_day ) = split (/-/, $num->{'waitingdate'}); >- ( $waiting_year, $waiting_month, $waiting_day ) = >- Add_Delta_Days( $waiting_year, $waiting_month, $waiting_day, >- C4::Context->preference('ReservesMaxPickUpDelay')); >- my $calcDate = Date_to_Days( $waiting_year, $waiting_month, $waiting_day ); >+ >+ my $lastpickupdate = C4::Reserves::_reserve_last_pickup_date( $num ); > > $getreserv{'itemtype'} = $itemtypeinfo->{'description'}; >+ $getreserv{'lastpickupdate'} = C4::Dates->new($lastpickupdate->ymd(), 'iso')->output(); > $getreserv{'title'} = $gettitle->{'title'}; > $getreserv{'biblionumber'} = $gettitle->{'biblionumber'}; > $getreserv{'barcode'} = $gettitle->{'barcode'}; >@@ -132,7 +127,7 @@ foreach my $num (@getreserves) { > $getreserv{'borrowermail'} = $getborrower->{'emailaddress'}; > } > >- if ($today > $calcDate) { >+ if ( DateTime->compare( $today,$lastpickupdate ) == 1 ) { #If today is bigger than lastpickupdate, pickup time has expired > if ($cancelall) { > my $res = cancel( $itemnumber, $borrowernum, $holdingbranch, $homebranch, !$transfer_when_cancel_all ); > push @cancel_result, $res if $res; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/holds.js b/koha-tmpl/intranet-tmpl/prog/en/js/holds.js >index 73807ea..c78e3ae 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/holds.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/holds.js >@@ -10,6 +10,7 @@ $(document).ready(function() { > { > "mDataProp": "reservedate_formatted" > }, >+ { "mDataProp": "lastpickupdate_formatted" }, > { > "mDataProp": function ( oObj ) { > title = "<a href='/cgi-bin/koha/reserve/request.pl?biblionumber=" >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index 597ef0d..d000ceb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -771,6 +771,7 @@ No patron matched <span class="ex">[% message %]</span> > <thead> > <tr> > <th>Hold date</th> >+ <th>Last pickup date</th> > <th>Title</th> > <th>Call number</th> > <th>Barcode</th> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt >index 7ba913a..ed6a94f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt >@@ -78,6 +78,7 @@ > <table id="holdst"> > <thead><tr> > <th class="title-string">Available since</th> >+ <th>Last pickup date</th> > <th class="anti-the">Title</th> > <th>Patron</th> > <th>Location</th> >@@ -88,6 +89,7 @@ > <tbody>[% FOREACH reserveloo IN reserveloop %] > <tr> > <td><span title="[% reserveloo.waitingdate %]">[% reserveloo.waitingdate | $KohaDates %]</span></td> >+ <td>[% reserveloo.lastpickupdate %]</td> > <td>[% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %] > [% reserveloo.title |html %] [% reserveloo.subtitle |html %] > </a> >@@ -138,6 +140,7 @@ > <table id="holdso"> > <thead><tr> > <th class="title-string">Available since</th> >+ <th>Last pickup date</th> > <th class="anti-the">Title</th> > <th>Patron</th> > <th>Location</th> >@@ -148,6 +151,7 @@ > <tbody>[% FOREACH overloo IN overloop %] > <tr> > <td><p><span title="[% overloo.waitingdate %]">[% overloo.waitingdate | $KohaDates %]</span></p></td> >+ <td>[% overloo.lastpickupdate | $KohaDates %]</td> > <td>[% INCLUDE 'biblio-default-view.inc' biblionumber = overloo.biblionumber %][% overloo.title |html %] [% overloo.subtitle |html %] > </a> > [% UNLESS ( item_level_itypes ) %][% IF ( overloo.itemtype ) %] (<b>[% overloo.itemtype %]</b>)[% END %][% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index d6b95f8..6a0cde0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -506,6 +506,7 @@ function validate1(date) { > <thead> > <tr> > <th>Hold date</th> >+ <th>Last pickup date</th> > <th>Title</th> > <th>Call number</th> > <th>Barcode</th> >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 ec3de30..485cefb 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >@@ -493,6 +493,7 @@ > <tr> > <th class="anti-the">Title</th> > <th class="psort">Placed on</th> >+ <th class="psort">Last pickup date</th> > <th>Expires on</th> > <th>Pick up location</th> > [% IF ( showpriority ) %] >@@ -530,6 +531,12 @@ > [% RESERVE.reservedate | $KohaDates %] > </span> > </td> >+ <td class="lastpickupdate"> >+ <span title="[% RESERVE.lastpickupdate %]"> >+ <span class="tdlabel">Last pickup date:</span> >+ [% RESERVE.lastpickupdate | $KohaDates %] >+ </span> >+ </td> > <td class="expirationdate"> > [% IF ( RESERVE.expirationdate ) %] > <span> >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index 667ac3d..9bf9d4e 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -321,6 +321,10 @@ foreach my $res (@reserves) { > } > # set found to 1 if reserve is waiting for patron pickup > $res->{'found'} = 1 if $res->{'found'} eq 'W'; >+ >+ my $lastpickupdate = C4::Reserves::_reserve_last_pickup_date( $res ); >+ $res->{'lastpickupdate'} = $lastpickupdate if $lastpickupdate; >+ > } else { > my ($transfertwhen, $transfertfrom, $transfertto) = GetTransfers( $res->{'itemnumber'} ); > if ($transfertwhen) { >diff --git a/svc/holds b/svc/holds >index 3ff704f..a3c4a03 100755 >--- a/svc/holds >+++ b/svc/holds >@@ -31,6 +31,7 @@ use C4::Context; > > use Koha::Database; > use Koha::DateUtils; >+use Koha::Reserves; > > my $input = new CGI; > >@@ -53,8 +54,8 @@ my $borrowernumber = $input->param('borrowernumber'); > my $offset = $input->param('iDisplayStart'); > my $results_per_page = $input->param('iDisplayLength'); > my $sorting_direction = $input->param('sSortDir_0') || 'desc'; >-my $sorting_column = $sort_columns[ $input->param('iSortCol_0') ] >- || 'reservedate'; >+my $sorting_column = ( $input->param('iSortCol_0') ) ? >+ $sort_columns[ $input->param('iSortCol_0') ] : 'reservedate'; > > binmode STDOUT, ":encoding(UTF-8)"; > print $input->header( -type => 'text/plain', -charset => 'UTF-8' ); >@@ -106,7 +107,18 @@ while ( my $h = $holds_rs->next() ) { > ) > : q{}, > }; >- >+ >+ #Calculate the last pickup date for reservations that are waiting for pickup. >+ if ($hold->{waiting}) { >+ my $lastpickupdate = Koha::Reserves::GetLastpickupdate( $h ); >+ $hold->{lastpickupdate} = $lastpickupdate->ymd(); >+ $hold->{lastpickupdate_formatted} = C4::Dates->new($lastpickupdate->ymd(), 'iso')->output(); >+ } >+ else {#These values need to be initialized anyway for DataTables to not complain. >+ $hold->{lastpickupdate} = ''; >+ $hold->{lastpickupdate_formatted} = ''; >+ } >+ > $hold->{transfered} = 0; > $hold->{not_transfered} = 0; > >-- >1.7.9.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 12353
:
31556
|
31572
|
31584
| 31585 |
31586