From 98914ed6bb265959356406b9a9bc569919df6125 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 1 Jul 2019 15:17:38 +0100 Subject: [PATCH] Bug 18928: DBRev 19.06.00.010 Signed-off-by: Martin Renvoize --- Koha.pm | 2 +- .../data/mysql/atomicupdate/bug_18928.perl | 90 ------------------ installer/data/mysql/updatedatabase.pl | 91 +++++++++++++++++++ 3 files changed, 92 insertions(+), 91 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_18928.perl diff --git a/Koha.pm b/Koha.pm index a8149d71da..4a58bea0a1 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.009"; +$VERSION = "19.06.00.010"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_18928.perl b/installer/data/mysql/atomicupdate/bug_18928.perl deleted file mode 100644 index 2ee59f36bd..0000000000 --- a/installer/data/mysql/atomicupdate/bug_18928.perl +++ /dev/null @@ -1,90 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - - if ( TableExists('default_circ_rules') ) { - if ( column_exists( 'default_circ_rules', 'holdallowed' ) ) { - $dbh->do(" - INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) - SELECT NULL, NULL, NULL, 'holdallowed', holdallowed - FROM default_circ_rules - "); - $dbh->do(" - INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) - SELECT NULL, NULL, NULL, 'hold_fulfillment_policy', hold_fulfillment_policy - FROM default_circ_rules - "); - $dbh->do(" - INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) - SELECT NULL, NULL, NULL, 'returnbranch', returnbranch - FROM default_circ_rules - "); - $dbh->do("DROP TABLE default_circ_rules"); - } - } - - if ( TableExists('default_branch_circ_rules') ) { - if ( column_exists( 'default_branch_circ_rules', 'holdallowed' ) ) { - $dbh->do(" - INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) - SELECT NULL, branchcode, NULL, 'holdallowed', holdallowed - FROM default_branch_circ_rules - "); - $dbh->do(" - INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) - SELECT NULL, branchcode, NULL, 'hold_fulfillment_policy', hold_fulfillment_policy - FROM default_branch_circ_rules - "); - $dbh->do(" - INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) - SELECT NULL, branchcode, NULL, 'returnbranch', returnbranch - FROM default_branch_circ_rules - "); - $dbh->do("DROP TABLE default_branch_circ_rules"); - } - } - - if ( TableExists('branch_item_rules') ) { - if ( column_exists( 'branch_item_rules', 'holdallowed' ) ) { - $dbh->do(" - INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) - SELECT NULL, branchcode, itemtype, 'holdallowed', holdallowed - FROM branch_item_rules - "); - $dbh->do(" - INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) - SELECT NULL, branchcode, itemtype, 'hold_fulfillment_policy', hold_fulfillment_policy - FROM branch_item_rules - "); - $dbh->do(" - INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) - SELECT NULL, branchcode, itemtype, 'returnbranch', returnbranch - FROM branch_item_rules - "); - $dbh->do("DROP TABLE branch_item_rules"); - } - } - - if ( TableExists('default_branch_item_rules') ) { - if ( column_exists( 'default_branch_item_rules', 'holdallowed' ) ) { - $dbh->do(" - INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) - SELECT NULL, NULL, itemtype, 'holdallowed', holdallowed - FROM default_branch_item_rules - "); - $dbh->do(" - INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) - SELECT NULL, NULL, itemtype, 'hold_fulfillment_policy', hold_fulfillment_policy - FROM default_branch_item_rules - "); - $dbh->do(" - INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) - SELECT NULL, NULL, itemtype, 'returnbranch', returnbranch - FROM default_branch_item_rules - "); - $dbh->do("DROP TABLE default_branch_item_rules"); - } - } - - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 18928 - Move holdallowed, hold_fulfillment_policy, returnbranch to circulation_rules)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index d2a0fa7123..603dc34c14 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -18790,6 +18790,97 @@ if( CheckVersion( $DBversion ) ) { print "Upgrade to $DBversion done (Bug 17178 - add shortcut to keyboard_shortcuts)\n"; } +$DBversion = '19.06.00.010'; +if( CheckVersion( $DBversion ) ) { + + if ( TableExists('default_circ_rules') ) { + if ( column_exists( 'default_circ_rules', 'holdallowed' ) ) { + $dbh->do(" + INSERT IGNORE INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) + SELECT NULL, NULL, NULL, 'holdallowed', holdallowed + FROM default_circ_rules + "); + $dbh->do(" + INSERT IGNORE INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) + SELECT NULL, NULL, NULL, 'hold_fulfillment_policy', hold_fulfillment_policy + FROM default_circ_rules + "); + $dbh->do(" + INSERT IGNORE INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) + SELECT NULL, NULL, NULL, 'returnbranch', returnbranch + FROM default_circ_rules + "); + $dbh->do("DROP TABLE default_circ_rules"); + } + } + + if ( TableExists('default_branch_circ_rules') ) { + if ( column_exists( 'default_branch_circ_rules', 'holdallowed' ) ) { + $dbh->do(" + INSERT IGNORE INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) + SELECT NULL, branchcode, NULL, 'holdallowed', holdallowed + FROM default_branch_circ_rules + "); + $dbh->do(" + INSERT IGNORE INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) + SELECT NULL, branchcode, NULL, 'hold_fulfillment_policy', hold_fulfillment_policy + FROM default_branch_circ_rules + "); + $dbh->do(" + INSERT IGNORE INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) + SELECT NULL, branchcode, NULL, 'returnbranch', returnbranch + FROM default_branch_circ_rules + "); + $dbh->do("DROP TABLE default_branch_circ_rules"); + } + } + + if ( TableExists('branch_item_rules') ) { + if ( column_exists( 'branch_item_rules', 'holdallowed' ) ) { + $dbh->do(" + INSERT IGNORE INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) + SELECT NULL, branchcode, itemtype, 'holdallowed', holdallowed + FROM branch_item_rules + "); + $dbh->do(" + INSERT IGNORE INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) + SELECT NULL, branchcode, itemtype, 'hold_fulfillment_policy', hold_fulfillment_policy + FROM branch_item_rules + "); + $dbh->do(" + INSERT IGNORE INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) + SELECT NULL, branchcode, itemtype, 'returnbranch', returnbranch + FROM branch_item_rules + "); + $dbh->do("DROP TABLE branch_item_rules"); + } + } + + if ( TableExists('default_branch_item_rules') ) { + if ( column_exists( 'default_branch_item_rules', 'holdallowed' ) ) { + $dbh->do(" + INSERT IGNORE INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) + SELECT NULL, NULL, itemtype, 'holdallowed', holdallowed + FROM default_branch_item_rules + "); + $dbh->do(" + INSERT IGNORE INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) + SELECT NULL, NULL, itemtype, 'hold_fulfillment_policy', hold_fulfillment_policy + FROM default_branch_item_rules + "); + $dbh->do(" + INSERT IGNORE INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) + SELECT NULL, NULL, itemtype, 'returnbranch', returnbranch + FROM default_branch_item_rules + "); + $dbh->do("DROP TABLE default_branch_item_rules"); + } + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 18928 - Move holdallowed, hold_fulfillment_policy, returnbranch to circulation_rules)\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