From 7207189c41b5da91273fca639ee36ea12ab32017 Mon Sep 17 00:00:00 2001 From: Matthew Wire Date: Sun, 20 Mar 2022 19:11:57 +0000 Subject: [PATCH] Make note date required when creating note --- CRM/Note/Form/Note.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/CRM/Note/Form/Note.php b/CRM/Note/Form/Note.php index c0ec7fe0d5..a534dd5518 100644 --- a/CRM/Note/Form/Note.php +++ b/CRM/Note/Form/Note.php @@ -72,8 +72,8 @@ class CRM_Note_Form_Note extends CRM_Core_Form { * 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 = []; @@ -87,9 +87,12 @@ class CRM_Note_Form_Note extends CRM_Core_Form { $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; } @@ -130,7 +133,7 @@ class CRM_Note_Form_Note extends CRM_Core_Form { } $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'); -- 2.25.1