From: Pradeep Nayak Date: Wed, 20 Jul 2016 12:00:18 +0000 (+0530) Subject: CRM-16189, fixed code to check if financial type id is present in $params X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=810ad65f0a40d4c4622f7b0d462aee37e3bcb898;p=civicrm-core.git 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 --- 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);