/** * Given the list of params in the params array, fetch the object * and store the values in the values array * * @param array $params input parameters to find object * @param array $values output values of the object * @param array $ids the array that holds all the db ids * * @return CRM_Case_BAO_Case|null the found object or null * @access public * @static */ static function &getValues(&$params, &$values, &$ids) { $case = new CRM_Case_BAO_Case(); $case->copyValues($params); if ($case->find(TRUE)) { $ids['case'] = $case->id; CRM_Core_DAO::storeValues($case, $values); return $case; } return NULL; }
/** * Internal function to retrieve a case. * * @param int $caseId * * @return array (reference) case object * */ function _civicrm_api3_case_read($caseId, $options) { $return = CRM_Utils_Array::value('return', $options, array()); $dao = new CRM_Case_BAO_Case(); $dao->id = $caseId; if ($dao->find(TRUE)) { $case = array(); _civicrm_api3_object_to_array($dao, $case); // Legacy support for client_id - TODO: in apiv4 remove 'client_id' $case['client_id'] = $case['contact_id'] = $dao->retrieveContactIdsByCaseId($caseId); //handle multi-value case type $sep = CRM_Core_DAO::VALUE_SEPARATOR; $case['case_type_id'] = trim(str_replace($sep, ',', $case['case_type_id']), ','); if (!empty($return['contacts'])) { //get case contacts $contacts = CRM_Case_BAO_Case::getcontactNames($caseId); $relations = CRM_Case_BAO_Case::getRelatedContacts($caseId); $case['contacts'] = array_merge($contacts, $relations); } if (!empty($return['activities'])) { //get case activities $case['activities'] = array(); $query = "SELECT activity_id FROM civicrm_case_activity WHERE case_id = {$caseId}"; $dao = CRM_Core_DAO::executeQuery($query); while ($dao->fetch()) { $case['activities'][] = $dao->activity_id; } } return $case; } }
/** * Internal function to retrieve a case. * * @param int $caseId * * @return array (reference) case object * */ function _civicrm_api3_case_read($caseId) { $dao = new CRM_Case_BAO_Case(); $dao->id = $caseId; if ($dao->find(TRUE)) { $case = array(); _civicrm_api3_object_to_array($dao, $case); $case['client_id'] = $dao->retrieveContactIdsByCaseId($caseId); //handle multi-value case type $sep = CRM_Core_DAO::VALUE_SEPARATOR; $case['case_type_id'] = trim(str_replace($sep, ',', $case['case_type_id']), ','); return $case; } else { return FALSE; } }
/** * Internal function to retrieve a case. * * @param int $caseId * * @param array $options * * @param bool $checkPermission * * @return array * case object */ function _civicrm_api3_case_read($caseId, $options, $checkPermission) { $return = CRM_Utils_Array::value('return', $options, array()); $dao = new CRM_Case_BAO_Case(); $dao->id = $caseId; if ($dao->find(TRUE)) { $case = array(); _civicrm_api3_object_to_array($dao, $case); _civicrm_api3_custom_data_get($case, $checkPermission, 'Case', $caseId); // Legacy support for client_id - TODO: in apiv4 remove 'client_id' $case['client_id'] = $case['contact_id'] = $dao->retrieveContactIdsByCaseId($caseId); if (!empty($return['contacts'])) { //get case contacts $contacts = CRM_Case_BAO_Case::getcontactNames($caseId); $relations = CRM_Case_BAO_Case::getRelatedContacts($caseId); $case['contacts'] = array_merge($contacts, $relations); } if (!empty($return['activities'])) { //get case activities $case['activities'] = array(); $query = "SELECT activity_id FROM civicrm_case_activity WHERE case_id = {$caseId}"; $dao = CRM_Core_DAO::executeQuery($query); while ($dao->fetch()) { $case['activities'][] = $dao->activity_id; } } return $case; } }
/** * Internal function to retrieve a case. * * @param int $caseId * * @return array (reference) case object * */ function _civicrm_case_read($caseId) { $dao = new CRM_Case_BAO_Case(); $dao->id = $caseId; if ($dao->find(true)) { $case = array(); _civicrm_object_to_array($dao, $case); //handle multi-value case type $sep = CRM_Case_BAO_Case::VALUE_SEPERATOR; $case['case_type_id'] = trim(str_replace($sep, ',', $case['case_type_id']), ','); return $case; } else { return false; } }