static function &getFields() { $fields = array(); require_once 'CRM/Case/DAO/Case.php'; $fields = array_merge($fields, CRM_Case_DAO_Case::import()); return $fields; }
/** * Implementation of hook_civicrm_uninstall */ function hrcaseutils_civicrm_uninstall() { //delete all activity type CRM_Core_DAO::executeQuery("DELETE FROM civicrm_option_value WHERE name IN ('Interview Prospect', 'Background_Check', 'ID badge')"); $caseTypes = CRM_Case_PseudoConstant::caseType('name', FALSE); $value = array_search('Hrdata', $caseTypes); //Delete cases and related contact of type Hrdata on uninstall if ($value) { $caseDAO = new CRM_Case_DAO_Case(); $caseDAO->case_type_id = $value; $caseDAO->find(); while ($caseDAO->fetch()) { CRM_Case_BAO_Case::deleteCase($caseDAO->id); } } return _hrcaseutils_civix_civicrm_uninstall(); }
/** * Restore the record that are associated with this case * * @param int $caseId id of the case to restore * * @return true if success. * @access public * @static */ static function restoreCase($caseId) { //restore activities $activities = self::getCaseActivityDates($caseId); if ($activities) { foreach ($activities as $value) { CRM_Activity_BAO_Activity::restoreActivity($value); } } //restore case $case = new CRM_Case_DAO_Case(); $case->id = $caseId; $case->is_deleted = 0; $case->save(); //CRM-7364, enable relationships self::enableDisableCaseRelationships($caseId, TRUE); return TRUE; }
function &caseInfo($clientID, $caseID) { $case = $this->_redactionRegexRules = array(); if (empty($this->_redactionStringRules)) { $this->_redactionStringRules = array(); } if ($this->_isRedact == 1) { $this->getRedactionRules(); } $client = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $clientID, 'display_name'); // add Client to the strings to be redacted across the case session if (!array_key_exists($client, $this->_redactionStringRules)) { $this->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($this->_redactionStringRules, array($client => 'name_' . rand(10000, 100000))); $clientSortName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $clientID, 'sort_name'); if (!array_key_exists($clientSortName, $this->_redactionStringRules)) { $this->_redactionStringRules[$clientSortName] = $this->_redactionStringRules[$client]; } } $case['clientName'] = $this->redact($client); $dao = new CRM_Case_DAO_Case(); $dao->id = $caseID; if ($dao->find(TRUE)) { $case['subject'] = $dao->subject; $case['start_date'] = $dao->start_date; $case['end_date'] = $dao->end_date; // FIXME: when we resolve if case_type_is single or multi-select if (strpos($dao->case_type_id, CRM_Core_DAO::VALUE_SEPARATOR) !== FALSE) { $caseTypeID = substr($dao->case_type_id, 1, -1); } else { $caseTypeID = $dao->case_type_id; } $caseTypeIDs = explode(CRM_Core_DAO::VALUE_SEPARATOR, $dao->case_type_id); $case['caseType'] = CRM_Case_BAO_Case::getCaseType($caseID); $case['caseTypeName'] = CRM_Case_BAO_Case::getCaseType($caseID, 'name'); $case['status'] = CRM_Core_OptionGroup::getLabel('case_status', $dao->status_id, FALSE); } return $case; }
/** * 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'] =& $fields[$name]; } else { self::$_export[$name] =& $fields[$name]; } } } } return self::$_export; }
/** * combine all the exportable fields from the lower levels object * * @return array array of exportable Fields * @access public */ function &exportableFields() { if (!self::$_exportableFields) { if (!self::$_exportableFields) { self::$_exportableFields = array(); } require_once 'CRM/Case/DAO/Case.php'; $fields = CRM_Case_DAO_Case::import(); $fields['case_role'] = array('title' => ts('Role in Case')); self::$_exportableFields = $fields; } return self::$_exportableFields; }
function __construct() { parent::__construct(); }
/** * Implementation of hook_civicrm_uninstall */ function hrcase_civicrm_uninstall() { //update query to replace Assignment with Case $optionGroupID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'activity_type', 'id', 'name'); $sql = "UPDATE civicrm_option_value SET label= replace(label, 'Assignment', 'Case') WHERE label like '%Assignment%' and option_group_id={$optionGroupID} and label <> 'New Assignment Created'"; CRM_Core_DAO::executeQuery($sql); $sql = "UPDATE civicrm_option_value SET label= replace(label, 'Created New Assignment', 'Open Case') WHERE option_group_id={$optionGroupID}"; CRM_Core_DAO::executeQuery($sql); $scheduleActions = hrcase_getActionsSchedule(TRUE); $scheduleAction = implode("','", $scheduleActions); CRM_Core_DAO::executeQuery("DELETE FROM civicrm_action_schedule WHERE name IN ('{$scheduleAction}')"); $sql = "DELETE FROM civicrm_option_value WHERE name IN ('Issue appointment letter','Fill Employee Details Form','Submission of ID/Residence proofs and photos','Program and work induction by program supervisor','Enter employee data in CiviHR','Group Orientation to organization values policies','Probation appraisal','Conduct appraisal','Collection of appraisal paperwork','Issue confirmation/warning letter','Get \"No Dues\" certification','Conduct Exit interview','Revoke access to databases','Block work email ID','Follow up on progress','Collection of Appraisal forms','Issue extension letter','Schedule joining date','Group Orientation to organization, values, policies','Probation appraisal (start probation workflow)','Schedule Exit Interview','Prepare formats','Print formats','Collate and print goals','References Check','Prepare and email schedule')"; CRM_Core_DAO::executeQuery($sql); hrcase_example_caseType(TRUE); //delete custom group and custom field foreach (array('Joining_Data', 'Exiting_Data') as $cgName) { $customGroup = civicrm_api3('CustomGroup', 'getsingle', array('return' => "id", 'name' => $cgName)); civicrm_api3('CustomGroup', 'delete', array('id' => $customGroup['id'])); } $isEnabled = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Extension', 'org.civicrm.hrrecruitment', 'is_active', 'full_name'); if (!$isEnabled) { CRM_Core_DAO::executeQuery("DELETE FROM `civicrm_relationship_type` WHERE name_b_a IN ('Recruiting Manager')"); } //Delete cases and related contact on uninstall $caseTypes = CRM_Case_PseudoConstant::caseType('name', FALSE); $cases = array('Joining', 'Exiting', 'Probation', 'Appraisal'); foreach ($caseTypes as $caseTypeKey => $caseType) { if (in_array($caseType, $cases)) { $caseDAO = new CRM_Case_DAO_Case(); $caseDAO->case_type_id = $caseTypeKey; $caseDAO->find(); while ($caseDAO->fetch()) { CRM_Case_BAO_Case::deleteCase($caseDAO->id); } } } return _hrcase_civix_civicrm_uninstall(); }
/** * Implementation of hook_civicrm_uninstall */ function hrrecruitment_civicrm_uninstall() { $vacanciesId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Navigation', 'Vacancies', 'id', 'name'); CRM_Core_BAO_Navigation::processDelete($vacanciesId); CRM_Core_BAO_Navigation::resetNavigation(); CRM_Core_DAO::executeQuery("DELETE FROM civicrm_option_group WHERE name IN ('vacancy_status', 'work_experience', 'rate_the_applicant_s_communicati', 'rate_the_applicant_s_technical_s', 'languages_known')"); $caseTypes = CRM_Case_PseudoConstant::caseType('name', FALSE); $value = array_search('Application', $caseTypes); //Delete cases and related contact of type Application on uninstall if ($value) { $caseDAO = new CRM_Case_DAO_Case(); $caseDAO->case_type_id = $value; $caseDAO->find(); while ($caseDAO->fetch()) { CRM_Case_BAO_Case::deleteCase($caseDAO->id); } } $CaseStatuses = CRM_Core_OptionGroup::values('case_status', FALSE, FALSE, FALSE, " AND grouping = 'Vacancy'", 'id', FALSE); $CaseStatus = implode(',', $CaseStatuses); CRM_Core_DAO::executeQuery("DELETE FROM civicrm_option_value WHERE id IN ({$CaseStatus}) OR name IN ('Evaluation', 'Comment')"); foreach (array('application_profile', 'evaluation_profile') as $name) { $ufID = civicrm_api3('UFGroup', 'getsingle', array('return' => "id", 'name' => $name)); civicrm_api3('UFGroup', 'delete', array('id' => $ufID['id'])); } foreach (array('Application', 'application_case', 'Evaluation_fields') as $cgName) { $customGroup = civicrm_api3('CustomGroup', 'getsingle', array('return' => "id", 'name' => $cgName)); civicrm_api3('CustomGroup', 'delete', array('id' => $customGroup['id'])); } $isEnabled = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Extension', 'org.civicrm.hrcase', 'is_active', 'full_name'); if (!$isEnabled) { CRM_Core_DAO::executeQuery("DELETE FROM `civicrm_relationship_type` WHERE name_b_a IN ('Recruiting Manager')"); } return _hrrecruitment_civix_civicrm_uninstall(); }
function &caseInfo($clientID, $caseID) { require_once "CRM/Case/PseudoConstant.php"; $case = $this->_redactionRegexRules = array(); if (empty($this->_redactionStringRules)) { $this->_redactionStringRules = array(); } if ($this->_isRedact == 1) { foreach (array('redactionStringRules', 'redactionRegexRules') as $key => $rule) { ${$rule} = CRM_Case_PseudoConstant::redactionRule($key); if (!empty(${$rule})) { foreach (${$rule} as &$val) { //suffixed with a randomly generated 4-digit number $val .= rand(10000, 100000); } if (!empty($this->{'_' . $rule})) { $this->{'_' . $rule} = CRM_Utils_Array::crmArrayMerge($this->{'_' . $rule}, ${$rule}); } else { $this->{'_' . $rule} = ${$rule}; } } } } $client = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $clientID, 'display_name'); // add Client to the strings to be redacted across the case session if (!array_key_exists($client, $this->_redactionStringRules)) { $this->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($this->_redactionStringRules, array($client => 'name_' . rand(10000, 100000))); $clientSortName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $clientID, 'sort_name'); if (!array_key_exists($clientSortName, $this->_redactionStringRules)) { $this->_redactionStringRules[$clientSortName] = $this->_redactionStringRules[$client]; } } $case['clientName'] = $this->redact($client); require_once 'CRM/Case/DAO/Case.php'; $dao = new CRM_Case_DAO_Case(); $dao->id = $caseID; if ($dao->find(true)) { $case['subject'] = $dao->subject; $case['start_date'] = $dao->start_date; $case['end_date'] = $dao->end_date; // FIXME: when we resolve if case_type_is single or multi-select if (strpos($dao->case_type_id, CRM_Core_DAO::VALUE_SEPARATOR) !== false) { $caseTypeID = substr($dao->case_type_id, 1, -1); } else { $caseTypeID = $dao->case_type_id; } $caseTypeIDs = explode(CRM_Core_DAO::VALUE_SEPARATOR, $dao->case_type_id); $case['caseType'] = CRM_Core_OptionGroup::getLabel('case_type', $caseTypeID); $caseTypeName = CRM_Case_PseudoConstant::caseTypeName($caseID); $case['caseTypeName'] = $caseTypeName['name']; $case['status'] = CRM_Core_OptionGroup::getLabel('case_status', $dao->status_id); } return $case; }
/** * Restore the record that are associated with this case * * @param int $caseId id of the case to restore * * @return true if success. * @access public * @static */ static function restoreCase($caseId) { //restore activities $activities = self::getCaseActivityDates($caseId); if ($activities) { require_once "CRM/Activity/BAO/Activity.php"; foreach ($activities as $value) { CRM_Activity_BAO_Activity::restoreActivity($value); } } //restore case require_once 'CRM/Case/DAO/Case.php'; $case = new CRM_Case_DAO_Case(); $case->id = $caseId; $case->is_deleted = 0; $case->save(); //CRM-7364, enable relationships self::enableDisableCaseRelationships($caseId, true); return true; }