From d6921a22158b555e146d6876ee1985236c0277f2 Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 18 Feb 2020 01:57:33 +1300 Subject: [PATCH] [REF] Simplify non-creditcard participant.create The wrangling for role_id is done in the Participant::add function now so we don't need it. One loop hurts our heads less --- CRM/Event/Form/Participant.php | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index ff9b315d55..5b82ef18ef 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -1262,33 +1262,15 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment $this->_contactIds[] = $this->_contactId; } else { - $participants = []; - if ($this->_single) { - if ($params['role_id']) { - $params['role_id'] = $roleIdWithSeparator; - } - else { - $params['role_id'] = 'NULL'; - } - $participants[] = CRM_Event_BAO_Participant::create($params); - } - else { - foreach ($this->_contactIds as $contactID) { - $commonParams = $params; - $commonParams['contact_id'] = $contactID; - if ($commonParams['role_id']) { - $commonParams['role_id'] = $commonParams['role_id'] = str_replace(',', CRM_Core_DAO::VALUE_SEPARATOR, $params['role_id']); - } - else { - $commonParams['role_id'] = 'NULL'; - } - $participants[] = CRM_Event_BAO_Participant::create($commonParams); - } - } - if ($this->_single) { $this->_contactIds[] = $this->_contactId; } + $participants = []; + foreach ($this->_contactIds as $contactID) { + $commonParams = $params; + $commonParams['contact_id'] = $contactID; + $participants[] = CRM_Event_BAO_Participant::create($commonParams); + } $contributions = []; if (!empty($params['record_contribution'])) { -- 2.25.1