Bugzilla – Attachment 21193 Details for
Bug 9761
Make it possible to confirm future hold requests at checkin time
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9761: Make it possible to confirm future hold requests at checkin time
Bug-9761-Make-it-possible-to-confirm-future-hold-r.patch (text/plain), 11.42 KB, created by
Marcel de Rooy
on 2013-09-18 12:12:43 UTC
(
hide
)
Description:
Bug 9761: Make it possible to confirm future hold requests at checkin time
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2013-09-18 12:12:43 UTC
Size:
11.42 KB
patch
obsolete
>From be87d3938df3a73c374fb0ac0bcaeab7c31a56bd Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 4 Mar 2013 14:47:57 +0100 >Subject: [PATCH] Bug 9761: Make it possible to confirm future hold requests > at checkin time >Content-Type: text/plain; charset=utf-8 > >Description: >A new pref ConfirmFutureHolds is added. When confirming a hold at checkin time, >the number of days in this pref is taken into account when looking for reserves. >Note that this pref does not interfere with renewing, issuing or transferring >a book. For report Holds to pull, the default end date is calculated with this >new preference. >The use of ConfirmFutureHolds is useful only when future holds are allowed. > >Test plan: >1) Enable future holds. Add a number of days into ConfirmFutureHolds. >2) Place a future hold within this number of days. >3) Run holds to pull report. Check default startdate and enddate. >4) Check this book in. Can you confirm the hold? Do not confirm. >5) Issue the book to another patron. You should not see a warning. >6) Renew the book for this patron via opac or staff. No warning either. >7) Check in again. Warning pops up again. >8) Transfer book. Switch branch. Check in. Hold found pops up. Do not confirm. >9) Back to first branch. Check in (with popup). Remove the hold. Add new future >hold past the number of days. Check in (no warn). > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> >--- > C4/Circulation.pm | 3 +- > C4/Reserves.pm | 23 ++++++++++-------- > circ/pendingreserves.pl | 25 +++++++++++-------- > .../en/modules/admin/preferences/circulation.pref | 7 ++++- > .../prog/en/modules/circ/pendingreserves.tt | 2 +- > 5 files changed, 36 insertions(+), 24 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index b775b4f..01e6910 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1884,7 +1884,8 @@ sub AddReturn { > # find reserves..... > # if we don't have a reserve with the status W, we launch the Checkreserves routine > my ($resfound, $resrec); >- ($resfound, $resrec, undef) = C4::Reserves::CheckReserves( $item->{'itemnumber'} ) unless ( $item->{'withdrawn'} ); >+ my $lookahead= C4::Context->preference('ConfirmFutureHolds'); #number of days to look for future holds >+ ($resfound, $resrec, undef) = C4::Reserves::CheckReserves( $item->{'itemnumber'}, undef, $lookahead ) unless ( $item->{'withdrawn'} ); > if ($resfound) { > $resrec->{'ResFound'} = $resfound; > $messages->{'ResFound'} = $resrec; >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 5514796..78e9a5b 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -812,10 +812,12 @@ sub GetReserveStatus { > > ($status, $reserve, $all_reserves) = &CheckReserves($itemnumber); > ($status, $reserve, $all_reserves) = &CheckReserves(undef, $barcode); >+ ($status, $reserve, $all_reserves) = &CheckReserves($itemnumber,undef,$lookahead); > > Find a book in the reserves. > > C<$itemnumber> is the book's item number. >+C<$lookahead> is the number of days to look in advance for future reserves. > > As I understand it, C<&CheckReserves> looks for the given item in the > reserves. If it is found, that's a match, and C<$status> is set to >@@ -836,7 +838,7 @@ table in the Koha database. > =cut > > sub CheckReserves { >- my ( $item, $barcode ) = @_; >+ my ( $item, $barcode, $lookahead_days) = @_; > my $dbh = C4::Context->dbh; > my $sth; > my $select; >@@ -883,7 +885,7 @@ sub CheckReserves { > return ( '' ) if ( $notforloan_per_item > 0 ) or $notforloan_per_itemtype; > > # Find this item in the reserves >- my @reserves = _Findgroupreserve( $bibitem, $biblio, $itemnumber ); >+ my @reserves = _Findgroupreserve( $bibitem, $biblio, $itemnumber, $lookahead_days); > > # $priority and $highest are used to find the most important item > # in the list returned by &_Findgroupreserve. (The lower $priority, >@@ -1706,11 +1708,12 @@ sub _FixPriority { > > =head2 _Findgroupreserve > >- @results = &_Findgroupreserve($biblioitemnumber, $biblionumber, $itemnumber); >+ @results = &_Findgroupreserve($biblioitemnumber, $biblionumber, $itemnumber, $lookahead); > > Looks for an item-specific match first, then for a title-level match, returning the > first match found. If neither, then we look for a 3rd kind of match based on > reserve constraints. >+Lookahead is the number of days to look in advance. > > TODO: add more explanation about reserve constraints > >@@ -1722,7 +1725,7 @@ C<biblioitemnumber>. > =cut > > sub _Findgroupreserve { >- my ( $bibitem, $biblio, $itemnumber ) = @_; >+ my ( $bibitem, $biblio, $itemnumber, $lookahead) = @_; > my $dbh = C4::Context->dbh; > > # TODO: consolidate at least the SELECT portion of the first 2 queries to a common $select var. >@@ -1747,11 +1750,11 @@ sub _Findgroupreserve { > AND priority > 0 > AND item_level_request = 1 > AND itemnumber = ? >- AND reservedate <= CURRENT_DATE() >+ AND reservedate <= DATE_ADD(NOW(),INTERVAL ? DAY) > AND suspend = 0 > /; > my $sth = $dbh->prepare($item_level_target_query); >- $sth->execute($itemnumber); >+ $sth->execute($itemnumber, $lookahead||0); > my @results; > if ( my $data = $sth->fetchrow_hashref ) { > push( @results, $data ); >@@ -1778,11 +1781,11 @@ sub _Findgroupreserve { > AND priority > 0 > AND item_level_request = 0 > AND hold_fill_targets.itemnumber = ? >- AND reservedate <= CURRENT_DATE() >+ AND reservedate <= DATE_ADD(NOW(),INTERVAL ? DAY) > AND suspend = 0 > /; > $sth = $dbh->prepare($title_level_target_query); >- $sth->execute($itemnumber); >+ $sth->execute($itemnumber, $lookahead||0); > @results = (); > if ( my $data = $sth->fetchrow_hashref ) { > push( @results, $data ); >@@ -1810,11 +1813,11 @@ sub _Findgroupreserve { > AND reserves.reservedate = reserveconstraints.reservedate ) > OR reserves.constrainttype='a' ) > AND (reserves.itemnumber IS NULL OR reserves.itemnumber = ?) >- AND reserves.reservedate <= CURRENT_DATE() >+ AND reserves.reservedate <= DATE_ADD(NOW(),INTERVAL ? DAY) > AND suspend = 0 > /; > $sth = $dbh->prepare($query); >- $sth->execute( $biblio, $bibitem, $itemnumber ); >+ $sth->execute( $biblio, $bibitem, $itemnumber, $lookahead||0); > @results = (); > while ( my $data = $sth->fetchrow_hashref ) { > push( @results, $data ); >diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl >index 919d3d4..0110deb 100755 >--- a/circ/pendingreserves.pl >+++ b/circ/pendingreserves.pl >@@ -25,6 +25,10 @@ > > use strict; > #use warnings; FIXME - Bug 2505 >+ >+use constant TWO_DAYS => 2; >+use constant TWO_DAYS_AGO => -2; >+ > use C4::Context; > use C4::Output; > use CGI; >@@ -66,26 +70,24 @@ my $author; > > my ( $year, $month, $day ) = Today(); > my $todaysdate = sprintf("%-04.4d-%-02.2d-%02.2d", $year, $month, $day); >-my $yesterdaysdate = sprintf("%-04.4d-%-02.2d-%02.2d", Add_Delta_YMD($year, $month, $day, 0, 0, -1)); >-# changed from delivered range of 10 years-yesterday to 2 days ago-today >-# Find two days ago for the default shelf pull start and end dates, unless HoldsToPullStartDate sys pref is set. >-my $defaultstartdate = ( C4::Context->preference('HoldsToPullStartDate') ) ? "-".C4::Context->preference('HoldsToPullStartDate') : -2; >-my $pastdate = sprintf("%-04.4d-%-02.2d-%02.2d", Add_Delta_YMD($year, $month, $day, 0, 0, $defaultstartdate)); >- >-# Predefine the start and end dates if they are not already defined > $startdate =~ s/^\s+//; > $startdate =~ s/\s+$//; > $enddate =~ s/^\s+//; > $enddate =~ s/\s+$//; >-# Check if null, should string match, if so set start and end date to yesterday >+ > if (!defined($startdate) or $startdate eq "") { >+ # changed from delivered range of 10 years-yesterday to 2 days ago-today >+ # Find two days ago for the default shelf pull start date, unless HoldsToPullStartDate sys pref is set. >+ my $pastdate= sprintf("%-04.4d-%-02.2d-%02.2d", Add_Delta_YMD($year, $month, $day, 0, 0, -C4::Context->preference('HoldsToPullStartDate')||TWO_DAYS_AGO )); > $startdate = format_date($pastdate); > } >+ > if (!defined($enddate) or $enddate eq "") { >- $enddate = format_date($todaysdate); >+ #similarly: calculate end date with ConfirmFutureHolds (days) >+ my $d=sprintf("%-04.4d-%-02.2d-%02.2d", Add_Delta_YMD($year, $month, $day, 0, 0, C4::Context->preference('ConfirmFutureHolds')||0 )); >+ $enddate = format_date($d); > } > >- > my @reservedata; > if ( $run_report ) { > my $dbh = C4::Context->dbh; >@@ -202,7 +204,8 @@ $template->param( > run_report => $run_report, > reserveloop => \@reservedata, > "BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1, >- HoldsToPullStartDate => (C4::Context->preference('HoldsToPullStartDate')?C4::Context->preference('HoldsToPullStartDate'):2), >+ HoldsToPullStartDate=> C4::Context->preference('HoldsToPullStartDate')||TWO_DAYS, >+ HoldsToPullEndDate => C4::Context->preference('ConfirmFutureHolds')||0, > ); > > output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index 96b6d34..cabc891 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -61,7 +61,7 @@ Circulation: > - Set the default start date for the Holds to pull list to > - pref: HoldsToPullStartDate > class: integer >- - day(s) ago. >+ - day(s) ago. Note that the default end date is controlled by preference ConfirmFutureHolds. > - > - pref: AllowAllMessageDeletion > choices: >@@ -370,6 +370,11 @@ Circulation: > no: "Don't allow" > - "patrons to place holds that don't enter the waiting list until a certain future date. (AllowHoldDateInFuture must also be enabled)." > - >+ - Confirm future hold requests at checkin within >+ - pref: ConfirmFutureHolds >+ class: integer >+ - day(s). Note that this number of days will be used too in calculating the default end date for the Holds to pull-report. (As may be obvious, use of this preference becomes useful only when allowing future holds. >+ - > - Check the > - pref: ReservesControlBranch > choices: >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt >index 026e9dd..18b3db3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt >@@ -174,7 +174,7 @@ $(document).ready(function() { > <input type="text" size="10" id="to" name="to" value="[% to %]" class="datepickerto" /> > </li> > </ol> >-<p><i>(Inclusive, default is [% HoldsToPullStartDate %] days ago to today, set other date ranges as needed. )</i></p> >+<p><i>(Inclusive, default is [% HoldsToPullStartDate %] days ago to [% IF ( HoldsToPullEndDate ) %][% HoldsToPullEndDate %] days ahead[% ELSE %]today[% END %], set other date ranges as needed. )</i></p> > <fieldset class="action"><input type="submit" name="run_report" value="Submit" class="submit"/></fieldset> > </fieldset> > </form> >-- >1.7.7.6
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 9761
:
15932
|
15933
|
15951
|
15980
|
15981
|
15982
|
18609
|
18610
|
18611
|
18612
|
18613
|
18614
|
18615
| 21193 |
21197
|
21198
|
21208
|
21209
|
21227
|
21280