From 661009724b9177221fc05b984fae56fa8a7563b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radek=20=C5=A0iman?= Date: Wed, 17 May 2017 15:21:51 +0200 Subject: [PATCH] Bug 17705: Database structure update This patch creates neccessary table and updates systempreferences. Test plan: 1) Apply the patch 2) Check the presence of pos_terminal_transactions table 3) Observe new systempreferences' values - PosTerminalIP - PosTerminalPort - PosTerminalCurrencyCode --- .../atomicupdate/bug_17705-add_pos-terminal-syspref.sql | 4 ++++ .../bug_17705-create_pos_terminal_transactions.perl | 17 +++++++++++++++++ installer/data/mysql/kohastructure.sql | 14 ++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_17705-add_pos-terminal-syspref.sql create mode 100644 installer/data/mysql/atomicupdate/bug_17705-create_pos_terminal_transactions.perl diff --git a/installer/data/mysql/atomicupdate/bug_17705-add_pos-terminal-syspref.sql b/installer/data/mysql/atomicupdate/bug_17705-add_pos-terminal-syspref.sql new file mode 100644 index 0000000..00e670d --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_17705-add_pos-terminal-syspref.sql @@ -0,0 +1,4 @@ +INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES +('PosTerminalIP', '', NULL , 'POS Terminal IP address', 'Free'), +('PosTerminalPort', '', NULL , 'POS Terminal port', 'Integer'), +('PosTerminalCurrencyCode', '', NULL , 'POS Terminal currency code number', 'Integer'); diff --git a/installer/data/mysql/atomicupdate/bug_17705-create_pos_terminal_transactions.perl b/installer/data/mysql/atomicupdate/bug_17705-create_pos_terminal_transactions.perl new file mode 100644 index 0000000..008a38c --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_17705-create_pos_terminal_transactions.perl @@ -0,0 +1,17 @@ +$DBversion = 'XXX'; +if( CheckVersion( $DBversion ) ) { + # Create pos_terminal_transactions table: + $dbh->do( "CREATE TABLE IF NOT EXISTS `pos_terminal_transactions` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `accountlines_id` int(11) NOT NULL, + `status` varchar(32) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'new', + `response_code` varchar(5) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, + `message_log` text CHARACTER SET utf8 COLLATE utf8_unicode_ci, + PRIMARY KEY (`id`), + KEY `accountlines_id` (`accountlines_id`), + CONSTRAINT `pos_terminal_transactions_ibfk1` FOREIGN KEY (`accountlines_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE CASCADE ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" ); + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 17705 - Payments with cards through payment terminal)\n"; +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 514c13d..3981528 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1362,6 +1362,20 @@ CREATE TABLE pending_offline_operations ( PRIMARY KEY (operationid) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +-- +-- Table structure for table `pos_terminal_transactions` +-- + +CREATE TABLE `pos_terminal_transactions` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `accountlines_id` int(11) NOT NULL, + `status` varchar(32) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'new', + `response_code` varchar(5) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, + `message_log` text CHARACTER SET utf8 COLLATE utf8_unicode_ci, + PRIMARY KEY (`id`), + KEY `accountlines_id` (`accountlines_id`), + CONSTRAINT `pos_terminal_transactions_ibfk1` FOREIGN KEY (`accountlines_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Table structure for table `printers` -- 2.1.4