setdefaults fixes for date time custom data in profile
authorKurund Jalmi <kurund@civicrm.org>
Thu, 18 Jul 2013 16:46:25 +0000 (22:16 +0530)
committerKurund Jalmi <kurund@civicrm.org>
Thu, 18 Jul 2013 16:46:25 +0000 (22:16 +0530)
CRM/Core/BAO/UFGroup.php

index d8e5315d5307a838060ffb68c9eb81b85ff09c9d..3755d2be4ac097fba5c93d18ba70a022ed70422c 100644 (file)
@@ -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;