From df9b697cd4a24dce2a385ba34e8c98ff4135d527 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 10 Nov 2020 13:32:09 +0000 Subject: [PATCH] Bug 23916: DBRev 20.06.00.065 Signed-off-by: Jonathan Druart --- Koha.pm | 2 +- .../bug_23916_add_RecordIssuer_syspref.perl | 8 -------- .../bug_23916_add_issues_issuer.perl | 17 ---------------- installer/data/mysql/updatedatabase.pl | 20 +++++++++++++++++++ 4 files changed, 21 insertions(+), 26 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_23916_add_RecordIssuer_syspref.perl delete mode 100644 installer/data/mysql/atomicupdate/bug_23916_add_issues_issuer.perl diff --git a/Koha.pm b/Koha.pm index abb8914f92..f82de78fa2 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.064"; +$VERSION = "20.06.00.065"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_23916_add_RecordIssuer_syspref.perl b/installer/data/mysql/atomicupdate/bug_23916_add_RecordIssuer_syspref.perl deleted file mode 100644 index aa1dc6960e..0000000000 --- a/installer/data/mysql/atomicupdate/bug_23916_add_RecordIssuer_syspref.perl +++ /dev/null @@ -1,8 +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 ('RecordStaffUserOnCheckout', '0', 'If enabled, when an item is checked out, the user who checked out the item is recorded', '', 'YesNo'); | ); - - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 23916 - Add RecordStaffUserOnCheckout syspref)\n"; -} diff --git a/installer/data/mysql/atomicupdate/bug_23916_add_issues_issuer.perl b/installer/data/mysql/atomicupdate/bug_23916_add_issues_issuer.perl deleted file mode 100644 index 0da7576b4a..0000000000 --- a/installer/data/mysql/atomicupdate/bug_23916_add_issues_issuer.perl +++ /dev/null @@ -1,17 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - if( !column_exists( 'issues', 'issuer_id' ) ) { - $dbh->do( q| ALTER TABLE issues ADD issuer_id INT(11) DEFAULT NULL AFTER borrowernumber | ); - } - if (!foreign_key_exists( 'issues', 'issues_ibfk_borrowers_borrowernumber' )) { - $dbh->do( q| ALTER TABLE issues ADD CONSTRAINT `issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE | ); - } - if( !column_exists( 'old_issues', 'issuer_id' ) ) { - $dbh->do( q| ALTER TABLE old_issues ADD issuer_id INT(11) DEFAULT NULL AFTER borrowernumber | ); - } - if (!foreign_key_exists( 'old_issues', 'old_issues_ibfk_borrowers_borrowernumber' )) { - $dbh->do( q| ALTER TABLE old_issues ADD CONSTRAINT `old_issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE | ); - } - - NewVersion( $DBversion, 23916, "Add issues.issuer_id"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 8d6394b447..1d3f65ac6e 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -23282,6 +23282,26 @@ if ( CheckVersion($DBversion) ) { NewVersion( $DBversion, 24603, "Add CANCELLATION credit_type_code" ); } +$DBversion = '20.06.00.065'; +if( CheckVersion( $DBversion ) ) { + if( !column_exists( 'issues', 'issuer' ) ) { + $dbh->do( q| ALTER TABLE issues ADD issuer_id INT(11) DEFAULT NULL AFTER borrowernumber | ); + } + if (!foreign_key_exists( 'issues', 'issues_ibfk_borrowers_borrowernumber' )) { + $dbh->do( q| ALTER TABLE issues ADD CONSTRAINT `issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE | ); + } + if( !column_exists( 'old_issues', 'issuer' ) ) { + $dbh->do( q| ALTER TABLE old_issues ADD issuer_id INT(11) DEFAULT NULL AFTER borrowernumber | ); + } + if (!foreign_key_exists( 'old_issues', 'old_issues_ibfk_borrowers_borrowernumber' )) { + $dbh->do( q| ALTER TABLE old_issues ADD CONSTRAINT `old_issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE | ); + } + + $dbh->do( q| INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type) VALUES ('RecordStaffUserOnCheckout', '0', 'If enabled, when an item is checked out, the user who checked out the item is recorded', '', 'YesNo'); | ); + + NewVersion( $DBversion, 23916, [ "Add new [old_]issues.issuer DB fields", "Add new syspref RecordStaffUserOnCheckout" ] ); +} + # 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