From 1181766cd6afaa3d2909eeced22f29f46fd2786c 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 | 16 ++++++++++++++++ installer/data/mysql/sysprefs.sql | 3 +++ 4 files changed, 40 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..bd89036 --- /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) NOT NULL DEFAULT 'new', + `response_code` varchar(5) DEFAULT NULL, + `message_log` text, + 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=utf8mb4 COLLATE=utf8mb4_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 f7970c0..d5aa0d8 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2748,6 +2748,22 @@ CREATE TABLE `account_offsets` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- +-- Table structure for table `pos_terminal_transactions` +-- + +DROP TABLE IF EXISTS `pos_terminal_transactions` +CREATE TABLE `pos_terminal_transactions` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `accountlines_id` int(11) NOT NULL, + `status` varchar(32) NOT NULL DEFAULT 'new', + `response_code` varchar(5) DEFAULT NULL, + `message_log` text, + 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=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- -- Table structure for table `action_logs` -- diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 2ea76a4..719bbdc 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -438,6 +438,9 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('PayPalSandboxMode', '1', NULL , 'If enabled, the system will use PayPal''s sandbox server for testing, rather than the production server.', 'YesNo'), ('PayPalSignature', '', NULL , 'Your PayPal API signature', 'Free'), ('PayPalUser', '', NULL , 'Your PayPal API username ( email address )', 'Free'), +('PosTerminalCurrencyCode', '', NULL , 'POS Terminal currency code number', 'Integer'), +('PosTerminalIP', '', NULL , 'POS Terminal IP address', 'Free'), +('PosTerminalPort', '', NULL , 'POS Terminal port', 'Integer'), ('PrefillItem','0','','When a new item is added, should it be prefilled with last created item values?','YesNo'), ('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'), ('printcirculationslips','1','','If ON, enable printing circulation receipts','YesNo'), -- 2.1.4