Wrong status message when deleting a contact if undelete/trash is turned off
- Go to Administer - System Settings - Misc
- Set "Contact Trash and Undelete" to "No".
- Go to any contact's page.
- Click the Delete button near the top.
- Confirm the deletion.
- The contact is (permanently) deleted correctly, but two incorrect messages appear:
"[Name] has been moved to the trash."
(It should say permanently deleted, since you turned off trash.)
"A Contact with that ID does not exist: [id]"
(Because it's redirecting you to the contact view page for the contact that you just deleted.)
Another path to reproduce the problem is instead of step 3 above do Search - Find Contacts, then select one and from the actions dropdown choose Delete Contacts. It will say moved to trash but it should say permanently deleted. (Choosing Delete Permanently works ok with or without trash turned on.)
I think this might be an ok candidate for a newcomer to tackle, because it's pretty self-contained, not too abstract, and there's an existing unit test to update so provides a jumpstart to working with tests locally.
Relevant code is here:
- CRM/Contact/Form/Task/Delete.php in postProcess()
- CRM/Contact/Form/Task/Delete.php in preProcess()
- Existing test
Aside: I'm curious how many people turn off trash because the message seems like something people would have noticed by now. I only noticed it while writing the test.