CRM-12274
authoryashodha <yashodha.chaku@webaccess.co.in>
Thu, 11 Apr 2013 21:46:28 +0000 (03:16 +0530)
committeryashodha <yashodha.chaku@webaccess.co.in>
Thu, 11 Apr 2013 21:46:59 +0000 (03:16 +0530)
CRM/Report/Form/Campaign/SurveyDetails.php
CRM/Utils/Migrate/ExportJSON.php

index 172b3f18321de792191e4a7ea4149b3619681541..4a55247257540fbe28e56cad1baf54bc11005366 100644 (file)
@@ -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";
index 0a4c64fb3d49ae34f2813de6d51fe8318e2f39df..72f2cd0e2d6f26af48783a863652526396b02106 100644 (file)
@@ -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(