From f11484ae7f43092352f7b9376e86328e9fd7f66d Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 11 Nov 2020 14:38:12 +0000 Subject: [PATCH] Bug 24083: DBRev 20.06.00.069 Signed-off-by: Jonathan Druart --- Koha.pm | 2 +- .../bug_24083_UnseenRenewals_syspref.perl | 6 ------ .../bug_24083_add_issues_unseen_renewals.perl | 12 ------------ ..._issuingrules_unseen_renewals_allowed.perl | 7 ------- installer/data/mysql/updatedatabase.pl | 19 +++++++++++++++++++ 5 files changed, 20 insertions(+), 26 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_24083_UnseenRenewals_syspref.perl delete mode 100644 installer/data/mysql/atomicupdate/bug_24083_add_issues_unseen_renewals.perl delete mode 100644 installer/data/mysql/atomicupdate/bug_24083_add_issuingrules_unseen_renewals_allowed.perl diff --git a/Koha.pm b/Koha.pm index f09e0e21db..c265b36c3a 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 = "20.06.00.068"; +$VERSION = "20.06.00.069"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_24083_UnseenRenewals_syspref.perl b/installer/data/mysql/atomicupdate/bug_24083_UnseenRenewals_syspref.perl deleted file mode 100644 index afa0fcba25..0000000000 --- a/installer/data/mysql/atomicupdate/bug_24083_UnseenRenewals_syspref.perl +++ /dev/null @@ -1,6 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - $dbh->do( q| INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type) VALUES ('UnseenRenewals', '0', 'If enabled, a renewal can be recorded as "unseen" by the library and count against the borrowers unseen renewals limit', '', 'YesNo'); | ); - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 24083 - Add UnseenRenewals syspref)\n"; -} diff --git a/installer/data/mysql/atomicupdate/bug_24083_add_issues_unseen_renewals.perl b/installer/data/mysql/atomicupdate/bug_24083_add_issues_unseen_renewals.perl deleted file mode 100644 index adee26005a..0000000000 --- a/installer/data/mysql/atomicupdate/bug_24083_add_issues_unseen_renewals.perl +++ /dev/null @@ -1,12 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - if( !column_exists( 'issues', 'unseen_renewals' ) ) { - $dbh->do( q| ALTER TABLE issues ADD unseen_renewals TINYINT(4) DEFAULT 0 NOT NULL AFTER renewals | ); - } - if( !column_exists( 'old_issues', 'unseen_renewals' ) ) { - $dbh->do( q| ALTER TABLE old_issues ADD unseen_renewals TINYINT(4) DEFAULT 0 NOT NULL AFTER renewals | ); - } - - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 24083 - Add issues.unseen_renewals & old_issues.unseen_renewals)\n"; -} diff --git a/installer/data/mysql/atomicupdate/bug_24083_add_issuingrules_unseen_renewals_allowed.perl b/installer/data/mysql/atomicupdate/bug_24083_add_issuingrules_unseen_renewals_allowed.perl deleted file mode 100644 index 3e4cc251ce..0000000000 --- a/installer/data/mysql/atomicupdate/bug_24083_add_issuingrules_unseen_renewals_allowed.perl +++ /dev/null @@ -1,7 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - $dbh->do( q| INSERT IGNORE INTO circulation_rules (rule_name) VALUES ('unseen_renewals_allowed') | ); - - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 24083 - Add circulation_rules 'unseen_renewals_allowed' rule)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index b7ad69bba1..2133c7d2fb 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -23386,6 +23386,25 @@ if( CheckVersion( $DBversion ) ) { NewVersion( $DBversion, 23019, "Add import_batch_profiles table and profile_id column in import_batches" ); } +$DBversion = '20.06.00.069'; +if( CheckVersion( $DBversion ) ) { + $dbh->do( q| + INSERT IGNORE INTO circulation_rules (rule_name, rule_value) + VALUES ('unseen_renewals_allowed', '') + | ); + + if( !column_exists( 'issues', 'unseen_renewals' ) ) { + $dbh->do( q| ALTER TABLE issues ADD unseen_renewals TINYINT(4) DEFAULT 0 NOT NULL AFTER renewals | ); + } + if( !column_exists( 'old_issues', 'unseen_renewals' ) ) { + $dbh->do( q| ALTER TABLE old_issues ADD unseen_renewals TINYINT(4) DEFAULT 0 NOT NULL AFTER renewals | ); + } + + $dbh->do( q| INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type) VALUES ('UnseenRenewals', '0', 'If enabled, a renewal can be recorded as "unseen" by the library and count against the borrowers unseen renewals limit', '', 'YesNo'); | ); + + NewVersion( $DBversion, 24083, ["Add circulation_rules 'unseen_renewals_allowed'", "Add issues.unseen_renewals & old_issues.unseen_renewals)", "Add new system preference UnseenRenewals"] ); +} + # 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