Bug 24532: DBRev 19.12.00.027
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 20 Feb 2020 08:45:29 +0000 (08:45 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 20 Feb 2020 08:45:52 +0000 (08:45 +0000)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Koha.pm
installer/data/mysql/atomicupdate/bug_24532.perl [deleted file]
installer/data/mysql/updatedatabase.pl

diff --git a/Koha.pm b/Koha.pm
index 3efb8b1..ee5ba35 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 = "19.12.00.026";
+$VERSION = "19.12.00.027";
 
 sub version {
     return $VERSION;
diff --git a/installer/data/mysql/atomicupdate/bug_24532.perl b/installer/data/mysql/atomicupdate/bug_24532.perl
deleted file mode 100644 (file)
index f5347e8..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-$DBversion = 'XXX'; # will be replaced by the RM
-if( CheckVersion( $DBversion ) ) {
-
-    # Add any pathalogical incorrect debit_types as credit_types as appropriate
-    $dbh->do(
-        qq{
-          INSERT IGNORE INTO account_credit_types (
-            code,
-            description,
-            can_be_added_manually,
-            is_system
-          )
-          SELECT
-            DISTINCT(debit_type_code),
-            "Unexpected type found during upgrade",
-            1,
-            0
-          FROM
-            accountlines
-          WHERE
-            amount < 0
-          AND
-            debit_type_code IS NOT NULL
-        }
-    );
-
-    # Correct any pathalogical cases
-    $dbh->do( qq{
-      UPDATE
-        accountlines
-      SET
-        credit_type_code = debit_type_code,
-        debit_type_code = NULL
-      WHERE
-        amount < 0
-      AND
-        debit_type_code IS NOT NULL
-    });
-
-    # Always end with this (adjust the bug info)
-    SetVersion( $DBversion );
-    print "Upgrade to $DBversion done (Bug XXXXX - description)\n";
-}
index d2d8f7a..b1db5b1 100755 (executable)
@@ -20860,6 +20860,50 @@ if( CheckVersion( $DBversion ) ) {
     print "Upgrade to $DBversion done (Bug 11297 - Add support for custom PQF attributes for Z39.50 server searches)\n";
 }
 
+$DBversion = '19.12.00.027';
+if( CheckVersion( $DBversion ) ) {
+
+    # Add any pathalogical incorrect debit_types as credit_types as appropriate
+    $dbh->do(
+        qq{
+          INSERT IGNORE INTO account_credit_types (
+            code,
+            description,
+            can_be_added_manually,
+            is_system
+          )
+          SELECT
+            DISTINCT(debit_type_code),
+            "Unexpected type found during upgrade",
+            1,
+            0
+          FROM
+            accountlines
+          WHERE
+            amount < 0
+          AND
+            debit_type_code IS NOT NULL
+        }
+    );
+
+    # Correct any pathalogical cases
+    $dbh->do( qq{
+      UPDATE
+        accountlines
+      SET
+        credit_type_code = debit_type_code,
+        debit_type_code = NULL
+      WHERE
+        amount < 0
+      AND
+        debit_type_code IS NOT NULL
+    });
+
+    # Always end with this (adjust the bug info)
+    SetVersion( $DBversion );
+    print "Upgrade to $DBversion done (Bug 24532 - Fix pathological cases of negative debits)\n";
+}
+
 # SEE bug 13068
 # if there is anything in the atomicupdate, read and execute it.
 my $update_dir = C4::Context->config('intranetdir') . '/installer/data/mysql/atomicupdate/';