Bugzilla – Attachment 71367 Details for
Bug 19451
Let borrowers-force-messaging-defaults.pl optionally add preferences only when not already present
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19451: (QA follow-up) Replace weird subquery
Bug-19451-QA-follow-up-Replace-weird-subquery.patch (text/plain), 1.60 KB, created by
Marcel de Rooy
on 2018-02-09 11:04:55 UTC
(
hide
)
Description:
Bug 19451: (QA follow-up) Replace weird subquery
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2018-02-09 11:04:55 UTC
Size:
1.60 KB
patch
obsolete
>From 5b583dc1857a41ebe63f2a8a3cbec8526380a3d7 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 9 Feb 2018 11:47:52 +0100 >Subject: [PATCH] Bug 19451: (QA follow-up) Replace weird subquery >Content-Type: text/plain; charset=utf-8 > >As requested, we add a JOIN and make the SELECT distinct. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Tested that no-overwrite still works as expected. >--- > misc/maintenance/borrowers-force-messaging-defaults.pl | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > >diff --git a/misc/maintenance/borrowers-force-messaging-defaults.pl b/misc/maintenance/borrowers-force-messaging-defaults.pl >index 2daa8b7..72e8c95 100755 >--- a/misc/maintenance/borrowers-force-messaging-defaults.pl >+++ b/misc/maintenance/borrowers-force-messaging-defaults.pl >@@ -54,12 +54,15 @@ sub force_borrower_messaging_defaults { > $dbh->do(q|SET FOREIGN_KEY_CHECKS = 1|); > } > >- my $sql = "SELECT borrowernumber, categorycode FROM borrowers bo WHERE dateenrolled >= ?"; >+ my $sql = >+q|SELECT DISTINCT bo.borrowernumber, bo.categorycode FROM borrowers bo >+LEFT JOIN borrower_message_preferences mp USING (borrowernumber) >+WHERE bo.dateenrolled >= ?|; > if ($not_expired) { >- $sql .= " AND dateexpiry >= NOW()" >+ $sql .= " AND bo.dateexpiry >= NOW()" > } > if( $no_overwrite ) { >- $sql .= " AND (SELECT COUNT(*) FROM borrower_message_preferences mp WHERE mp.borrowernumber=bo.borrowernumber) = 0" >+ $sql .= " AND mp.borrowernumber IS NULL"; > } > my $sth = $dbh->prepare($sql); > $sth->execute($since); >-- >2.1.4
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 19451
:
67989
|
68200
|
68844
|
71327
|
71328
| 71367