From f207761184c61fcb436446d9e3bf62319c737db8 Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 29 Jul 2019 15:31:20 +1200 Subject: [PATCH] Move greeting handling up as it is not paymentValidation dependent --- CRM/Event/Form/Registration/Register.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index 9262e110c7..131e08eb28 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -869,6 +869,16 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { ]); } } + foreach (CRM_Contact_BAO_Contact::$_greetingTypes as $greeting) { + if ($greetingType = CRM_Utils_Array::value($greeting, $fields)) { + $customizedValue = CRM_Core_PseudoConstant::getKey('CRM_Contact_BAO_Contact', $greeting . '_id', 'Customized'); + if ($customizedValue == $greetingType && empty($fields[$greeting . '_custom'])) { + $errors[$greeting . '_custom'] = ts('Custom %1 is a required field if %1 is of type Customized.', + [1 => ucwords(str_replace('_', ' ', $greeting))] + ); + } + } + } // @todo - can we remove the 'is_monetary' concept? if ($form->_values['event']['is_monetary']) { @@ -895,16 +905,6 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { ); } - foreach (CRM_Contact_BAO_Contact::$_greetingTypes as $greeting) { - if ($greetingType = CRM_Utils_Array::value($greeting, $fields)) { - $customizedValue = CRM_Core_PseudoConstant::getKey('CRM_Contact_BAO_Contact', $greeting . '_id', 'Customized'); - if ($customizedValue == $greetingType && empty($fields[$greeting . '_custom'])) { - $errors[$greeting . '_custom'] = ts('Custom %1 is a required field if %1 is of type Customized.', - [1 => ucwords(str_replace('_', ' ', $greeting))] - ); - } - } - } return empty($errors) ? TRUE : $errors; } -- 2.25.1