From a94b009a547182fd858ab64796d1fd1205351e14 Mon Sep 17 00:00:00 2001 From: "Matthew Wire (MJW Consulting)" Date: Fri, 16 Nov 2018 16:22:40 +0000 Subject: [PATCH] Fix delete event participant fatal error and display name if no email --- CRM/Contribute/Form/AbstractEditPayment.php | 3 +++ CRM/Event/Page/Tab.php | 22 ++++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/CRM/Contribute/Form/AbstractEditPayment.php b/CRM/Contribute/Form/AbstractEditPayment.php index 86c92605d669..987479f25982 100644 --- a/CRM/Contribute/Form/AbstractEditPayment.php +++ b/CRM/Contribute/Form/AbstractEditPayment.php @@ -753,6 +753,9 @@ protected function assignPaymentInfoBlock() { protected function assignContactEmailDetails() { if ($this->_contactID) { list($this->userDisplayName, $this->userEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID); + if (empty($this->userDisplayName)) { + $this->userDisplayName = civicrm_api3('contact', 'getvalue', ['id' => $this->_contactID, 'return' => 'display_name']); + } $this->assign('displayName', $this->userDisplayName); } } diff --git a/CRM/Event/Page/Tab.php b/CRM/Event/Page/Tab.php index c0b1855dd598..8b11dd5849a1 100644 --- a/CRM/Event/Page/Tab.php +++ b/CRM/Event/Page/Tab.php @@ -118,6 +118,19 @@ public function edit() { return $controller->run(); } + public function delete() { + $controller = new CRM_Core_Controller_Simple( + 'CRM_Event_Form_Participant', + ts('Delete Participant'), + $this->_action + ); + + $controller->setEmbedded(TRUE); + $controller->set('id', $this->_id); + $controller->set('cid', $this->_contactId); + $controller->run(); + } + public function preProcess() { $context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this); $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); @@ -167,13 +180,12 @@ public function run() { if ($this->_action & CRM_Core_Action::VIEW) { $this->view(); } - elseif ($this->_action & (CRM_Core_Action::UPDATE | - CRM_Core_Action::ADD | - CRM_Core_Action::DELETE - ) - ) { + elseif ($this->_action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD)) { $this->edit(); } + elseif ($this->_action & (CRM_Core_Action::DELETE | CRM_Core_Action::DETACH)) { + $this->delete(); + } else { $this->browse(); }