Bug 36822: atomicupdate
Fix any existing updated_on issues
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 473f918ba8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
bc5556acd3
commit
4c15fb996d
|
|
@ -0,0 +1,28 @@
|
|||
use Modern::Perl;
|
||||
use Koha::Installer::Output qw(say_warning say_failure say_success say_info);
|
||||
|
||||
return {
|
||||
bug_number => "36822",
|
||||
description => "Sanitize borrowers.updated_on",
|
||||
up => sub {
|
||||
my ($args) = @_;
|
||||
my ( $dbh, $out ) = @$args{qw(dbh out)};
|
||||
|
||||
my $sth = $dbh->prepare(
|
||||
q{
|
||||
SELECT borrowernumber
|
||||
FROM borrowers
|
||||
WHERE updated_on = '0000-00-00 00:00:00'
|
||||
}
|
||||
);
|
||||
$sth->execute;
|
||||
my $results = $sth->fetchall_arrayref( {} );
|
||||
|
||||
if (@$results) {
|
||||
sanitize_zero_date( 'borrowers', 'updated_on' );
|
||||
say_info( $out, "The following borrowers' updated_on has been sanitized: "
|
||||
. join( ', ', map { $_->{borrowernumber} } @$results ) );
|
||||
}
|
||||
|
||||
},
|
||||
};
|
||||
Loading…
Reference in New Issue