Error when deleting a note: Undefined index: parent_id in CRM_Note_Form_Note->postProcess()
Overview
After deleting a note (for instance, on a contact): https://EXAMPLE.org/civicrm/contact/view/note?action=delete&reset=1&cid=314758&id=390738&selectedChild=note.
Results in:
Notice: Undefined index: parent_id in CRM_Note_Form_Note->postProcess() (line 169 of /var/www/vhosts/EXAMPLE.org/www/vendor/civicrm/civicrm-core/CRM/Note/Form/Note.php)
Reproduction steps
- Create a note on a contact.
- Delete that contact.
- Check error logs.
postProcess()
is looking for $params['parent_id']
even though it is not being set when deleting a note.
It appears that parent_id
is only used for "comments" on notes. This area of the code is a bit funky and doesn't appear to be exposed to API4 (don't see any parent_id there). In CRM_Note_Form_Note
the _parentId
is being set based on $_GET
so I don't think that would be available to the API.
Tested on CiviCRM 5.49.3.