From dc6ebfadb8f4a15101be1357a3139dac882e6d14 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 23 Sep 2019 11:48:54 +0100 Subject: [PATCH] Bug 23321: DBRev 19.06.00.029 Signed-off-by: Martin Renvoize --- Koha.pm | 2 +- Koha/Schema/Result/Accountline.pm | 4 +- Koha/Schema/Result/Branch.pm | 4 +- .../data/mysql/atomicupdate/bug_23321.perl | 32 ------------ .../atomicupdate/bug_23321_permissions.perl | 18 ------- .../atomicupdate/bug_23321_preferences.perl | 11 ----- installer/data/mysql/updatedatabase.pl | 49 +++++++++++++++++++ 7 files changed, 54 insertions(+), 66 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_23321.perl delete mode 100644 installer/data/mysql/atomicupdate/bug_23321_permissions.perl delete mode 100644 installer/data/mysql/atomicupdate/bug_23321_preferences.perl diff --git a/Koha.pm b/Koha.pm index b72201cbd6..28a0f6d49a 100644 --- a/Koha.pm +++ b/Koha.pm @@ -29,7 +29,7 @@ use vars qw{ $VERSION }; # - #4 : the developer version. The 4th number is the database subversion. # used by developers when the database changes. updatedatabase take care of the changes itself # and is automatically called by Auth.pm when needed. -$VERSION = "19.06.00.028"; +$VERSION = "19.06.00.029"; sub version { return $VERSION; diff --git a/Koha/Schema/Result/Accountline.pm b/Koha/Schema/Result/Accountline.pm index 41aef75070..c2ae858a96 100644 --- a/Koha/Schema/Result/Accountline.pm +++ b/Koha/Schema/Result/Accountline.pm @@ -313,8 +313,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-09-06 12:23:55 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/8Qeh530PbLC6ryxC1Dw9w +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-09-23 10:45:21 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:L+QlTTT+MdGoA3shpyaBgQ sub koha_objects_class { 'Koha::Account::Lines'; diff --git a/Koha/Schema/Result/Branch.pm b/Koha/Schema/Result/Branch.pm index 984022f357..6191b31a65 100644 --- a/Koha/Schema/Result/Branch.pm +++ b/Koha/Schema/Result/Branch.pm @@ -677,8 +677,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-07-17 07:15:23 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:qGiu+y4MHq5CvBQTj0m8QQ +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-09-23 10:45:22 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:KDg4i49bpMxXQ1LP6OZFWQ __PACKAGE__->add_columns( '+pickup_location' => { is_boolean => 1 } diff --git a/installer/data/mysql/atomicupdate/bug_23321.perl b/installer/data/mysql/atomicupdate/bug_23321.perl deleted file mode 100644 index 0aff6a8a37..0000000000 --- a/installer/data/mysql/atomicupdate/bug_23321.perl +++ /dev/null @@ -1,32 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if ( CheckVersion($DBversion) ) { - - unless ( TableExists( 'cash_registers' ) ) { - $dbh->do(qq{ - CREATE TABLE `cash_registers` ( - `id` int(11) NOT NULL auto_increment, -- unique identifier for each account register - `name` varchar(24) NOT NULL, -- the user friendly identifier for each account register - `description` longtext NOT NULL, -- the user friendly description for each account register - `branch` varchar(10) NOT NULL, -- the foreign key the library this account register belongs - `branch_default` tinyint(1) NOT NULL DEFAULT 0, -- boolean flag to denote that this till is the branch default - `starting_float` decimal(28, 6), -- the starting float this account register should be assigned - `archived` tinyint(1) NOT NULL DEFAULT 0, -- boolean flag to denote if this till is archived or not - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`,`branch`), - CONSTRAINT cash_registers_branch FOREIGN KEY (branch) REFERENCES branches (branchcode) ON UPDATE CASCADE ON DELETE CASCADE - ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci; - }); - } - - unless ( column_exists( 'accountlines', 'register_id' ) ) { - $dbh->do(qq{ALTER TABLE `accountlines` ADD `register_id` int(11) NULL DEFAULT NULL AFTER `manager_id`}); - $dbh->do(qq{ - ALTER TABLE `accountlines` - ADD CONSTRAINT `accountlines_ibfk_registers` FOREIGN KEY (`register_id`) - REFERENCES `cash_registers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE - }); - } - - SetVersion($DBversion); - print "Upgrade to $DBversion done (Bug 23321 - Add cash_registers table)\n"; -} diff --git a/installer/data/mysql/atomicupdate/bug_23321_permissions.perl b/installer/data/mysql/atomicupdate/bug_23321_permissions.perl deleted file mode 100644 index 9d08ac49d7..0000000000 --- a/installer/data/mysql/atomicupdate/bug_23321_permissions.perl +++ /dev/null @@ -1,18 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if ( CheckVersion($DBversion) ) { - - $dbh->do(qq{ - INSERT IGNORE INTO `userflags` (`bit`, `flag`, `flagdesc`, `defaulton`) - VALUES (25, 'cash_management', 'Cash management', 0) - }); - - $dbh->do(qq{ - INSERT IGNORE permissions (module_bit, code, description) - VALUES - (25, 'manage_cash_registers', 'Add and remove cash registers') - }); - - - SetVersion($DBversion); - print "Upgrade to $DBversion done (Bug 23321 - Add cash register permissions)\n"; -} diff --git a/installer/data/mysql/atomicupdate/bug_23321_preferences.perl b/installer/data/mysql/atomicupdate/bug_23321_preferences.perl deleted file mode 100644 index b757933d17..0000000000 --- a/installer/data/mysql/atomicupdate/bug_23321_preferences.perl +++ /dev/null @@ -1,11 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if ( CheckVersion($DBversion) ) { - - $dbh->do(qq{ - INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES - ('UseCashRegisters','0','','Use cash registers with the accounting system and assign patron transactions to them.','YesNo') - }); - - SetVersion($DBversion); - print "Upgrade to $DBversion done (Bug 23321 - Add cash register system preference)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 5d3a77fb99..5f34a84aaa 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -19452,6 +19452,55 @@ if ( CheckVersion($DBversion) ) { print "Upgrade to $DBversion done (Bug 11573 - Fix accounttypes for 'A')\n"; } +$DBversion = '19.06.00.029'; +if ( CheckVersion($DBversion) ) { + + unless ( TableExists( 'cash_registers' ) ) { + $dbh->do(qq{ + CREATE TABLE `cash_registers` ( + `id` int(11) NOT NULL auto_increment, -- unique identifier for each account register + `name` varchar(24) NOT NULL, -- the user friendly identifier for each account register + `description` longtext NOT NULL, -- the user friendly description for each account register + `branch` varchar(10) NOT NULL, -- the foreign key the library this account register belongs + `branch_default` tinyint(1) NOT NULL DEFAULT 0, -- boolean flag to denote that this till is the branch default + `starting_float` decimal(28, 6), -- the starting float this account register should be assigned + `archived` tinyint(1) NOT NULL DEFAULT 0, -- boolean flag to denote if this till is archived or not + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`,`branch`), + CONSTRAINT cash_registers_branch FOREIGN KEY (branch) REFERENCES branches (branchcode) ON UPDATE CASCADE ON DELETE CASCADE + ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci; + }); + } + + unless ( column_exists( 'accountlines', 'register_id' ) ) { + $dbh->do(qq{ALTER TABLE `accountlines` ADD `register_id` int(11) NULL DEFAULT NULL AFTER `manager_id`}); + $dbh->do(qq{ + ALTER TABLE `accountlines` + ADD CONSTRAINT `accountlines_ibfk_registers` FOREIGN KEY (`register_id`) + REFERENCES `cash_registers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE + }); + } + + $dbh->do(qq{ + INSERT IGNORE INTO `userflags` (`bit`, `flag`, `flagdesc`, `defaulton`) + VALUES (25, 'cash_management', 'Cash management', 0) + }); + + $dbh->do(qq{ + INSERT IGNORE permissions (module_bit, code, description) + VALUES + (25, 'manage_cash_registers', 'Add and remove cash registers') + }); + + $dbh->do(qq{ + INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES + ('UseCashRegisters','0','','Use cash registers with the accounting system and assign patron transactions to them.','YesNo') + }); + + SetVersion($DBversion); + print "Upgrade to $DBversion done (Bug 23321 - Add cash_registers table, permissions and preferences)\n"; +} + # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. my $update_dir = C4::Context->config('intranetdir') . '/installer/data/mysql/atomicupdate/'; -- 2.39.5