Bug 22435: Update CREATE offset types
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 16 Mar 2021 17:28:12 +0000 (17:28 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 4 Aug 2021 12:06:43 +0000 (14:06 +0200)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
installer/data/mysql/atomicupdate/bug_22435.perl [new file with mode: 0644]
installer/data/mysql/mandatory/account_offset_types.sql

diff --git a/installer/data/mysql/atomicupdate/bug_22435.perl b/installer/data/mysql/atomicupdate/bug_22435.perl
new file mode 100644 (file)
index 0000000..3839c23
--- /dev/null
@@ -0,0 +1,8 @@
+$DBversion = 'XXX'; # will be replaced by the RM
+if( CheckVersion( $DBversion ) ) {
+    $dbh->do( "INSERT IGNORE INTO account_offset_types () VALUES ( 'CREATE' )" );
+    $dbh->do( "UPDATE account_offsets SET type = 'CREATE' WHERE type != 'OVERDUE_INCREASE' AND type != 'OVERDUE_DECREASE' AND ( debit_id IS NULL OR credit_id IS NULL)" );
+
+    # Always end with this (adjust the bug info)
+    NewVersion( $DBversion, 22435, "Update offsets to CREATE type");
+}
index 040135b..c608ecd 100644 (file)
@@ -1,4 +1,5 @@
 INSERT INTO account_offset_types ( type ) VALUES
+('CREATE'),
 ('Writeoff'),
 ('Payment'),
 ('Purchase'),