Example #1
0
 /**
  * Returns the list of fields that can be exported
  *
  * @param bool $prefix
  *
  * @return array
  */
 static function &export($prefix = false)
 {
     if (!self::$_export) {
         self::$_export = array();
         $fields = self::fields();
         foreach ($fields as $name => $field) {
             if (CRM_Utils_Array::value('export', $field)) {
                 if ($prefix) {
                     self::$_export['case_type'] =& $fields[$name];
                 } else {
                     self::$_export[$name] =& $fields[$name];
                 }
             }
         }
     }
     return self::$_export;
 }
Example #2
0
 /**
  * @param int $caseTypeId
  *
  * @throws CRM_Core_Exception
  * @return mixed
  */
 public static function del($caseTypeId)
 {
     $caseType = new CRM_Case_DAO_CaseType();
     $caseType->id = $caseTypeId;
     $refCounts = $caseType->getReferenceCounts();
     $total = array_sum(CRM_Utils_Array::collect('count', $refCounts));
     if ($total) {
         throw new CRM_Core_Exception(ts("You can not delete this case type -- it is assigned to %1 existing case record(s). If you do not want this case type to be used going forward, consider disabling it instead.", array(1 => $total)));
     }
     $result = $caseType->delete();
     CRM_Case_XMLRepository::singleton(TRUE);
     return $result;
 }