From ab9703d1daf06c6610fbb8708400dc34d3e995d4 Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 4 Sep 2018 12:09:16 +1200 Subject: [PATCH] Fix order by on is_primary. As pointed out in https://lab.civicrm.org/dev/mail/issues/26 the order by is not the correct format for order_by and has no effect. I tested to make sure it was not some magic. I opted for (implict) ASC as the order by for non sms is ASC and further down processing seems to overwrite each row as it happens so primary later would overwrite earlier --- CRM/Mailing/BAO/Mailing.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CRM/Mailing/BAO/Mailing.php b/CRM/Mailing/BAO/Mailing.php index e19f575baa6d..f81bcb1d057c 100644 --- a/CRM/Mailing/BAO/Mailing.php +++ b/CRM/Mailing/BAO/Mailing.php @@ -239,7 +239,7 @@ public static function getRecipients($mailingID) { 'phone_not_empty' => CRM_Utils_SQL_Select::fragment()->where("$entityTable.phone != ''"), 'mailing_id' => CRM_Utils_SQL_Select::fragment()->where("mg.mailing_id = #mailingID"), 'temp_contact_null' => CRM_Utils_SQL_Select::fragment()->where('temp.contact_id IS null'), - 'order_by' => CRM_Utils_SQL_Select::fragment()->orderBy("$entityTable.is_primary = 1"), + 'order_by' => CRM_Utils_SQL_Select::fragment()->orderBy("$entityTable.is_primary"), ); } else {