Bug 18928: DBRev 19.06.00.010

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Martin Renvoize 2019-07-01 15:17:38 +01:00
parent d0c2138c8c
commit 98914ed6bb
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F
3 changed files with 92 additions and 91 deletions

View file

@ -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;

View file

@ -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";
}

View file

@ -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/';