From 0ee81947ec80232ef588b36bab4f5255d344ef52 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 21 Apr 2021 08:48:25 +0000 Subject: [PATCH] Bug 26940: DBRev 20.11.05.001 Signed-off-by: Jonathan Druart (cherry picked from commit adf73341e6883a80323695a4e85a2fd37bf7f53e) Signed-off-by: Fridolin Somers --- Koha.pm | 2 +- .../data/mysql/atomicupdate/bug_26940.perl | 22 ------------------ installer/data/mysql/updatedatabase.pl | 23 +++++++++++++++++++ 3 files changed, 24 insertions(+), 23 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_26940.perl diff --git a/Koha.pm b/Koha.pm index 35a745a179..bb3252e541 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.11.05.000"; +$VERSION = "20.11.05.001"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_26940.perl b/installer/data/mysql/atomicupdate/bug_26940.perl deleted file mode 100644 index 5a7999735c..0000000000 --- a/installer/data/mysql/atomicupdate/bug_26940.perl +++ /dev/null @@ -1,22 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - my $debar = $dbh->selectall_arrayref(q| - SELECT d.borrowernumber, GROUP_CONCAT(comment SEPARATOR '\n') AS comment - FROM borrower_debarments d - LEFT JOIN borrowers b ON b.borrowernumber=d.borrowernumber - WHERE ( b.debarredcomment IS NULL OR b.debarredcomment = "" ) AND ( expiration > CURRENT_DATE() OR expiration IS NULL ) - GROUP BY d.borrowernumber - |, { Slice => {} }); - - - my $update_sth = $dbh->prepare(q| - UPDATE borrowers - SET debarredcomment=? - WHERE borrowernumber=? - |); - for my $d ( @$debar ) { - $update_sth->execute($d->{comment}, $d->{borrowernumber}); - } - - NewVersion( $DBversion, 26940, "Put in sync borrowers.debarredcomment with comments from borrower_debarments"); -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 5dbe88d4d6..124426fe1f 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -23525,6 +23525,29 @@ if( CheckVersion( $DBversion ) ) { NewVersion( $DBversion, "", "Koha 20.11.05 release" ); } +$DBversion = '20.11.05.001'; +if( CheckVersion( $DBversion ) ) { + my $debar = $dbh->selectall_arrayref(q| + SELECT d.borrowernumber, GROUP_CONCAT(comment SEPARATOR '\n') AS comment + FROM borrower_debarments d + LEFT JOIN borrowers b ON b.borrowernumber=d.borrowernumber + WHERE ( b.debarredcomment IS NULL OR b.debarredcomment = "" ) AND ( expiration > CURRENT_DATE() OR expiration IS NULL ) + GROUP BY d.borrowernumber + |, { Slice => {} }); + + + my $update_sth = $dbh->prepare(q| + UPDATE borrowers + SET debarredcomment=? + WHERE borrowernumber=? + |); + for my $d ( @$debar ) { + $update_sth->execute($d->{comment}, $d->{borrowernumber}); + } + + NewVersion( $DBversion, 26940, "Put in sync borrowers.debarredcomment with comments from borrower_debarments"); +} + # 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