From cd46f86c1bca743d96fafc434b59ba852e5351b7 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Sun, 3 Sep 2023 08:28:52 +1000 Subject: [PATCH] Also fix deleting from PCPAccount form class --- CRM/Contact/BAO/Contact.php | 3 ++- CRM/PCP/Form/PCPAccount.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index ad02c2bef7..a4087b6c5f 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -1131,10 +1131,11 @@ WHERE civicrm_contact.id = " . CRM_Utils_Type::escape($id, 'Integer'); */ public static function processImage() { $action = CRM_Utils_Request::retrieve('action', 'String'); + $pcp = CRM_Utils_Request::retrieve('confirmed', 'String'); $cid = CRM_Utils_Request::retrieve('cid', 'Positive'); // retrieve contact id in case of Profile context $id = CRM_Utils_Request::retrieve('id', 'Positive'); - $formName = $cid ? 'CRM_Contact_Form_Contact' : 'CRM_Profile_Form_Edit'; + $formName = $pcp ? 'CRM_PCP_Form_PCPAccount' : ($cid ? 'CRM_Contact_Form_Contact' : 'CRM_Profile_Form_Edit'); $cid = $cid ? $cid : $id; if ($action & CRM_Core_Action::DELETE) { if (CRM_Utils_Request::retrieve('confirmed', 'Boolean')) { diff --git a/CRM/PCP/Form/PCPAccount.php b/CRM/PCP/Form/PCPAccount.php index 662ecc6b3c..a4b01f6d35 100644 --- a/CRM/PCP/Form/PCPAccount.php +++ b/CRM/PCP/Form/PCPAccount.php @@ -125,7 +125,7 @@ class CRM_PCP_Form_PCPAccount extends CRM_Core_Form { CRM_Core_Action::DELETE => [ 'name' => ts('Delete Contact Image'), 'url' => 'civicrm/contact/image', - 'qs' => 'reset=1&cid=' . $this->_contactID . '&action=delete', + 'qs' => 'reset=1&cid=%%id%%&action=delete&qfKey=%%key%%&pcp=1', 'extra' => 'onclick = "' . htmlspecialchars("if (confirm($deleteExtra)) this.href+='&confirmed=1'; else return false;") . '"', ], ]; @@ -133,6 +133,7 @@ class CRM_PCP_Form_PCPAccount extends CRM_Core_Form { CRM_Core_Action::DELETE, [ 'id' => $this->_contactID, + 'key' => $this->controller->_key, ], ts('more'), FALSE, -- 2.25.1