From: Kyle M Hall Date: Tue, 9 May 2017 13:16:49 +0000 (-0400) Subject: Bug 12063 - DBRev 16.12.00.032 X-Git-Tag: v17.05.00~131 X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=commitdiff_plain;h=7130d554584b7ab4f4480399f5d29a90d0aef3d6;p=koha-ffzg.git Bug 12063 - DBRev 16.12.00.032 Signed-off-by: Kyle M Hall --- diff --git a/Koha.pm b/Koha.pm index 87e6f9f969..738668aebc 100644 --- a/Koha.pm +++ b/Koha.pm @@ -29,7 +29,7 @@ use vars qw{ $VERSION }; # - #4 : the developer version. The 4th number is the database subversion. # used by developers when the database changes. updatedatabase take care of the changes itself # and is automatically called by Auth.pm when needed. -$VERSION = "16.12.00.031"; +$VERSION = "16.12.00.032"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_12063-add_excludeholidaysfrommaxpickupdelay_syspref.sql b/installer/data/mysql/atomicupdate/bug_12063-add_excludeholidaysfrommaxpickupdelay_syspref.sql deleted file mode 100644 index c19cc5a79b..0000000000 --- a/installer/data/mysql/atomicupdate/bug_12063-add_excludeholidaysfrommaxpickupdelay_syspref.sql +++ /dev/null @@ -1 +0,0 @@ -INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('ExcludeHolidaysFromMaxPickUpDelay', '0', 'If ON, reserves max pickup delay takes into account the closed days.', NULL, 'Integer'); \ No newline at end of file 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 deleted file mode 100644 index c7af993ac4..0000000000 --- a/installer/data/mysql/atomicupdate/bug_12063-define_expirationdate_for_waitting_reserves.perl +++ /dev/null @@ -1,29 +0,0 @@ -$DBversion = 'XXX'; -if( CheckVersion( $DBversion ) ) { - 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; - if ($hold->expirationdate) { - $requested_expiration = dt_from_string($hold->expirationdate); - } - - my $calendar = Koha::Calendar->new( branchcode => $hold->branchcode ); - my $expirationdate = dt_from_string(); - $expirationdate->add(days => $max_pickup_delay); - - 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 12063 - Update reserves.expirationdate)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 23592e1103..7ed13fad6e 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -14351,6 +14351,41 @@ if( CheckVersion( $DBversion ) ) { print "Upgrade to $DBversion done (Bug 15108: OAI-PMH provider improvements)\n"; } +$DBversion = '16.12.00.032'; +if( CheckVersion( $DBversion ) ) { + require Koha::Calendar; + require Koha::Holds; + + $dbh->do(q{ + INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) + VALUES ('ExcludeHolidaysFromMaxPickUpDelay', '0', 'If ON, reserves max pickup delay takes into account the closed days.', NULL, 'Integer'); + }); + + 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; + if ($hold->expirationdate) { + $requested_expiration = dt_from_string($hold->expirationdate); + } + + my $calendar = Koha::Calendar->new( branchcode => $hold->branchcode ); + my $expirationdate = dt_from_string(); + $expirationdate->add(days => $max_pickup_delay); + + 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 12063 - Update reserves.expirationdate)\n"; +} + # DEVELOPER PROCESS, search for anything to execute in the db_update directory # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it.