Bug 14134 - Make "Holds over" show holds expiring tomorrow if ExpireReservesMaxPickUpDelay is set

If ExpireReservesMaxPickUpDelay is enabled, the "holds over" tab becomes
useless. It would be nice if the "holds over" tab would display
*tomorrow's* "holds over" so the librarian can see what will be
automatically canceled over night.

Test Plan:
1) Apply this patch
2) Enable ExpireReservesMaxPickUpDelay
3) Note the "holds over" list now displays holds that will have been
   waiting more than the number of days defined in ReservesMaxPickUpDelay
   as of tomorrow.

Signed-off-by: Jason Burds <JBurds@dubuque.lib.ia.us>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
This commit is contained in:
Kyle M Hall 2014-07-08 10:49:50 -05:00 committed by Brendan Gallagher
parent a799879735
commit 6af1ca0759
2 changed files with 12 additions and 4 deletions

View File

@ -85,6 +85,9 @@ my @getreserves = $all_branches ? GetReservesForBranch() : GetReservesForBranch(
# get reserves for the branch we are logged into, or for all branches
my $today = Date_to_Days(&Today);
my $max_pickup_delay = C4::Context->preference('ReservesMaxPickUpDelay');
$max_pickup_delay-- if C4::Context->preference('ExpireReservesMaxPickUpDelay');
foreach my $num (@getreserves) {
next unless ($num->{'waitingdate'} && $num->{'waitingdate'} ne '0000-00-00');
@ -105,9 +108,10 @@ foreach my $num (@getreserves) {
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'));
$max_pickup_delay);
my $calcDate = Date_to_Days( $waiting_year, $waiting_month, $waiting_day );
$getreserv{'itemtype'} = $itemtypeinfo->{'description'};
@ -157,7 +161,7 @@ $template->param(
overloop => \@overloop,
overcount => $overcount,
show_date => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }),
ReservesMaxPickUpDelay => C4::Context->preference('ReservesMaxPickUpDelay')
ReservesMaxPickUpDelay => $max_pickup_delay,
);
if ($item && $tab eq 'holdsover') {

View File

@ -71,8 +71,12 @@
[% ELSE %]
<div id="resultlist" class="toptabs">
<ul>
<li><a href="#holdswaiting">[% reservecount %] Hold(s) waiting</a></li>
<li><a href="#holdsover">[% overcount %] Hold(s) over</a></li>
<li><a href="#holdswaiting">Holds waiting: [% reservecount %]</a></li>
<li>
<a href="#holdsover">
Holds waiting over [% ReservesMaxPickUpDelay %] days: [% overcount %]
</a>
</li>
</ul>
<div id="holdswaiting">
[% IF ( reserveloop ) %]