From fb2cd49b1a35946e42a62941a164696e4df27566 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Tue, 29 Oct 2024 13:14:54 +0000 Subject: [PATCH] Bug 36822: atomicupdate Fix any existing updated_on issues --- .../data/mysql/atomicupdate/bug_36822.pl | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_36822.pl diff --git a/installer/data/mysql/atomicupdate/bug_36822.pl b/installer/data/mysql/atomicupdate/bug_36822.pl new file mode 100755 index 0000000000..a6527d8eca --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_36822.pl @@ -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 ) ); + } + + }, +}; -- 2.39.5