ADD COLUMN class_split_rule varchar(10) NOT NULL default ''
AFTER class_sort_rule
|);
+
$dbh->do(q|
UPDATE class_sources
SET class_split_rule = class_sort_rule
|);
+ $dbh->do(q|
+ UPDATE class_sources
+ SET class_split_rule = 'generic'
+ WHERE class_split_rule NOT IN('dewey', 'generic', 'lcc')
+ |);
+
$dbh->do(q|
INSERT INTO class_split_rules(class_split_rule, description, split_routine)
VALUES
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";
+}
+
+$DBversion = '18.12.00.021';
+if ( CheckVersion($DBversion) ) {
+
+ if ( !column_exists( 'itemtypes', 'rentalcharge_daily' ) ) {
+ $dbh->do("ALTER TABLE `itemtypes` ADD COLUMN `rentalcharge_daily` decimal(28,6) default NULL AFTER `rentalcharge`");
+ }
+
+ if ( !column_exists( 'itemtypes', 'rentalcharge_hourly' ) ) {
+ $dbh->do("ALTER TABLE `itemtypes` ADD COLUMN `rentalcharge_hourly` decimal(28,6) default NULL AFTER `rentalcharge_daily`");
+ }
+
+ if ( column_exists( 'itemtypes', 'rental_charge_daily' ) ) {
+ $dbh->do("UPDATE `itemtypes` SET `rentalcharge_daily` = `rental_charge_daily`");
+ $dbh->do("ALTER TABLE `itemtypes` DROP COLUMN `rental_charge_daily`");
+ }
+
+ SetVersion($DBversion);
+ print "Upgrade to $DBversion done (Bug 20912 - Support granular rental charges)\n";
+}
+
+$DBversion = '18.12.00.022';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do( q{
+ INSERT IGNORE INTO permissions (module_bit,code,description)
+ VALUES
+ (3,'manage_additional_fields','Add, edit, or delete additional custom fields for baskets or subscriptions (also requires order_manage or edit_subscription permissions)')
+ });
+ $dbh->do( q{
+ INSERT INTO user_permissions (borrowernumber, module_bit, code)
+ SELECT borrowernumber, 3, 'manage_additional_fields' FROM borrowers WHERE borrowernumber IN (SELECT DISTINCT borrowernumber FROM user_permissions WHERE code = 'order_manage' OR code = 'edit_subscription');
+ });
+ $dbh->do( q{
+ INSERT INTO user_permissions (borrowernumber, module_bit, code)
+ SELECT borrowernumber, 3, 'manage_additional_fields' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM borrowers WHERE MOD(flags DIV POWER(2,11),2)=1 OR MOD(flags DIV POWER(2,15),2) =1);
+ });
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 15774 - Add permission for managing additional fields)\n";
+}
+
+$DBversion = '18.12.00.023';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do(q|
+ INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type)
+ VALUES ('ILLOpacbackends',NULL,NULL,'ILL backends to enabled for OPAC initiated requests','multiple');
+ |);
+
+ # Always end with this (adjust the bug info)
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 20639 - Add ILLOpacbackends syspref)\n";
+}
+
# SEE bug 13068
# if there is anything in the atomicupdate, read and execute it.