From a72a9544d22b076f041332474b96f993b158f86d Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 13 Dec 2019 10:46:37 +1300 Subject: [PATCH] E notice fix on Price set form --- CRM/Price/Form/Field.php | 4 +++- CRM/Price/Form/Set.php | 10 ++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CRM/Price/Form/Field.php b/CRM/Price/Form/Field.php index 422385a613..a3ab154010 100644 --- a/CRM/Price/Form/Field.php +++ b/CRM/Price/Form/Field.php @@ -608,6 +608,8 @@ class CRM_Price_Form_Field extends CRM_Core_Form { /** * Process the form. + * + * @throws \CRM_Core_Exception */ public function postProcess() { // store the submitted values in an array @@ -638,7 +640,7 @@ class CRM_Price_Form_Field extends CRM_Core_Form { } $params['is_enter_qty'] = CRM_Utils_Array::value('is_enter_qty', $params, FALSE); - if ($params['html_type'] == 'Text') { + if ($params['html_type'] === 'Text') { // if html type is Text, force is_enter_qty on $params['is_enter_qty'] = 1; // modify params values as per the option group and option diff --git a/CRM/Price/Form/Set.php b/CRM/Price/Form/Set.php index 41a0d624de..47f45516f2 100644 --- a/CRM/Price/Form/Set.php +++ b/CRM/Price/Form/Set.php @@ -135,16 +135,14 @@ class CRM_Price_Form_Set extends CRM_Core_Form { */ public static function formRule($fields, $files, $options) { $errors = []; - $count = count(CRM_Utils_Array::value('extends', $fields)); + $count = count(CRM_Utils_Array::value('extends', $fields, [])); //price sets configured for membership - if ($count && array_key_exists(CRM_Core_Component::getComponentID('CiviMember'), $fields['extends'])) { - if ($count > 1) { - $errors['extends'] = ts('If you plan on using this price set for membership signup and renewal, you can not also use it for Events or Contributions. However, a membership price set may include additional fields for non-membership options that require an additional fee (e.g. magazine subscription).'); - } + if ($count > 1 && array_key_exists(CRM_Core_Component::getComponentID('CiviMember'), $fields['extends'])) { + $errors['extends'] = ts('If you plan on using this price set for membership signup and renewal, you can not also use it for Events or Contributions. However, a membership price set may include additional fields for non-membership options that require an additional fee (e.g. magazine subscription).'); } // Checks the given price set does not start with a digit if (strlen($fields['title']) && is_numeric($fields['title'][0])) { - $errors['title'] = ts("Name cannot not start with a digit"); + $errors['title'] = ts('Name cannot not start with a digit'); } return empty($errors) ? TRUE : $errors; } -- 2.25.1