From 37d13fb07deda53fddc69368f538f49c01645143 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 20 Aug 2020 10:27:33 +0000 Subject: [PATCH] Bug 19036: DBRev 20.06.00.026 Signed-off-by: Jonathan Druart --- Koha.pm | 2 +- .../data/mysql/atomicupdate/bug-19036.perl | 20 ------------------- installer/data/mysql/updatedatabase.pl | 20 +++++++++++++++++++ 3 files changed, 21 insertions(+), 21 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug-19036.perl diff --git a/Koha.pm b/Koha.pm index ba1f905dcb..d567cca7ed 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.025"; +$VERSION = "20.06.00.026"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug-19036.perl b/installer/data/mysql/atomicupdate/bug-19036.perl deleted file mode 100644 index e92cf096b3..0000000000 --- a/installer/data/mysql/atomicupdate/bug-19036.perl +++ /dev/null @@ -1,20 +0,0 @@ -$DBversion = 'XXX'; -if (CheckVersion($DBversion)) { - unless (column_exists('accountlines', 'credit_number')) { - $dbh->do('ALTER TABLE accountlines ADD COLUMN credit_number VARCHAR(20) NULL DEFAULT NULL COMMENT "autogenerated number for credits" AFTER debit_type_code'); - } - - unless (column_exists('account_credit_types', 'credit_number_enabled')) { - $dbh->do(q{ - ALTER TABLE account_credit_types - ADD COLUMN credit_number_enabled TINYINT(1) NOT NULL DEFAULT 0 - COMMENT "Is autogeneration of credit number enabled for this credit type" - AFTER can_be_added_manually - }); - } - - $dbh->do('INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES(?, ?, ?, ?, ?)', undef, 'AutoCreditNumber', '', '', 'Automatically generate a number for account credits', 'Choice'); - - SetVersion($DBversion); - print "Upgrade to $DBversion done (Bug 19036 - Add accountlines.credit_number, account_credit_types.credit_number_enabled and syspref AutoCreditNumber)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 0569cb97a3..e98883aeb4 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -22616,6 +22616,26 @@ if( CheckVersion( $DBversion ) ) { NewVersion( $DBversion, 6725, "Adds PatronDuplicateMatchingAddFields system preference"); } +$DBversion = '20.06.00.026'; +if (CheckVersion($DBversion)) { + unless (column_exists('accountlines', 'credit_number')) { + $dbh->do('ALTER TABLE accountlines ADD COLUMN credit_number VARCHAR(20) NULL DEFAULT NULL COMMENT "autogenerated number for credits" AFTER debit_type_code'); + } + + unless (column_exists('account_credit_types', 'credit_number_enabled')) { + $dbh->do(q{ + ALTER TABLE account_credit_types + ADD COLUMN credit_number_enabled TINYINT(1) NOT NULL DEFAULT 0 + COMMENT "Is autogeneration of credit number enabled for this credit type" + AFTER can_be_added_manually + }); + } + + $dbh->do('INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES(?, ?, ?, ?, ?)', undef, 'AutoCreditNumber', '', '', 'Automatically generate a number for account credits', 'Choice'); + + NewVersion( $DBversion, 19036, "Add accountlines.credit_number, account_credit_types.credit_number_enabled and syspref AutoCreditNumber" ); +} + # 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