From 9a5544cb9c0dd8f3946af779a2c0a6bf5e945e1d Mon Sep 17 00:00:00 2001
From: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Date: Thu, 14 Mar 2019 12:14:17 +0000
Subject: [PATCH] Bug 22512: Add status field to accountlines

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
---
 .../data/mysql/atomicupdate/bug_22512.perl     | 18 ++++++++++++++++++
 installer/data/mysql/kohastructure.sql         |  1 +
 2 files changed, 19 insertions(+)
 create mode 100644 installer/data/mysql/atomicupdate/bug_22512.perl

diff --git a/installer/data/mysql/atomicupdate/bug_22512.perl b/installer/data/mysql/atomicupdate/bug_22512.perl
new file mode 100644
index 0000000000..206a829d93
--- /dev/null
+++ b/installer/data/mysql/atomicupdate/bug_22512.perl
@@ -0,0 +1,18 @@
+$DBversion = 'XXX';    # will be replaced by the RM
+if ( CheckVersion($DBversion) ) {
+
+    if ( !column_exists( 'accountlines', 'status' ) ) {
+        $dbh->do(
+            qq{
+            ALTER TABLE `accountlines`
+            ADD
+              `status` varchar(16) DEFAULT NULL
+            AFTER
+              `accounttype`
+          }
+        );
+    }
+
+    SetVersion($DBversion);
+    print "Upgrade to $DBversion done (Bug 22512 - Add status to accountlines)\n";
+}
diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index 3b37e8cbf3..a317207a3b 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -2676,6 +2676,7 @@ CREATE TABLE `accountlines` (
   `amount` decimal(28,6) default NULL,
   `description` LONGTEXT,
   `accounttype` varchar(5) default NULL,
+  `status` varchar(16) default NULL,
   `payment_type` varchar(80) default NULL, -- optional authorised value PAYMENT_TYPE
   `amountoutstanding` decimal(28,6) default NULL,
   `lastincrement` decimal(28,6) default NULL,
-- 
2.21.0