Bug 23355: Add cash_register_actions table
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 23 Jul 2019 13:05:18 +0000 (14:05 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 3 Mar 2020 15:03:00 +0000 (15:03 +0000)
This patch adds the new cash_register_actions database table to allow
for storing of cash register actions which are not already stored as
accountlines.

Sponsored-by: PTFS Europe
Sponsored-by: Cheshire Libraries Shared Services
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
installer/data/mysql/atomicupdate/bug_23355.perl [new file with mode: 0644]
installer/data/mysql/kohastructure.sql

diff --git a/installer/data/mysql/atomicupdate/bug_23355.perl b/installer/data/mysql/atomicupdate/bug_23355.perl
new file mode 100644 (file)
index 0000000..6517d53
--- /dev/null
@@ -0,0 +1,19 @@
+$DBversion = 'XXX';    # will be replaced by the RM
+if ( CheckVersion($DBversion) ) {
+
+    $dbh->do(qq{
+CREATE TABLE `cash_register_actions` (
+  `id` int(11) NOT NULL auto_increment, -- unique identifier for each account register action
+  `code` varchar(24) NOT NULL, -- action code denoting the type of action recorded (enum),
+  `manager_id` int(11) NOT NULL, -- staff member performing the action
+  `amount` decimal(28,6) DEFAULT NULL, -- amount recorded in action (signed)
+  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
+  PRIMARY KEY (`id`),
+  CONSTRAINT `cash_register_actions_manager` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
+  CONSTRAINT `cash_register_actions_register` FOREIGN KEY (`register_id`) REFERENCES `cash_registers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
+    });
+
+    SetVersion($DBversion);
+    print "Upgrade to $DBversion done (Bug 23355 - Add cash_register_actions table)\n";
+}
index 388cf82..07ba70a 100644 (file)
@@ -2710,6 +2710,22 @@ CREATE TABLE `account_offsets` (
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 --
+-- Table structure for table `cash_register_actions`
+--
+
+CREATE TABLE `cash_register_actions` (
+  `id` int(11) NOT NULL auto_increment, -- unique identifier for each account register action
+  `code` varchar(24) NOT NULL, -- action code denoting the type of action recorded (enum),
+  `register_id` int(11) NOT NULL, -- id of cash_register this action belongs to,
+  `manager_id` int(11) NOT NULL, -- staff member performing the action
+  `amount` decimal(28,6) DEFAULT NULL, -- amount recorded in action (signed)
+  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
+  PRIMARY KEY (`id`),
+  CONSTRAINT `cash_register_actions_manager` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
+  CONSTRAINT `cash_register_actions_register` FOREIGN KEY (`register_id`) REFERENCES `cash_registers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
+
+--
 -- Table structure for table `action_logs`
 --