worked on CRM-12012, delete case roles for all the client if deleted for one. also...
[civicrm-core.git] / CRM / Case / Page / AJAX.php
index 00c70611cd8ea9a77e28aabaf17f83d738d71a4f..860566625c395e89a4268682690cf51a322c2b69 100644 (file)
@@ -182,5 +182,18 @@ class CRM_Case_Page_AJAX {
     echo json_encode(TRUE);
     CRM_Utils_System::civiExit();
   }
+
+  /**
+   * Function to delete relationships specific to case and relationship type
+   */
+  static function deleteCaseRoles() {
+    $caseId  = CRM_Utils_Type::escape($_POST['case_id'], 'Integer');
+    $relType = CRM_Utils_Type::escape($_POST['rel_type'], 'Integer');
+
+    $sql = "DELETE FROM civicrm_relationship WHERE case_id={$caseId} AND relationship_type_id={$relType}";
+    CRM_Core_DAO::executeQuery($sql);
+
+    CRM_Utils_System::civiExit();
+  }
 }