Bugzilla – Attachment 63098 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: [QA Follow-up] Adjustments to db revision
Bug-12063-QA-Follow-up-Adjustments-to-db-revision.patch (text/plain), 3.46 KB, created by
Marcel de Rooy
on 2017-05-04 12:23:32 UTC
(
hide
)
Description:
Bug 12063: [QA Follow-up] Adjustments to db revision
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-05-04 12:23:32 UTC
Size:
3.46 KB
patch
obsolete
>From 9b491c78c6e006d5f44aa7112e37e6b06173a4dc Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 4 May 2017 12:53:03 +0200 >Subject: [PATCH] Bug 12063: [QA Follow-up] Adjustments to db revision >Content-Type: text/plain; charset=utf-8 > >Replace use by require. >Add require Koha::Calendar (seriously needed to prevent crashing). >Base expirationdate on today not on waitingdate (just as in Reserves). >Remove if ( waitingdate ) construction. Not needed anymore. >Remove $cancel_on_holidays. Not used. Note that the if construction around >the new pref is not strictly needed at upgrade time (pref still zero). >Fill the dbrev description. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > ...efine_expirationdate_for_waitting_reserves.perl | 29 ++++++++++------------ > 1 file changed, 13 insertions(+), 16 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 b0a15bff..c7af993 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,8 +1,10 @@ > $DBversion = 'XXX'; > if( CheckVersion( $DBversion ) ) { >- use Koha::Holds; >+ require Koha::Calendar; >+ require Koha::Holds; > > my $waiting_holds = Koha::Holds->search({ found => 'W', priority => 0 }); >+ my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay"); > while ( my $hold = $waiting_holds->next ) { > > my $requested_expiration; >@@ -10,23 +12,18 @@ if( CheckVersion( $DBversion ) ) { > $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 ); >+ my $calendar = Koha::Calendar->new( branchcode => $hold->branchcode ); >+ my $expirationdate = dt_from_string(); >+ $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 ); >- } >- >- my $cmp = $requested_expiration ? DateTime->compare($requested_expiration, $expirationdate) : 0; >- $hold->expirationdate($cmp == -1 ? $requested_expiration->ymd : $expirationdate->ymd)->store; >+ if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) { >+ $expirationdate = $calendar->days_forward( dt_from_string(), $max_pickup_delay ); > } >+ >+ 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 >+ print "Upgrade to $DBversion done (Bug 12063 - Update reserves.expirationdate)\n"; >+} >-- >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