From 90756266e6766ad4530a561559ddf47de1794a85 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 30 Sep 2020 14:16:31 +0000 Subject: [PATCH] Bug 26268: DBRev 20.06.00.041 Signed-off-by: Jonathan Druart --- Koha.pm | 2 +- .../data/mysql/atomicupdate/bug_26268.perl | 38 ------------------ installer/data/mysql/updatedatabase.pl | 39 +++++++++++++++++++ 3 files changed, 40 insertions(+), 39 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_26268.perl diff --git a/Koha.pm b/Koha.pm index be737b310f..f9e29d77f3 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.040"; +$VERSION = "20.06.00.041"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_26268.perl b/installer/data/mysql/atomicupdate/bug_26268.perl deleted file mode 100644 index b5291f6209..0000000000 --- a/installer/data/mysql/atomicupdate/bug_26268.perl +++ /dev/null @@ -1,38 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if ( CheckVersion($DBversion) ) { - - if ( column_exists( 'items', 'paidfor' ) ) { - my ($count) = $dbh->selectrow_array( - qq| - SELECT COUNT(*) - FROM items - WHERE paidfor IS NOT NULL AND paidfor <> "" - | - ); - if ($count) { - warn "Warning - Cannot remove column items.paidfor. At least one value exists"; - } - else { - $dbh->do(q|ALTER TABLE items DROP COLUMN paidfor|); - $dbh->do(q|UPDATE marc_subfield_structure SET kohafield = '' WHERE kohafield = 'items.paidfor'|); - } - } - - if ( column_exists( 'deleteditems', 'paidfor' ) ) { - my ($count) = $dbh->selectrow_array( - qq| - SELECT COUNT(*) - FROM deleteditems - WHERE paidfor IS NOT NULL AND paidfor <> "" - | - ); - if ($count) { - warn "Warning - Cannot remove column deleteditems.paidfor. At least one value exists"; - } - else { - $dbh->do(q|ALTER TABLE deleteditems DROP COLUMN paidfor|); - } - } - - NewVersion( $DBversion, 26268, "Remove items.paidfor field" ); -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index b9e6014582..dde423d3be 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -22817,6 +22817,45 @@ if( CheckVersion( $DBversion ) ) { NewVersion( $DBversion, 26454, "Add system preference to set meta description for the OPAC"); } +$DBversion = '20.06.00.041'; +if ( CheckVersion($DBversion) ) { + + if ( column_exists( 'items', 'paidfor' ) ) { + my ($count) = $dbh->selectrow_array( + q| + SELECT COUNT(*) + FROM items + WHERE paidfor IS NOT NULL AND paidfor <> "" + | + ); + if ($count) { + warn "Warning - Cannot remove column items.paidfor. At least one value exists"; + } + else { + $dbh->do(q|ALTER TABLE items DROP COLUMN paidfor|); + $dbh->do(q|UPDATE marc_subfield_structure SET kohafield = '' WHERE kohafield = 'items.paidfor'|); + } + } + + if ( column_exists( 'deleteditems', 'paidfor' ) ) { + my ($count) = $dbh->selectrow_array( + q| + SELECT COUNT(*) + FROM deleteditems + WHERE paidfor IS NOT NULL AND paidfor <> "" + | + ); + if ($count) { + warn "Warning - Cannot remove column deleteditems.paidfor. At least one value exists"; + } + else { + $dbh->do(q|ALTER TABLE deleteditems DROP COLUMN paidfor|); + } + } + + NewVersion( $DBversion, 26268, "Remove items.paidfor field" ); +} + # 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