Skip to content
Snippets Groups Projects
Commit 71f25fbc authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge pull request #207 from greezybacon/issue/203


forms: Fix validation error display on web submit

Reviewed-By: default avatarPeter Rotich <peter@osticket.com>
parents 88e88093 46511c46
No related branches found
No related tags found
No related merge requests found
...@@ -180,13 +180,14 @@ class TicketForm extends DynamicForm { ...@@ -180,13 +180,14 @@ class TicketForm extends DynamicForm {
static function getInstance() { static function getInstance() {
if (!isset(static::$instance)) if (!isset(static::$instance))
static::$instance = static::getNewInstance(); self::getNewInstance();
return static::$instance; return static::$instance;
} }
static function getNewInstance() { static function getNewInstance() {
$o = static::objects(); $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 // Add fields from the standard ticket form to the ticket filterable fields
......
...@@ -1019,14 +1019,15 @@ class DatetimePickerWidget extends Widget { ...@@ -1019,14 +1019,15 @@ class DatetimePickerWidget extends Widget {
$config = $this->field->getConfiguration(); $config = $this->field->getConfiguration();
if ($datetime = parent::getValue()) { if ($datetime = parent::getValue()) {
$datetime = (is_int($datetime) ? $datetime : $datetime = (is_int($datetime) ? $datetime :
(int)DateTime::createFromFormat($cfg->getDateFormat() . ' G:i', (($dt = DateTime::createFromFormat($cfg->getDateFormat() . ' G:i',
$datetime . ' 00:00') $datetime . ' 00:00'))
->format('U')); ? (int) $dt->format('U') : false)
if (isset($data[$this->name . ':time'])) { );
if ($datetime && isset($data[$this->name . ':time'])) {
list($hr, $min) = explode(':', $data[$this->name . ':time']); list($hr, $min) = explode(':', $data[$this->name . ':time']);
$datetime += $hr * 3600 + $min * 60; $datetime += $hr * 3600 + $min * 60;
} }
if ($config['gmt']) if ($datetime && $config['gmt'])
$datetime -= (int) (3600 * $_SESSION['TZ_OFFSET'] + $datetime -= (int) (3600 * $_SESSION['TZ_OFFSET'] +
($_SESSION['TZ_DST'] ? date('I',$datetime) : 0)); ($_SESSION['TZ_DST'] ? date('I',$datetime) : 0));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment