CRM-16814: Scheduled Activity on a second case is deleted when the open date on the...
authoryashodha <yashodha.chaku@webaccessglobal.com>
Fri, 10 Jul 2015 09:57:44 +0000 (15:27 +0530)
committeryashodha <yashodha.chaku@webaccessglobal.com>
Fri, 10 Jul 2015 09:57:44 +0000 (15:27 +0530)
----------------------------------------
* CRM-16814: Scheduled Activity on a second case is deleted when the open date on the first case is changed
  https://issues.civicrm.org/jira/browse/CRM-16814

CRM/Case/XMLProcessor/Process.php

index 9276c2938df2a679f60ce89a370caad3032a4a07..e1a939532d132332736a5dffa70166301105a9bd 100644 (file)
@@ -368,12 +368,14 @@ class CRM_Case_XMLProcessor_Process extends CRM_Case_XMLProcessor {
 DELETE a
 FROM   civicrm_activity a
 INNER JOIN civicrm_activity_contact t ON t.activity_id = a.id
+INNER JOIN civicrm_case_activity ca on ca.activity_id = a.id
 WHERE  t.contact_id = %1
 AND    t.record_type_id = $targetID
 AND    a.is_auto = 1
 AND    a.is_current_revision = 1
+AND    ca.case_id = %2
 ";
-    $sqlParams = array(1 => array($params['clientID'], 'Integer'));
+    $sqlParams = array(1 => array($params['clientID'], 'Integer'), 2 => array($params['caseID'], 'Integer'));
     CRM_Core_DAO::executeQuery($query, $sqlParams);
   }