Skip to content

Commit

Permalink
Merge pull request #22987 from mattwire/notedateform
Browse files Browse the repository at this point in the history
Make note date required when creating note
  • Loading branch information
demeritcowboy authored Mar 21, 2022
2 parents bea0b08 + 7207189 commit c224ce8
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions CRM/Note/Form/Note.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ public function preProcess() {
* 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 = [];
Expand All @@ -87,9 +87,12 @@ public function setDefaultValues() {
$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;
}
Expand Down Expand Up @@ -130,7 +133,7 @@ public function buildQuickForm() {
}

$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');
Expand Down

0 comments on commit c224ce8

Please sign in to comment.