From e54395813072211a2c7b26ca76e37d48051307a5 Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Fri, 28 Mar 2014 19:37:47 +0530 Subject: [PATCH] API Tests Fix --- CRM/Financial/BAO/FinancialAccount.php | 4 +++- CRM/Financial/BAO/FinancialType.php | 2 +- CRM/Mailing/BAO/Component.php | 12 ++++++------ api/v3/examples/UFJoin/Create.php | 1 + 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CRM/Financial/BAO/FinancialAccount.php b/CRM/Financial/BAO/FinancialAccount.php index 4f1a87b734..dcf52d2c2e 100644 --- a/CRM/Financial/BAO/FinancialAccount.php +++ b/CRM/Financial/BAO/FinancialAccount.php @@ -110,7 +110,9 @@ class CRM_Financial_BAO_FinancialAccount extends CRM_Financial_DAO_FinancialAcco // action is taken depending upon the mode $financialAccount = new CRM_Financial_DAO_FinancialAccount(); $financialAccount->copyValues($params); - $financialAccount->id = CRM_Utils_Array::value('contributionType', $ids); + if (!empty($ids['contributionType'])) { + $financialAccount->id = CRM_Utils_Array::value('contributionType', $ids); + } $financialAccount->save(); return $financialAccount; } diff --git a/CRM/Financial/BAO/FinancialType.php b/CRM/Financial/BAO/FinancialType.php index 8abb756abb..72c4cf421b 100644 --- a/CRM/Financial/BAO/FinancialType.php +++ b/CRM/Financial/BAO/FinancialType.php @@ -95,7 +95,7 @@ class CRM_Financial_BAO_FinancialType extends CRM_Financial_DAO_FinancialType { * @static * @return object */ - static function add(&$params, &$ids) { + static function add(&$params, &$ids = array()) { $params['is_active'] = CRM_Utils_Array::value('is_active', $params, false); $params['is_deductible'] = CRM_Utils_Array::value('is_deductible', $params, false); $params['is_reserved'] = CRM_Utils_Array::value('is_reserved', $params, false); diff --git a/CRM/Mailing/BAO/Component.php b/CRM/Mailing/BAO/Component.php index 51975bf52c..3e094e55de 100644 --- a/CRM/Mailing/BAO/Component.php +++ b/CRM/Mailing/BAO/Component.php @@ -93,15 +93,15 @@ class CRM_Mailing_BAO_Component extends CRM_Mailing_DAO_Component { // action is taken depending upon the mode $component = new CRM_Mailing_DAO_Component(); $component->name = $params['name']; - $component->component_type = $params['component_type']; - $component->subject = $params['subject']; - if ($params['body_text']) { - $component->body_text = $params['body_text']; + $component->component_type = CRM_Utils_Array::value('component_type', $params); + $component->subject = CRM_Utils_Array::value('subject', $params); + if (CRM_Utils_Array::value('body_text', $params)) { + $component->body_text = CRM_Utils_Array::value('body_text', $params); } else { - $component->body_text = CRM_Utils_String::htmlToText($params['body_html']); + $component->body_text = CRM_Utils_String::htmlToText(CRM_Utils_Array::value('body_html', $params)); } - $component->body_html = $params['body_html']; + $component->body_html = CRM_Utils_Array::value('body_html', $params); $component->is_active = CRM_Utils_Array::value('is_active', $params, FALSE); $component->is_default = CRM_Utils_Array::value('is_default', $params, FALSE); diff --git a/api/v3/examples/UFJoin/Create.php b/api/v3/examples/UFJoin/Create.php index 11d976380c..5eaba20a6e 100644 --- a/api/v3/examples/UFJoin/Create.php +++ b/api/v3/examples/UFJoin/Create.php @@ -47,6 +47,7 @@ function uf_join_create_expectedresult(){ 'entity_id' => '1', 'weight' => '1', 'uf_group_id' => '11', + 'module_data' => '', ), ), ); -- 2.25.1