From 810ad65f0a40d4c4622f7b0d462aee37e3bcb898 Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Wed, 20 Jul 2016 17:30:18 +0530 Subject: [PATCH] CRM-16189, fixed code to check if financial type id is present in $params ---------------------------------------- * CRM-16189: Improve support for Accrual Method bookkeeping https://issues.civicrm.org/jira/browse/CRM-16189 --- CRM/Event/BAO/Event.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index a68f2305e4..539eb64d41 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -96,13 +96,12 @@ class CRM_Event_BAO_Event extends CRM_Event_DAO_Event { } // CRM-16189 - $isError = CRM_Financial_BAO_FinancialAccount::validateFinancialType( - CRM_Utils_Array::value('financial_type_id', $params) - ); - if ($isError) { - throw new CRM_Core_Exception(ts('Deferred revenue account is not configured for selected financial type. Please have an administrator set up the deferred revenue account at Administer > CiviContribute > Financial Accounts, then configure it for financial types at Administer > CiviContribution > Financial Types, Accounts')); + if (!empty($params['financial_type_id'])) { + $isError = CRM_Financial_BAO_FinancialAccount::validateFinancialType($params['financial_type_id']); + if ($isError) { + throw new CRM_Core_Exception(ts('Deferred revenue account is not configured for selected financial type. Please have an administrator set up the deferred revenue account at Administer > CiviContribute > Financial Accounts, then configure it for financial types at Administer > CiviContribution > Financial Types, Accounts')); + } } - $event = new CRM_Event_DAO_Event(); $event->copyValues($params); -- 2.25.1