Merge pull request #2223 from lcdservices/CRM-13995
[civicrm-core.git] / CRM / Case / Page / AJAX.php
index 00c70611cd8ea9a77e28aabaf17f83d738d71a4f..968a570c659970dd6326d40f74b637da0f0a822e 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.4                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2013                                |
  +--------------------------------------------------------------------+
@@ -134,7 +134,7 @@ class CRM_Case_Page_AJAX {
       $caseStatuses = CRM_Case_PseudoConstant::caseStatus();
       $cs           = $caseStatuses[$dao->status_id];
       $caseDetails  = "<table><tr><td>" . ts('Case Subject') . "</td><td>{$dao->subject}</td></tr>
-                                    <tr><td>" . ts('Case Type') . "</td><td>{$caseType}</td></tr> 
+                                    <tr><td>" . ts('Case Type') . "</td><td>{$caseType}</td></tr>
                                     <tr><td>" . ts('Case Status') . "</td><td>{$cs}</td></tr>
                                     <tr><td>" . ts('Case Start Date') . "</td><td>" . CRM_Utils_Date::customFormat($dao->start_date) . "</td></tr>
                                     <tr><td>" . ts('Case End Date') . "</td><td></td></tr>" . CRM_Utils_Date::customFormat($dao->end_date) . "</table>";
@@ -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();
+  }
 }