Bug 5786: DBRev 3.19.00.017

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Tomas Cohen Arazi 2015-03-25 10:31:53 -03:00
parent e2667222d8
commit 7614cbf462
2 changed files with 36 additions and 36 deletions

View File

@ -9675,41 +9675,6 @@ if ( CheckVersion($DBversion) ) {
SetVersion($DBversion);
}
$DBversion = '3.19.00.XXX';
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
# First create the column
$dbh->do("ALTER TABLE issuingrules ADD onshelfholds tinyint(1) default 0 NOT NULL");
# Now update the column
if (C4::Context->preference("AllowOnShelfHolds")){
# Pref is on, set allow for all rules
$dbh->do("UPDATE issuingrules SET onshelfholds=1");
} else {
# If the preference is not set, leave off
$dbh->do("UPDATE issuingrules SET onshelfholds=0");
}
# Remove from the systempreferences table
$dbh->do("DELETE FROM systempreferences WHERE variable = 'AllowOnShelfHolds'");
# First create the column
$dbh->do("ALTER TABLE issuingrules ADD opacitemholds char(1) DEFAULT 'N' NOT NULL");
# Now update the column
my $opacitemholds = C4::Context->preference("OPACItemHolds") || '';
if (lc ($opacitemholds) eq 'force') {
$opacitemholds = 'F';
}
else {
$opacitemholds = $opacitemholds ? 'Y' : 'N';
}
# Set allow for all rules
$dbh->do("UPDATE issuingrules SET opacitemholds='$opacitemholds'");
# Remove from the systempreferences table
$dbh->do("DELETE FROM systempreferences WHERE variable = 'OPACItemHolds'");
print "Upgrade to $DBversion done (Bug 5786 - Move AllowOnShelfHolds to circulation matrix; Move OPACItemHolds system preference to circulation matrix)\n";
SetVersion ($DBversion);
}
$DBversion = "3.19.00.007";
if ( CheckVersion($DBversion) ) {
my $orphan_budgets = $dbh->selectall_arrayref(q|
@ -9902,6 +9867,41 @@ if(CheckVersion($DBversion)) {
SetVersion($DBversion);
}
$DBversion = '3.19.00.017';
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
# First create the column
$dbh->do("ALTER TABLE issuingrules ADD onshelfholds tinyint(1) default 0 NOT NULL");
# Now update the column
if (C4::Context->preference("AllowOnShelfHolds")){
# Pref is on, set allow for all rules
$dbh->do("UPDATE issuingrules SET onshelfholds=1");
} else {
# If the preference is not set, leave off
$dbh->do("UPDATE issuingrules SET onshelfholds=0");
}
# Remove from the systempreferences table
$dbh->do("DELETE FROM systempreferences WHERE variable = 'AllowOnShelfHolds'");
# First create the column
$dbh->do("ALTER TABLE issuingrules ADD opacitemholds char(1) DEFAULT 'N' NOT NULL");
# Now update the column
my $opacitemholds = C4::Context->preference("OPACItemHolds") || '';
if (lc ($opacitemholds) eq 'force') {
$opacitemholds = 'F';
}
else {
$opacitemholds = $opacitemholds ? 'Y' : 'N';
}
# Set allow for all rules
$dbh->do("UPDATE issuingrules SET opacitemholds='$opacitemholds'");
# Remove from the systempreferences table
$dbh->do("DELETE FROM systempreferences WHERE variable = 'OPACItemHolds'");
print "Upgrade to $DBversion done (Bug 5786 - Move AllowOnShelfHolds to circulation matrix; Move OPACItemHolds system preference to circulation matrix)\n";
SetVersion ($DBversion);
}
=head1 FUNCTIONS
=head2 TableExists($table)

View File

@ -17,7 +17,7 @@ the kohaversion is divided in 4 parts :
use strict;
sub kohaversion {
our $VERSION = '3.19.00.016';
our $VERSION = '3.19.00.017';
# version needs to be set this way
# so that it can be picked up by Makefile.PL
# during install