From adf73341e6883a80323695a4e85a2fd37bf7f53e 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.12.00.033 Signed-off-by: Jonathan Druart --- 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 820bf50126..231f2b68a5 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.12.00.032"; +$VERSION = "20.12.00.033"; 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 754a3d068b..ffbe0bb100 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -23828,6 +23828,29 @@ if( CheckVersion( $DBversion ) ) { NewVersion( $DBversion, 15986, "Add sample HOLD_REMINDER notice"); } +$DBversion = '20.12.00.033'; +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