From fd933dc5af1976f9cc053cd3e8a91b8d47eea7ea Mon Sep 17 00:00:00 2001 From: Kurund Jalmi Date: Thu, 18 Jul 2013 22:16:25 +0530 Subject: [PATCH] setdefaults fixes for date time custom data in profile --- CRM/Core/BAO/UFGroup.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/CRM/Core/BAO/UFGroup.php b/CRM/Core/BAO/UFGroup.php index d8e5315d53..3755d2be4a 100644 --- a/CRM/Core/BAO/UFGroup.php +++ b/CRM/Core/BAO/UFGroup.php @@ -2289,11 +2289,11 @@ AND ( entity_id IS NULL OR entity_id <= 0 ) case 'Select Date': // CRM-6681, set defult values according to date and time format (if any). $dateFormat = NULL; - if (CRM_Utils_Array::value('date_format', $field)) { - $dateFormat = $field['date_format']; + if (CRM_Utils_Array::value('date_format', $customFields[$customFieldId])) { + $dateFormat = $customFields[$customFieldId]['date_format']; } - if (!CRM_Utils_Array::value('time_format', $field)) { + if (!CRM_Utils_Array::value('time_format', $customFields[$customFieldId])) { list($defaults[$fldName]) = CRM_Utils_Date::setDateDefaults($details[$name], NULL, $dateFormat ); @@ -2303,7 +2303,8 @@ AND ( entity_id IS NULL OR entity_id <= 0 ) if (substr($fldName, -1) == ']') { $timeElement = substr($fldName, 0, -1) . '_time]'; } - list($defaults[$fldName], $defaults[$timeElement]) = CRM_Utils_Date::setDateDefaults($details[$name], NULL, $dateFormat, $field['time_format']); + list($defaults[$fldName], $defaults[$timeElement]) = CRM_Utils_Date::setDateDefaults($details[$name], + NULL, $dateFormat, $customFields[$customFieldId]['time_format']); } break; -- 2.25.1