diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php index 73868aca0ff3ffb053223232ad0658e49837d4c6..5b76646420b5e4a9420f6ae1537657af3f290d9a 100644 --- a/include/class.dynamic_forms.php +++ b/include/class.dynamic_forms.php @@ -180,13 +180,14 @@ class TicketForm extends DynamicForm { static function getInstance() { if (!isset(static::$instance)) - static::$instance = static::getNewInstance(); + self::getNewInstance(); return static::$instance; } static function getNewInstance() { $o = static::objects(); - return $o[0]->instanciate(); + static::$instance = $o[0]->instanciate(); + return static::$instance; } } // Add fields from the standard ticket form to the ticket filterable fields diff --git a/include/class.forms.php b/include/class.forms.php index 0063c1d384c501efbbf5be513529d377aa46f99b..4dc69b993ee80473a35691c5fdf55589c88c3d97 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -1019,14 +1019,15 @@ class DatetimePickerWidget extends Widget { $config = $this->field->getConfiguration(); if ($datetime = parent::getValue()) { $datetime = (is_int($datetime) ? $datetime : - (int)DateTime::createFromFormat($cfg->getDateFormat() . ' G:i', - $datetime . ' 00:00') - ->format('U')); - if (isset($data[$this->name . ':time'])) { + (($dt = DateTime::createFromFormat($cfg->getDateFormat() . ' G:i', + $datetime . ' 00:00')) + ? (int) $dt->format('U') : false) + ); + if ($datetime && isset($data[$this->name . ':time'])) { list($hr, $min) = explode(':', $data[$this->name . ':time']); $datetime += $hr * 3600 + $min * 60; } - if ($config['gmt']) + if ($datetime && $config['gmt']) $datetime -= (int) (3600 * $_SESSION['TZ_OFFSET'] + ($_SESSION['TZ_DST'] ? date('I',$datetime) : 0)); }