From cba8728a4b6ecca627347197e6437f5fb57b5bef Mon Sep 17 00:00:00 2001 From: yashodha Date: Fri, 12 Apr 2013 03:16:28 +0530 Subject: [PATCH] CRM-12274 --- CRM/Report/Form/Campaign/SurveyDetails.php | 7 ++++--- CRM/Utils/Migrate/ExportJSON.php | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CRM/Report/Form/Campaign/SurveyDetails.php b/CRM/Report/Form/Campaign/SurveyDetails.php index 172b3f1832..4a55247257 100644 --- a/CRM/Report/Form/Campaign/SurveyDetails.php +++ b/CRM/Report/Form/Campaign/SurveyDetails.php @@ -47,8 +47,9 @@ class CRM_Report_Form_Campaign_SurveyDetails extends CRM_Report_Form { protected $_customGroupExtends = array('Contact', 'Individual', 'Household', 'Organization', 'Activity'); public $_drilldownReport = array('contact/detail' => 'Link to Detail Report'); - private static $_surveyRespondentStatus; function __construct() { + private static $_surveyRespondentStatus; + function __construct() { //filter options for survey activity status. $responseStatus = array('' => '- Any -'); self::$_surveyRespondentStatus = array(); @@ -314,9 +315,9 @@ class CRM_Report_Form_Campaign_SurveyDetails extends CRM_Report_Form { $this->_from = " FROM civicrm_contact {$this->_aliases['civicrm_contact']} {$this->_aclFrom} "; //get the activity table joins. - $this->_from .= " INNER JOIN civicrm_activity_target ON ( {$this->_aliases['civicrm_contact']}.id = civicrm_activity_target.target_contact_id )\n"; + $this->_from .= " INNER JOIN civicrm_activity_contact civicrm_activity_target ON ( {$this->_aliases['civicrm_contact']}.id = civicrm_activity_target.contact_id AND civicrm_activity_target.record_type = 'Target') \n"; $this->_from .= " INNER JOIN civicrm_activity {$this->_aliases['civicrm_activity']} ON ( {$this->_aliases['civicrm_activity']}.id = civicrm_activity_target.activity_id )\n"; - $this->_from .= " INNER JOIN civicrm_activity_assignment {$this->_aliases['civicrm_activity_assignment']} ON ( {$this->_aliases['civicrm_activity']}.id = {$this->_aliases['civicrm_activity_assignment']}.activity_id )\n"; + $this->_from .= " INNER JOIN civicrm_activity_contact civicrm_activity_assignment ON ( {$this->_aliases['civicrm_activity']}.id = civicrm_activity_assignment.activity_id AND civicrm_activity_assignment.record_type = 'Assignee' )\n"; //get the address table. $this->_from .= " LEFT JOIN civicrm_address {$this->_aliases['civicrm_address']} ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_address']}.contact_id AND {$this->_aliases['civicrm_address']}.is_primary = 1\n"; diff --git a/CRM/Utils/Migrate/ExportJSON.php b/CRM/Utils/Migrate/ExportJSON.php index 0a4c64fb3d..72f2cd0e2d 100644 --- a/CRM/Utils/Migrate/ExportJSON.php +++ b/CRM/Utils/Migrate/ExportJSON.php @@ -426,7 +426,7 @@ AND entity_table = 'civicrm_contact' $activityIDString = implode(",", $activityIDs); // now get all assignee contact ids and target contact ids for this activity - $sql = "SELECT * FROM civicrm_activity_assignment WHERE activity_id IN ($activityIDString)"; + $sql = "SELECT * FROM civicrm_activity_contact WHERE activity_id IN ($activityIDString) AND record_type = 'Assignee'"; $aaDAO = &CRM_Core_DAO::executeQuery($sql); $activityContacts = array(); while ($aaDAO->fetch()) { @@ -440,7 +440,7 @@ AND entity_table = 'civicrm_contact' } $aaDAO->free(); - $sql = "SELECT * FROM civicrm_activity_target WHERE activity_id IN ($activityIDString)"; + $sql = "SELECT * FROM civicrm_activity_contact WHERE activity_id IN ($activityIDString) AND record_type = 'Target'"; $atDAO = &CRM_Core_DAO::executeQuery($sql); while ($atDAO->fetch()) { $activityTarget = array( -- 2.25.1