Bugzilla – Attachment 114768 Details for
Bug 27276
borrowers-force-messaging-defaults throws Incorrect DATE value: '0000-00-00' even though sql strict mode is dissabled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27276: Prevent borrowers-force-messaging-defaults.pl to crash
Bug-27276-Prevent-borrowers-force-messaging-defaul.patch (text/plain), 1.84 KB, created by
Chris Cormack
on 2021-01-03 01:43:17 UTC
(
hide
)
Description:
Bug 27276: Prevent borrowers-force-messaging-defaults.pl to crash
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2021-01-03 01:43:17 UTC
Size:
1.84 KB
patch
obsolete
>From 984b05329d8e6d1c439b4832fb6217f4eaca7bbc Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 18 Dec 2020 14:28:13 +0100 >Subject: [PATCH] Bug 27276: Prevent borrowers-force-messaging-defaults.pl to > crash > >MySQL 5.7 does not allow queries using 0000-00-00 > >Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> >--- > misc/maintenance/borrowers-force-messaging-defaults.pl | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > >diff --git a/misc/maintenance/borrowers-force-messaging-defaults.pl b/misc/maintenance/borrowers-force-messaging-defaults.pl >index c446ca0f1c..c9a1ef727f 100755 >--- a/misc/maintenance/borrowers-force-messaging-defaults.pl >+++ b/misc/maintenance/borrowers-force-messaging-defaults.pl >@@ -42,8 +42,7 @@ sub usage { > sub force_borrower_messaging_defaults { > my ($doit, $since, $not_expired, $no_overwrite, $category ) = @_; > >- $since = '0000-00-00' if (!$since); >- print "Since: $since\n"; >+ print "Since: $since\n" if $since; > > my $dbh = C4::Context->dbh; > $dbh->{AutoCommit} = 0; >@@ -51,7 +50,10 @@ sub force_borrower_messaging_defaults { > my $sql = > q|SELECT DISTINCT bo.borrowernumber, bo.categorycode FROM borrowers bo > LEFT JOIN borrower_message_preferences mp USING (borrowernumber) >-WHERE bo.dateenrolled >= ?|; >+WHERE 1| >+ if ( $since ) { >+ $sql .= " AND bo.dateenrolled >= ?"; >+ } > if ($not_expired) { > $sql .= " AND bo.dateexpiry >= NOW()" > } >@@ -60,7 +62,7 @@ WHERE bo.dateenrolled >= ?|; > } > $sql .= " AND bo.categorycode = ?" if $category; > my $sth = $dbh->prepare($sql); >- $sth->execute($since, $category || () ); >+ $sth->execute($since || (), $category || () ); > my $cnt = 0; > while ( my ($borrowernumber, $categorycode) = $sth->fetchrow ) { > print "$borrowernumber: $categorycode\n"; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27276
:
114520
|
114768
|
114780
|
114781