From d068e84b74b7903ff474e0b573891aaa030fb4bb Mon Sep 17 00:00:00 2001 From: Brian Shaughnessy Date: Tue, 30 Jul 2019 17:26:04 -0400 Subject: [PATCH] dev/core#1158 mailing labels: explicitly set primary flag --- CRM/Contact/Form/Task/Label.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CRM/Contact/Form/Task/Label.php b/CRM/Contact/Form/Task/Label.php index 674d1d1ad3..b2987b58db 100644 --- a/CRM/Contact/Form/Task/Label.php +++ b/CRM/Contact/Form/Task/Label.php @@ -179,9 +179,11 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task { $location = ['location' => ["{$locName}" => $address]]; $returnProperties = array_merge($returnProperties, $location); $params[] = ['location_type', '=', [1 => $fv['location_type_id']], 0, 0]; + $primaryLocationOnly = FALSE; } else { $returnProperties = array_merge($returnProperties, $address); + $primaryLocationOnly = TRUE; } $rows = []; @@ -214,7 +216,7 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task { //get the total number of contacts to fetch from database. $numberofContacts = count($this->_contactIds); $query = new CRM_Contact_BAO_Query($params, $returnProperties); - $details = $query->apiQuery($params, $returnProperties, NULL, NULL, 0, $numberofContacts); + $details = $query->apiQuery($params, $returnProperties, NULL, NULL, 0, $numberofContacts, TRUE, FALSE, TRUE, CRM_Contact_BAO_Query::MODE_CONTACTS, NULL, $primaryLocationOnly); $messageToken = CRM_Utils_Token::getTokens($mailingFormat); -- 2.25.1