Browse Source

Fix date issue see BT#10849

jmontoyaa 8 years ago
parent
commit
5fc8588f19

+ 0 - 1
main/inc/lib/extra_field.lib.php

@@ -1233,7 +1233,6 @@ class ExtraField extends Model
                                 $form->freeze('extra_'.$field_details['variable']);
                             }
                         }
-
                         $form->applyFilter('theme', 'trim');
                         break;
                     case ExtraField::FIELD_TYPE_DATETIME:

+ 13 - 3
main/inc/lib/formvalidator/Element/DatePicker.php

@@ -33,15 +33,25 @@ class DatePicker extends HTML_QuickForm_text
     public function toHtml()
     {
         if ($this->_flagFrozen) {
-            return $this->getFrozenHtml();
-        }
+            $value = $this->getValue();
+            if (!empty($value) && $value != '0000-00-00') {
+                $value = api_format_date($value, DATE_FORMAT_LONG_NO_DAY);
+                $this->updateAttributes(
+                    array(
+                        'value' => $value
+                    )
+                );
+            }
 
+            $frozen = $this->getFrozenHtml();
+            return $frozen;
+        }
         $id = $this->getAttribute('id');
         $value = $this->getValue();
         $label = $this->getLabel();
 
         if (!empty($value)) {
-            $value = api_format_date($value, DATE_TIME_FORMAT_LONG_24H);
+            $value = api_format_date($value, DATE_FORMAT_LONG_NO_DAY);
         }
 
         return '

+ 1 - 0
main/inc/lib/sessionmanager.lib.php

@@ -519,6 +519,7 @@ class SessionManager
 
         $query .= $order;
         $query .= $limit;
+
         $result = Database::query($query);
 
         $categories = self::get_all_session_category();