/**
* Build all the data structures needed to build the form.
+ *
+ * @throws \CRM_Core_Exception
*/
public function preProcess() {
$this->_activityId = CRM_Utils_Request::retrieve('activityId', 'Positive');
if (!$this->_activityId) {
- CRM_Core_Error::fatal('required activity id is missing.');
+ throw new CRM_Core_Exception('required activity id is missing.');
}
$this->_currentCaseId = CRM_Utils_Request::retrieve('caseId', 'Positive');
}
/**
- * Set default values for the form. For edit/view mode
- * the default values are retrieved from the database
- *
+ * Set default values for the form. For edit/view mode.
*
* @return array
+ *
+ * @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
*/
public function setDefaultValues() {
$defaults = [];
$params = ['id' => $this->_activityId];
CRM_Activity_BAO_Activity::retrieve($params, $defaults);
- $defaults['file_on_case_activity_subject'] = $defaults['subject'];
+ $defaults['file_on_case_activity_subject'] = $defaults['subject'] ?? '';
$defaults['file_on_case_target_contact_id'] = $defaults['target_contact'];
// If this contact has an open case, supply it as a default