From ad674e50997e1b379d72919638ff0c19917c74c6 Mon Sep 17 00:00:00 2001 From: yashodha Date: Wed, 29 May 2013 12:41:52 +0530 Subject: [PATCH] clean up (CRM-12697) --- CRM/Activity/BAO/Activity.php | 3 +-- CRM/Campaign/BAO/Petition.php | 10 +++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CRM/Activity/BAO/Activity.php b/CRM/Activity/BAO/Activity.php index f78618e636..dd54cfc8bb 100644 --- a/CRM/Activity/BAO/Activity.php +++ b/CRM/Activity/BAO/Activity.php @@ -122,8 +122,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { } $sourceContactId = self::getActivityContact($activity->id, $sourceID); - $defaults['source_contact_id'] = - $activity->source_contact_id = $sourceContactId; + $defaults['source_contact_id'] = $sourceContactId; if ($sourceContactId && !CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', diff --git a/CRM/Campaign/BAO/Petition.php b/CRM/Campaign/BAO/Petition.php index d14f926156..59790ce5d8 100644 --- a/CRM/Campaign/BAO/Petition.php +++ b/CRM/Campaign/BAO/Petition.php @@ -388,11 +388,12 @@ AND tag_id = ( SELECT id FROM civicrm_tag WHERE name = %2 )"; IFNULL(gender_id,'') AS gender_id, IFNULL(state_province_id,'') AS state_province_id, IFNULL(country_id,'') as country_id,IFNULL(iso_code,'') as country_iso, IFNULL(civicrm_country.name,'') as country - FROM civicrm_activity a, civicrm_survey, civicrm_contact + FROM (civicrm_activity a, civicrm_survey, civicrm_contact ) + LEFT JOIN civicrm_activity_contact ac ON ( ac.activity_id = a.id AND ac.record_type_id = %3 ) LEFT JOIN civicrm_address ON civicrm_address.contact_id = civicrm_contact.id AND civicrm_address.is_primary = 1 LEFT JOIN civicrm_country ON civicrm_address.country_id = civicrm_country.id WHERE - a.source_contact_id = civicrm_contact.id AND + ac.contact_id = civicrm_contact.id AND a.activity_type_id = civicrm_survey.activity_type_id AND civicrm_survey.id = %1 AND a.source_record_id = %1 "; @@ -405,6 +406,10 @@ AND tag_id = ( SELECT id FROM civicrm_tag WHERE name = %2 )"; } $sql .= " ORDER BY a.activity_date_time"; + $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); + $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); + $params[3] = array($sourceID, 'Integer'); + $fields = array( 'id', 'survey_id', 'contact_id', 'activity_date_time', 'activity_type_id', @@ -413,7 +418,6 @@ AND tag_id = ( SELECT id FROM civicrm_tag WHERE name = %2 )"; 'state_province_id', 'country_iso', 'country', ); - $dao = CRM_Core_DAO::executeQuery($sql, $params); while ($dao->fetch()) { $row = array(); -- 2.25.1