Bug 26940: Put in sync borrowers.debarredcomment with comments from borrower_debarment
Signed-off-by: Katariina Hanhisalo <katariina.hanhisalo@xamk.fi> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
3b9f1e1560
commit
c309ee36dd
1 changed files with 22 additions and 0 deletions
22
installer/data/mysql/atomicupdate/bug_26940.perl
Normal file
22
installer/data/mysql/atomicupdate/bug_26940.perl
Normal file
|
@ -0,0 +1,22 @@
|
|||
$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 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");
|
||||
}
|
Loading…
Reference in a new issue