Bug 18925: DBRev 18.12.00.020
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
parent
60c51b9bb0
commit
c53f907235
8 changed files with 99 additions and 185 deletions
2
Koha.pm
2
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 = "18.12.00.019";
|
||||
$VERSION = "18.12.00.020";
|
||||
|
||||
sub version {
|
||||
return $VERSION;
|
||||
|
|
|
@ -301,21 +301,6 @@ __PACKAGE__->has_many(
|
|||
{ cascade_copy => 0, cascade_delete => 0 },
|
||||
);
|
||||
|
||||
=head2 branch_borrower_circ_rules
|
||||
|
||||
Type: has_many
|
||||
|
||||
Related object: L<Koha::Schema::Result::BranchBorrowerCircRule>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->has_many(
|
||||
"branch_borrower_circ_rules",
|
||||
"Koha::Schema::Result::BranchBorrowerCircRule",
|
||||
{ "foreign.branchcode" => "self.branchcode" },
|
||||
{ cascade_copy => 0, cascade_delete => 0 },
|
||||
);
|
||||
|
||||
=head2 branch_item_rules
|
||||
|
||||
Type: has_many
|
||||
|
@ -677,8 +662,8 @@ __PACKAGE__->has_many(
|
|||
);
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-01-03 16:10:04
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:WyXH3sMlyuJIx0fd31RswA
|
||||
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-03-05 20:42:53
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:nArzlMOpUO6oVOAZUgzSRg
|
||||
|
||||
__PACKAGE__->add_columns(
|
||||
'+pickup_location' => { is_boolean => 1 }
|
||||
|
|
|
@ -221,21 +221,6 @@ __PACKAGE__->has_many(
|
|||
{ cascade_copy => 0, cascade_delete => 0 },
|
||||
);
|
||||
|
||||
=head2 branch_borrower_circ_rules
|
||||
|
||||
Type: has_many
|
||||
|
||||
Related object: L<Koha::Schema::Result::BranchBorrowerCircRule>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->has_many(
|
||||
"branch_borrower_circ_rules",
|
||||
"Koha::Schema::Result::BranchBorrowerCircRule",
|
||||
{ "foreign.categorycode" => "self.categorycode" },
|
||||
{ cascade_copy => 0, cascade_delete => 0 },
|
||||
);
|
||||
|
||||
=head2 categories_branches
|
||||
|
||||
Type: has_many
|
||||
|
@ -266,24 +251,9 @@ __PACKAGE__->has_many(
|
|||
{ cascade_copy => 0, cascade_delete => 0 },
|
||||
);
|
||||
|
||||
=head2 default_borrower_circ_rule
|
||||
|
||||
Type: might_have
|
||||
|
||||
Related object: L<Koha::Schema::Result::DefaultBorrowerCircRule>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->might_have(
|
||||
"default_borrower_circ_rule",
|
||||
"Koha::Schema::Result::DefaultBorrowerCircRule",
|
||||
{ "foreign.categorycode" => "self.categorycode" },
|
||||
{ cascade_copy => 0, cascade_delete => 0 },
|
||||
);
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-10-05 14:29:17
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:yvHcgnSv1RXNMXJixVtt0Q
|
||||
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-03-05 20:42:53
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:XR5anXl3qCAm/Fa/l+zYpQ
|
||||
|
||||
|
||||
# You can replace this text with custom content, and it will be preserved on regeneration
|
||||
|
|
|
@ -30,16 +30,6 @@ __PACKAGE__->table("default_branch_circ_rules");
|
|||
is_nullable: 0
|
||||
size: 10
|
||||
|
||||
=head2 maxissueqty
|
||||
|
||||
data_type: 'integer'
|
||||
is_nullable: 1
|
||||
|
||||
=head2 maxonsiteissueqty
|
||||
|
||||
data_type: 'integer'
|
||||
is_nullable: 1
|
||||
|
||||
=head2 holdallowed
|
||||
|
||||
data_type: 'tinyint'
|
||||
|
@ -63,10 +53,6 @@ __PACKAGE__->table("default_branch_circ_rules");
|
|||
__PACKAGE__->add_columns(
|
||||
"branchcode",
|
||||
{ data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 10 },
|
||||
"maxissueqty",
|
||||
{ data_type => "integer", is_nullable => 1 },
|
||||
"maxonsiteissueqty",
|
||||
{ data_type => "integer", is_nullable => 1 },
|
||||
"holdallowed",
|
||||
{ data_type => "tinyint", is_nullable => 1 },
|
||||
"hold_fulfillment_policy",
|
||||
|
@ -110,8 +96,8 @@ __PACKAGE__->belongs_to(
|
|||
);
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-04-29 10:32:00
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:wnrxD1/tp8X01YHmys02lg
|
||||
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-03-05 20:42:53
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SYfKl5LgCoDZVhPooF55SA
|
||||
|
||||
|
||||
# You can replace this text with custom content, and it will be preserved on regeneration
|
||||
|
|
|
@ -30,16 +30,6 @@ __PACKAGE__->table("default_circ_rules");
|
|||
extra: {list => ["singleton"]}
|
||||
is_nullable: 0
|
||||
|
||||
=head2 maxissueqty
|
||||
|
||||
data_type: 'integer'
|
||||
is_nullable: 1
|
||||
|
||||
=head2 maxonsiteissueqty
|
||||
|
||||
data_type: 'integer'
|
||||
is_nullable: 1
|
||||
|
||||
=head2 holdallowed
|
||||
|
||||
data_type: 'integer'
|
||||
|
@ -68,10 +58,6 @@ __PACKAGE__->add_columns(
|
|||
extra => { list => ["singleton"] },
|
||||
is_nullable => 0,
|
||||
},
|
||||
"maxissueqty",
|
||||
{ data_type => "integer", is_nullable => 1 },
|
||||
"maxonsiteissueqty",
|
||||
{ data_type => "integer", is_nullable => 1 },
|
||||
"holdallowed",
|
||||
{ data_type => "integer", is_nullable => 1 },
|
||||
"hold_fulfillment_policy",
|
||||
|
@ -98,8 +84,8 @@ __PACKAGE__->add_columns(
|
|||
__PACKAGE__->set_primary_key("singleton");
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-04-29 10:32:00
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fqBrj0c9h9c0eBlC0kG51w
|
||||
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-03-05 20:42:53
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:mrebGRlc4MORi6OtUk8NyA
|
||||
|
||||
|
||||
# You can replace this text with custom content, and it will be preserved on regeneration
|
||||
|
|
|
@ -97,16 +97,6 @@ __PACKAGE__->table("issuingrules");
|
|||
data_type: 'integer'
|
||||
is_nullable: 1
|
||||
|
||||
=head2 maxissueqty
|
||||
|
||||
data_type: 'integer'
|
||||
is_nullable: 1
|
||||
|
||||
=head2 maxonsiteissueqty
|
||||
|
||||
data_type: 'integer'
|
||||
is_nullable: 1
|
||||
|
||||
=head2 issuelength
|
||||
|
||||
data_type: 'integer'
|
||||
|
@ -255,10 +245,6 @@ __PACKAGE__->add_columns(
|
|||
{ data_type => "tinyint", default_value => 0, is_nullable => 0 },
|
||||
"accountsent",
|
||||
{ data_type => "integer", is_nullable => 1 },
|
||||
"maxissueqty",
|
||||
{ data_type => "integer", is_nullable => 1 },
|
||||
"maxonsiteissueqty",
|
||||
{ data_type => "integer", is_nullable => 1 },
|
||||
"issuelength",
|
||||
{ data_type => "integer", is_nullable => 1 },
|
||||
"lengthunit",
|
||||
|
@ -328,8 +314,8 @@ __PACKAGE__->add_columns(
|
|||
__PACKAGE__->set_primary_key("branchcode", "categorycode", "itemtype");
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2019-01-04 03:06:35
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:slPyHZs0YvOKev3cAxdDJQ
|
||||
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-03-05 20:49:11
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6bPX0BRWWQZrWFun3GP86Q
|
||||
|
||||
|
||||
# You can replace this text with custom code or comments, and it will be preserved on regeneration
|
||||
|
|
|
@ -1,87 +0,0 @@
|
|||
$DBversion = 'XXX'; # will be replaced by the RM
|
||||
if( CheckVersion( $DBversion ) ) {
|
||||
if ( TableExists( 'branch_borrower_circ_rules' ) ) {
|
||||
if ( column_exists( 'branch_borrower_circ_rules', 'maxissueqty' ) ) {
|
||||
$dbh->do("
|
||||
INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
|
||||
SELECT categorycode, branchcode, NULL, 'patron_maxissueqty', COALESCE( maxissueqty, '' )
|
||||
FROM branch_borrower_circ_rules
|
||||
");
|
||||
$dbh->do("
|
||||
INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
|
||||
SELECT categorycode, branchcode, NULL, 'patron_maxonsiteissueqty', COALESCE( maxonsiteissueqty, '' )
|
||||
FROM branch_borrower_circ_rules
|
||||
");
|
||||
$dbh->do("DROP TABLE branch_borrower_circ_rules");
|
||||
}
|
||||
}
|
||||
|
||||
if ( TableExists( 'default_borrower_circ_rules' ) ) {
|
||||
if ( column_exists( 'default_borrower_circ_rules', 'maxissueqty' ) ) {
|
||||
$dbh->do("
|
||||
INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
|
||||
SELECT categorycode, NULL, NULL, 'patron_maxissueqty', COALESCE( maxissueqty, '' )
|
||||
FROM default_borrower_circ_rules
|
||||
");
|
||||
$dbh->do("
|
||||
INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
|
||||
SELECT categorycode, NULL, NULL, 'patron_maxonsiteissueqty', COALESCE( maxonsiteissueqty, '' )
|
||||
FROM default_borrower_circ_rules
|
||||
");
|
||||
$dbh->do("DROP TABLE default_borrower_circ_rules");
|
||||
}
|
||||
}
|
||||
|
||||
if ( column_exists( 'default_circ_rules', 'maxissueqty' ) ) {
|
||||
$dbh->do("
|
||||
INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
|
||||
SELECT NULL, NULL, NULL, 'patron_maxissueqty', COALESCE( maxissueqty, '' )
|
||||
FROM default_circ_rules
|
||||
");
|
||||
$dbh->do("
|
||||
INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
|
||||
SELECT NULL, NULL, NULL, 'patron_maxonsiteissueqty', COALESCE( maxonsiteissueqty, '' )
|
||||
FROM default_circ_rules
|
||||
");
|
||||
$dbh->do("ALTER TABLE default_circ_rules DROP COLUMN maxissueqty, DROP COLUMN maxonsiteissueqty");
|
||||
}
|
||||
|
||||
if ( column_exists( 'default_branch_circ_rules', 'maxissueqty' ) ) {
|
||||
$dbh->do("
|
||||
INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
|
||||
SELECT NULL, branchcode, NULL, 'patron_maxissueqty', COALESCE( maxissueqty, '' )
|
||||
FROM default_branch_circ_rules
|
||||
");
|
||||
$dbh->do("
|
||||
INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
|
||||
SELECT NULL, NULL, NULL, 'patron_maxonsiteissueqty', COALESCE( maxonsiteissueqty, '' )
|
||||
FROM default_branch_circ_rules
|
||||
");
|
||||
$dbh->do("ALTER TABLE default_branch_circ_rules DROP COLUMN maxissueqty, DROP COLUMN maxonsiteissueqty");
|
||||
}
|
||||
|
||||
if ( column_exists( 'issuingrules', 'maxissueqty' ) ) {
|
||||
$dbh->do("
|
||||
INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
|
||||
SELECT IF(categorycode='*', NULL, categorycode),
|
||||
IF(branchcode='*', NULL, branchcode),
|
||||
IF(itemtype='*', NULL, itemtype),
|
||||
'maxissueqty',
|
||||
COALESCE( maxissueqty, '' )
|
||||
FROM issuingrules
|
||||
");
|
||||
$dbh->do("
|
||||
INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
|
||||
SELECT IF(categorycode='*', NULL, categorycode),
|
||||
IF(branchcode='*', NULL, branchcode),
|
||||
IF(itemtype='*', NULL, itemtype),
|
||||
'maxonsiteissueqty',
|
||||
COALESCE( maxonsiteissueqty, '' )
|
||||
FROM issuingrules
|
||||
");
|
||||
$dbh->do("ALTER TABLE issuingrules DROP COLUMN maxissueqty, DROP COLUMN maxonsiteissueqty");
|
||||
}
|
||||
|
||||
SetVersion( $DBversion );
|
||||
print "Upgrade to $DBversion done (Bug 18925 - Move maxissueqty and maxonsiteissueqty to circulation_rules)\n";
|
||||
}
|
|
@ -17463,6 +17463,94 @@ if( CheckVersion( $DBversion ) ) {
|
|||
print "Upgrade to $DBversion done (Bug 21728 - Add 'Reserve Fee' to the account_offset_types table if missing)\n";
|
||||
}
|
||||
|
||||
$DBversion = '18.12.00.020';
|
||||
if( CheckVersion( $DBversion ) ) {
|
||||
if ( TableExists( 'branch_borrower_circ_rules' ) ) {
|
||||
if ( column_exists( 'branch_borrower_circ_rules', 'maxissueqty' ) ) {
|
||||
$dbh->do("
|
||||
INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
|
||||
SELECT categorycode, branchcode, NULL, 'patron_maxissueqty', COALESCE( maxissueqty, '' )
|
||||
FROM branch_borrower_circ_rules
|
||||
");
|
||||
$dbh->do("
|
||||
INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
|
||||
SELECT categorycode, branchcode, NULL, 'patron_maxonsiteissueqty', COALESCE( maxonsiteissueqty, '' )
|
||||
FROM branch_borrower_circ_rules
|
||||
");
|
||||
$dbh->do("DROP TABLE branch_borrower_circ_rules");
|
||||
}
|
||||
}
|
||||
|
||||
if ( TableExists( 'default_borrower_circ_rules' ) ) {
|
||||
if ( column_exists( 'default_borrower_circ_rules', 'maxissueqty' ) ) {
|
||||
$dbh->do("
|
||||
INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
|
||||
SELECT categorycode, NULL, NULL, 'patron_maxissueqty', COALESCE( maxissueqty, '' )
|
||||
FROM default_borrower_circ_rules
|
||||
");
|
||||
$dbh->do("
|
||||
INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
|
||||
SELECT categorycode, NULL, NULL, 'patron_maxonsiteissueqty', COALESCE( maxonsiteissueqty, '' )
|
||||
FROM default_borrower_circ_rules
|
||||
");
|
||||
$dbh->do("DROP TABLE default_borrower_circ_rules");
|
||||
}
|
||||
}
|
||||
|
||||
if ( column_exists( 'default_circ_rules', 'maxissueqty' ) ) {
|
||||
$dbh->do("
|
||||
INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
|
||||
SELECT NULL, NULL, NULL, 'patron_maxissueqty', COALESCE( maxissueqty, '' )
|
||||
FROM default_circ_rules
|
||||
");
|
||||
$dbh->do("
|
||||
INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
|
||||
SELECT NULL, NULL, NULL, 'patron_maxonsiteissueqty', COALESCE( maxonsiteissueqty, '' )
|
||||
FROM default_circ_rules
|
||||
");
|
||||
$dbh->do("ALTER TABLE default_circ_rules DROP COLUMN maxissueqty, DROP COLUMN maxonsiteissueqty");
|
||||
}
|
||||
|
||||
if ( column_exists( 'default_branch_circ_rules', 'maxissueqty' ) ) {
|
||||
$dbh->do("
|
||||
INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
|
||||
SELECT NULL, branchcode, NULL, 'patron_maxissueqty', COALESCE( maxissueqty, '' )
|
||||
FROM default_branch_circ_rules
|
||||
");
|
||||
$dbh->do("
|
||||
INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
|
||||
SELECT NULL, NULL, NULL, 'patron_maxonsiteissueqty', COALESCE( maxonsiteissueqty, '' )
|
||||
FROM default_branch_circ_rules
|
||||
");
|
||||
$dbh->do("ALTER TABLE default_branch_circ_rules DROP COLUMN maxissueqty, DROP COLUMN maxonsiteissueqty");
|
||||
}
|
||||
|
||||
if ( column_exists( 'issuingrules', 'maxissueqty' ) ) {
|
||||
$dbh->do("
|
||||
INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
|
||||
SELECT IF(categorycode='*', NULL, categorycode),
|
||||
IF(branchcode='*', NULL, branchcode),
|
||||
IF(itemtype='*', NULL, itemtype),
|
||||
'maxissueqty',
|
||||
COALESCE( maxissueqty, '' )
|
||||
FROM issuingrules
|
||||
");
|
||||
$dbh->do("
|
||||
INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value )
|
||||
SELECT IF(categorycode='*', NULL, categorycode),
|
||||
IF(branchcode='*', NULL, branchcode),
|
||||
IF(itemtype='*', NULL, itemtype),
|
||||
'maxonsiteissueqty',
|
||||
COALESCE( maxonsiteissueqty, '' )
|
||||
FROM issuingrules
|
||||
");
|
||||
$dbh->do("ALTER TABLE issuingrules DROP COLUMN maxissueqty, DROP COLUMN maxonsiteissueqty");
|
||||
}
|
||||
|
||||
SetVersion( $DBversion );
|
||||
print "Upgrade to $DBversion done (Bug 18925 - Move maxissueqty and maxonsiteissueqty to circulation_rules)\n";
|
||||
}
|
||||
|
||||
# SEE bug 13068
|
||||
# if there is anything in the atomicupdate, read and execute it.
|
||||
|
||||
|
|
Loading…
Reference in a new issue