From e9411afa61d310b34b3507131f172099524fba22 Mon Sep 17 00:00:00 2001 From: eileen Date: Sat, 3 Oct 2020 09:13:04 +1300 Subject: [PATCH] dev/core#2079 [REF] clean up call to apiQuery This fixes a few things 1) fixes apiQuery to be called statically as it is a static function 2) casts results directly to detail 3) removes unnused variable --- CRM/Contact/Form/Task/LabelCommon.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/CRM/Contact/Form/Task/LabelCommon.php b/CRM/Contact/Form/Task/LabelCommon.php index c0c561ff2648..8265c5a4e125 100644 --- a/CRM/Contact/Form/Task/LabelCommon.php +++ b/CRM/Contact/Form/Task/LabelCommon.php @@ -136,12 +136,9 @@ public static function getRows($contactIDs, $locationTypeID, $respectDoNotMail, $numberofContacts = count($contactIDs); //this does the same as calling civicrm_api3('contact, get, array('id' => array('IN' => $this->_contactIds) // except it also handles multiple locations - $query = new CRM_Contact_BAO_Query($params, $returnProperties); - $details = $query->apiQuery($params, $returnProperties, NULL, NULL, 0, $numberofContacts); + [$details] = CRM_Contact_BAO_Query::apiQuery($params, $returnProperties, NULL, NULL, 0, $numberofContacts); - $messageToken = CRM_Utils_Token::getTokens($mailingFormat); - // $details[0] is an array of [ contactID => contactDetails ] - $details = $details[0]; + // $details is an array of [ contactID => contactDetails ] $tokenFields = CRM_Contact_Form_Task_LabelCommon::getTokenData($details); foreach ($contactIDs as $value) {