From 01e21c0a680d1069cf064b0d9665cb1fbc41214a Mon Sep 17 00:00:00 2001 From: Pratik Joshi <pratik.joshi@webaccess.co.in> Date: Tue, 15 Oct 2013 14:24:42 +0530 Subject: [PATCH] CRM-13591 : fixed condition check for display value returning function for custom fields (i.e used for returning appropriate val for Yes/No fields) ---------------------------------------- * CRM-13591: Yes / No fields are not properly displayed in profile view http://issues.civicrm.org/jira/browse/CRM-13591 --- CRM/Core/BAO/CustomField.php | 3 +-- CRM/Event/BAO/Event.php | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index f2ad275a4b..1e89e8a3c1 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -1180,7 +1180,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { if ($value) { $display = ts('Yes'); } - elseif ($value === '0') { + elseif ((string)$value === '0') { $display = ts('No'); } } @@ -1345,7 +1345,6 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { $display = $value; } } - return $display ? $display : $value; } diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index bf38cb365c..42728b2d7e 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -1538,7 +1538,10 @@ WHERE id = $cfID if ($dao->data_type == 'Int' || $dao->data_type == 'Boolean' ) { - $customVal = (int )($params[$name]); + $v = $params[$name]; + if (!CRM_Utils_System::isNull($v)) { + $customVal = (int)$v; + } } elseif ($dao->data_type == 'Float') { $customVal = (float )($params[$name]); -- 2.25.1