Bugzilla – Attachment 71440 Details for
Bug 20144
Test suite is failing with new default SQL modes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20144: [sql_modes] Remove HAVING clause in GetBorrowersToExpunge
Bug-20144-sqlmodes-Remove-HAVING-clause-in-GetBorr.patch (text/plain), 2.88 KB, created by
Julian Maurice
on 2018-02-12 11:15:07 UTC
(
hide
)
Description:
Bug 20144: [sql_modes] Remove HAVING clause in GetBorrowersToExpunge
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2018-02-12 11:15:07 UTC
Size:
2.88 KB
patch
obsolete
>From 3b5a253c208a572c7a7b03fa9adb1cc7e548d94e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 5 Feb 2018 19:10:34 -0300 >Subject: [PATCH] Bug 20144: [sql_modes] Remove HAVING clause in > GetBorrowersToExpunge > >Special attention needed here! > >Fix for: >Non-grouping field 'currentissue' is used in HAVING clause > >t/db_dependent/Members.t > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> >--- > C4/Members.pm | 35 ++++++++++++++++++++--------------- > 1 file changed, 20 insertions(+), 15 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index 2729d360e5..90ebb54afe 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -907,25 +907,27 @@ sub GetBorrowersToExpunge { > > my $dbh = C4::Context->dbh; > my $query = q| >- SELECT borrowers.borrowernumber, >- MAX(old_issues.timestamp) AS latestissue, >- MAX(issues.timestamp) AS currentissue >- FROM borrowers >- JOIN categories USING (categorycode) >- LEFT JOIN ( >- SELECT guarantorid >- FROM borrowers >- WHERE guarantorid IS NOT NULL >- AND guarantorid <> 0 >- ) as tmp ON borrowers.borrowernumber=tmp.guarantorid >- LEFT JOIN old_issues USING (borrowernumber) >- LEFT JOIN issues USING (borrowernumber)|; >+ SELECT * >+ FROM ( >+ SELECT borrowers.borrowernumber, >+ MAX(old_issues.timestamp) AS latestissue, >+ MAX(issues.timestamp) AS currentissue >+ FROM borrowers >+ JOIN categories USING (categorycode) >+ LEFT JOIN ( >+ SELECT guarantorid >+ FROM borrowers >+ WHERE guarantorid IS NOT NULL >+ AND guarantorid <> 0 >+ ) as tmp ON borrowers.borrowernumber=tmp.guarantorid >+ LEFT JOIN old_issues USING (borrowernumber) >+ LEFT JOIN issues USING (borrowernumber)|; > if ( $filterpatronlist ){ > $query .= q| LEFT JOIN patron_list_patrons USING (borrowernumber)|; > } > $query .= q| WHERE category_type <> 'S' > AND tmp.guarantorid IS NULL >- |; >+ |; > my @query_params; > if ( $filterbranch && $filterbranch ne "" ) { > $query.= " AND borrowers.branchcode = ? "; >@@ -947,11 +949,14 @@ sub GetBorrowersToExpunge { > $query.=" AND patron_list_id = ? "; > push( @query_params, $filterpatronlist ); > } >- $query.=" GROUP BY borrowers.borrowernumber HAVING currentissue IS NULL "; >+ $query .= " GROUP BY borrowers.borrowernumber"; >+ $query .= q| >+ ) xxx WHERE currentissue IS NULL|; > if ( $filterdate ) { > $query.=" AND ( latestissue < ? OR latestissue IS NULL ) "; > push @query_params,$filterdate; > } >+ > warn $query if $debug; > > my $sth = $dbh->prepare($query); >-- >2.14.2
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 20144
:
71410
|
71411
|
71412
|
71413
|
71414
|
71415
|
71416
|
71417
|
71418
|
71419
|
71420
|
71421
|
71422
|
71423
|
71424
|
71425
|
71427
|
71428
|
71429
|
71430
|
71431
|
71432
|
71434
|
71435
|
71436
|
71437
|
71438
| 71440 |
71441
|
71442
|
71443
|
71444
|
71445
|
71446
|
71447
|
71448
|
71449
|
71450
|
71451
|
71452
|
71453
|
71454
|
71455
|
71456
|
71457
|
71458
|
71459
|
71460
|
71461
|
71462
|
71463
|
71467
|
71564