Bug 26940: DBRev 20.05.11.001

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
This commit is contained in:
Andrew Fuerste-Henry 2021-05-24 15:39:09 +00:00
parent cd3102557b
commit b532cd2cf8
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.05.11.000";
$VERSION = "20.05.11.001";
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

@ -22595,6 +22595,29 @@ if ( CheckVersion($DBversion) ) {
SetVersion ($DBversion);
}
$DBversion = '20.05.11.001'; # 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");
}
# 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/';