|
Lines 1-8
Link Here
|
| 1 |
$DBversion = 'XXX'; |
1 |
$DBversion = 'XXX'; |
| 2 |
if( CheckVersion( $DBversion ) ) { |
2 |
if( CheckVersion( $DBversion ) ) { |
| 3 |
use Koha::Holds; |
3 |
require Koha::Calendar; |
|
|
4 |
require Koha::Holds; |
| 4 |
|
5 |
|
| 5 |
my $waiting_holds = Koha::Holds->search({ found => 'W', priority => 0 }); |
6 |
my $waiting_holds = Koha::Holds->search({ found => 'W', priority => 0 }); |
|
|
7 |
my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay"); |
| 6 |
while ( my $hold = $waiting_holds->next ) { |
8 |
while ( my $hold = $waiting_holds->next ) { |
| 7 |
|
9 |
|
| 8 |
my $requested_expiration; |
10 |
my $requested_expiration; |
|
Lines 10-32
if( CheckVersion( $DBversion ) ) {
Link Here
|
| 10 |
$requested_expiration = dt_from_string($hold->expirationdate); |
12 |
$requested_expiration = dt_from_string($hold->expirationdate); |
| 11 |
} |
13 |
} |
| 12 |
|
14 |
|
| 13 |
if ( my $waitingdate = dt_from_string($hold->waitingdate) ) { |
15 |
my $calendar = Koha::Calendar->new( branchcode => $hold->branchcode ); |
| 14 |
my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay"); |
16 |
my $expirationdate = dt_from_string(); |
| 15 |
my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays'); |
17 |
$expirationdate->add(days => $max_pickup_delay); |
| 16 |
my $calendar = Koha::Calendar->new( branchcode => $hold->branchcode ); |
|
|
| 17 |
|
18 |
|
| 18 |
my $expirationdate = $waitingdate->clone; |
19 |
if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) { |
| 19 |
$expirationdate->add(days => $max_pickup_delay); |
20 |
$expirationdate = $calendar->days_forward( dt_from_string(), $max_pickup_delay ); |
| 20 |
|
|
|
| 21 |
if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) { |
| 22 |
$expirationdate = $calendar->days_forward( dt_from_string($hold->waitingdate), $max_pickup_delay ); |
| 23 |
} |
| 24 |
|
| 25 |
my $cmp = $requested_expiration ? DateTime->compare($requested_expiration, $expirationdate) : 0; |
| 26 |
$hold->expirationdate($cmp == -1 ? $requested_expiration->ymd : $expirationdate->ymd)->store; |
| 27 |
} |
21 |
} |
|
|
22 |
|
| 23 |
my $cmp = $requested_expiration ? DateTime->compare($requested_expiration, $expirationdate) : 0; |
| 24 |
$hold->expirationdate($cmp == -1 ? $requested_expiration->ymd : $expirationdate->ymd)->store; |
| 28 |
} |
25 |
} |
| 29 |
|
26 |
|
| 30 |
SetVersion( $DBversion ); |
27 |
SetVersion( $DBversion ); |
| 31 |
print "Upgrade to $DBversion done (Bug XXXXX - description)\n"; |
28 |
print "Upgrade to $DBversion done (Bug 12063 - Update reserves.expirationdate)\n"; |
| 32 |
} |
29 |
} |
| 33 |
- |
|
|