Bugzilla – Attachment 63096 Details for
Bug 12063
Change date calculation for reserve expiration to skip all holidays
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12063 - make perl atomic update follow skeleton.perl
Bug-12063---make-perl-atomic-update-follow-skeleto.patch (text/plain), 3.42 KB, created by
Marcel de Rooy
on 2017-05-04 12:23:21 UTC
(
hide
)
Description:
Bug 12063 - make perl atomic update follow skeleton.perl
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-05-04 12:23:21 UTC
Size:
3.42 KB
patch
obsolete
>From 01fdfed7c36bd4054918fb3922fc6eff8b23c0e0 Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >Date: Thu, 20 Apr 2017 14:22:25 +0000 >Subject: [PATCH] Bug 12063 - make perl atomic update follow skeleton.perl >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > ...efine_expirationdate_for_waitting_reserves.perl | 44 +++++++++++----------- > 1 file changed, 23 insertions(+), 21 deletions(-) > >diff --git a/installer/data/mysql/atomicupdate/bug_12063-define_expirationdate_for_waitting_reserves.perl b/installer/data/mysql/atomicupdate/bug_12063-define_expirationdate_for_waitting_reserves.perl >index 3a5d232..b0a15bff 100644 >--- a/installer/data/mysql/atomicupdate/bug_12063-define_expirationdate_for_waitting_reserves.perl >+++ b/installer/data/mysql/atomicupdate/bug_12063-define_expirationdate_for_waitting_reserves.perl >@@ -1,30 +1,32 @@ >-use C4::Context; >+$DBversion = 'XXX'; >+if( CheckVersion( $DBversion ) ) { >+ use Koha::Holds; > >-use Koha::Holds; >-use Koha::DateUtils; >-use Koha::Calendar; >+ my $waiting_holds = Koha::Holds->search({ found => 'W', priority => 0 }); >+ while ( my $hold = $waiting_holds->next ) { > >-my $waiting_holds = Koha::Holds->search({ found => 'W', priority => 0 }); >-while ( my $hold = $waiting_holds->next ) { >+ my $requested_expiration; >+ if ($hold->expirationdate) { >+ $requested_expiration = dt_from_string($hold->expirationdate); >+ } > >- my $requested_expiration; >- if ($hold->expirationdate) { >- $requested_expiration = dt_from_string($hold->expirationdate); >- } >+ if ( my $waitingdate = dt_from_string($hold->waitingdate) ) { >+ my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay"); >+ my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays'); >+ my $calendar = Koha::Calendar->new( branchcode => $hold->branchcode ); > >- if ( my $waitingdate = dt_from_string($hold->waitingdate) ) { >- my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay"); >- my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays'); >- my $calendar = Koha::Calendar->new( branchcode => $hold->branchcode ); >+ my $expirationdate = $waitingdate->clone; >+ $expirationdate->add(days => $max_pickup_delay); > >- my $expirationdate = $waitingdate->clone; >- $expirationdate->add(days => $max_pickup_delay); >+ if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) { >+ $expirationdate = $calendar->days_forward( dt_from_string($hold->waitingdate), $max_pickup_delay ); >+ } > >- if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) { >- $expirationdate = $calendar->days_forward( dt_from_string($hold->waitingdate), $max_pickup_delay ); >+ my $cmp = $requested_expiration ? DateTime->compare($requested_expiration, $expirationdate) : 0; >+ $hold->expirationdate($cmp == -1 ? $requested_expiration->ymd : $expirationdate->ymd)->store; > } >- >- my $cmp = $requested_expiration ? DateTime->compare($requested_expiration, $expirationdate) : 0; >- $hold->expirationdate($cmp == -1 ? $requested_expiration->ymd : $expirationdate->ymd)->store; > } >+ >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug XXXXX - description)\n"; > } >\ No newline at end of file >-- >2.1.4
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 12063
:
26966
|
52558
|
52949
|
52950
|
53100
|
53101
|
59161
|
59162
|
59163
|
59165
|
61401
|
61440
|
61461
|
61735
|
62001
|
62002
|
62003
|
62004
|
62005
|
62474
|
63057
|
63091
|
63092
|
63093
|
63094
|
63095
| 63096 |
63097
|
63098
|
63099