|
Lines 1-5
Link Here
|
| 1 |
use Modern::Perl; |
1 |
use Modern::Perl; |
| 2 |
use Koha::Installer::Output qw(say_warning say_success say_info); |
2 |
use Koha::Installer::Output qw(say_warning say_success say_info); |
|
|
3 |
use Try::Tiny qw( catch try ); |
| 3 |
|
4 |
|
| 4 |
return { |
5 |
return { |
| 5 |
bug_number => "36822", |
6 |
bug_number => "36822", |
|
Lines 8-28
return {
Link Here
|
| 8 |
my ($args) = @_; |
9 |
my ($args) = @_; |
| 9 |
my ( $dbh, $out ) = @$args{qw(dbh out)}; |
10 |
my ( $dbh, $out ) = @$args{qw(dbh out)}; |
| 10 |
|
11 |
|
| 11 |
my $sth = $dbh->prepare( |
12 |
try { |
| 12 |
q{ |
13 |
my $sth = $dbh->prepare( |
| 13 |
SELECT borrowernumber |
14 |
q{ |
| 14 |
FROM borrowers |
15 |
SELECT borrowernumber |
| 15 |
WHERE updated_on = '0000-00-00 00:00:00' |
16 |
FROM borrowers |
| 16 |
} |
17 |
WHERE updated_on = '0000-00-00 00:00:00' |
| 17 |
); |
18 |
} |
| 18 |
$sth->execute; |
19 |
); |
| 19 |
my $results = $sth->fetchall_arrayref( {} ); |
20 |
$sth->execute; |
| 20 |
|
21 |
my $results = $sth->fetchall_arrayref( {} ); |
| 21 |
if (@$results) { |
22 |
if (@$results) { |
| 22 |
sanitize_zero_date( 'borrowers', 'updated_on' ); |
23 |
sanitize_zero_date( 'borrowers', 'updated_on' ); |
| 23 |
say_info( $out, "The following borrowers' updated_on has been sanitized: " |
24 |
say_info( $out, "The following borrowers' updated_on has been sanitized: " |
| 24 |
. join( ', ', map { $_->{borrowernumber} } @$results ) ); |
25 |
. join( ', ', map { $_->{borrowernumber} } @$results ) ); |
| 25 |
} |
26 |
} |
| 26 |
|
27 |
} catch { |
|
|
28 |
say_warning( $out, "Unable to sanitize borrowers.updated_on, you may want to check for 0000-00-00 dates" ); |
| 29 |
}; |
| 27 |
}, |
30 |
}, |
| 28 |
}; |
31 |
}; |
| 29 |
- |
|
|