Bug 12063 - DBRev 16.12.00.032
authorKyle M Hall <kyle@bywatersolutions.com>
Tue, 9 May 2017 13:16:49 +0000 (09:16 -0400)
committerKyle M Hall <kyle@bywatersolutions.com>
Tue, 9 May 2017 13:16:49 +0000 (09:16 -0400)
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Koha.pm
installer/data/mysql/atomicupdate/bug_12063-add_excludeholidaysfrommaxpickupdelay_syspref.sql [deleted file]
installer/data/mysql/atomicupdate/bug_12063-define_expirationdate_for_waitting_reserves.perl [deleted file]
installer/data/mysql/updatedatabase.pl

diff --git a/Koha.pm b/Koha.pm
index 87e6f9f..738668a 100644 (file)
--- 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 (file)
index c19cc5a..0000000
+++ /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 (file)
index c7af993..0000000
+++ /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";
-}
index 23592e1..7ed13fa 100755 (executable)
@@ -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.