* Set default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
- *
- * @return void
+ * @return array
+ * @throws \CRM_Core_Exception
*/
public function setDefaultValues() {
$defaults = [];
$defaults['parent_id'] = $defaults['entity_id'];
}
}
- elseif ($this->_action & CRM_Core_Action::ADD && $this->_parentId) {
- $defaults['parent_id'] = $this->_parentId;
- $defaults['subject'] = 'Re: ' . CRM_Core_BAO_Note::getNoteSubject($this->_parentId);
+ elseif ($this->_action & CRM_Core_Action::ADD) {
+ $defaults['note_date'] = date('Y-m-d H:i:s');
+ if ($this->_parentId) {
+ $defaults['parent_id'] = $this->_parentId;
+ $defaults['subject'] = 'Re: ' . CRM_Core_BAO_Note::getNoteSubject($this->_parentId);
+ }
}
return $defaults;
}
}
$this->addField('subject');
- $this->addField('note_date', [], FALSE, FALSE);
+ $this->addField('note_date', [], TRUE, FALSE);
$this->addField('note', [], TRUE);
$this->addField('privacy');
$this->add('hidden', 'parent_id');