Bug 26940: DBRev 20.12.00.033

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2021-04-21 08:48:25 +00:00
parent 789ddd59c9
commit adf73341e6
3 changed files with 24 additions and 23 deletions

View File

@ -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;

View File

@ -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");
}

View File

@ -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/';