+--------------------------------------------------------------------+
*/
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC https://civicrm.org/licensing
- */
-
/**
* This class generates form components for OpenCase Activity.
*/
*/
public $_contactID;
+ /**
+ * @var int
+ */
+ public $_caseStatusId;
+
/**
* @param CRM_Case_Form_Case $form
*
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
*/
public static function preProcess(&$form) {
//get multi client case configuration
* @param CRM_Case_Form_Case $form
*
* @return array $defaults
+ * @throws \CiviCRM_API3_Exception
*/
public static function setDefaultValues(&$form) {
$defaults = [];
/**
* @param CRM_Case_Form_Case $form
+ *
+ * @throws \CiviCRM_API3_Exception
+ * @throws \Exception
*/
public static function buildQuickForm(&$form) {
if ($form->_context == 'caseActivity') {
$params['location'] = $params['activity_location'] ?? NULL;
// Add attachments
- CRM_Core_BAO_File::formatAttachment(
- $params,
- $params,
- 'civicrm_activity',
- $form->_activityId
- );
-
+ CRM_Core_BAO_File::formatAttachment($params, $params, 'civicrm_activity', $form->_activityId);
}
/**
* Global validation rules for the form.
*
- * @param $fields
- * @param $files
+ * @param array $fields
+ * The input form values.
+ * @param array $files
+ * The uploaded files if any.
* @param CRM_Case_Form_Case $form
*
- * @return array
+ * @return array|bool
* list of errors to be posted back to the form
*/
public static function formRule($fields, $files, $form) {
$isMultiClient = $xmlProcessorProcess->getAllowMultipleCaseClients();
if (!$isMultiClient && !$form->_currentlyViewedContactId) {
- CRM_Core_Error::fatal('Required parameter missing for OpenCase - end post processing');
+ throw new CRM_Core_Exception('Required parameter missing for OpenCase - end post processing');
}
- if (!$form->_currentUserId ||
- !$params['case_id'] ||
- !$params['case_type']
- ) {
- CRM_Core_Error::fatal('Required parameter missing for OpenCase - end post processing');
+ if (!$form->_currentUserId || !$params['case_id'] || !$params['case_type']) {
+ throw new CRM_Core_Exception('Required parameter missing for OpenCase - end post processing');
}
// 1. create case-contact
if ($isMultiClient && $form->_context == 'standalone') {
foreach ($params['client_id'] as $cliId) {
if (empty($cliId)) {
- CRM_Core_Error::fatal('client_id cannot be empty');
+ throw new CRM_Core_Exception('client_id cannot be empty for OpenCase - end post processing');
}
$contactParams = [
'case_id' => $params['case_id'],