Skip to content
Snippets Groups Projects
Commit e678360e authored by Jared Hancock's avatar Jared Hancock
Browse files

oops: Fix warning on new ticket page for Thread::lastmessage

parent a42161cc
Branches
Tags
No related merge requests found
...@@ -29,6 +29,7 @@ class StaffAjaxAPI extends AjaxController { ...@@ -29,6 +29,7 @@ class StaffAjaxAPI extends AjaxController {
Http::response(404, 'No such agent'); Http::response(404, 'No such agent');
$form = new PasswordResetForm($_POST); $form = new PasswordResetForm($_POST);
$errors = array();
if (!$_POST && isset($_SESSION['new-agent-passwd'])) if (!$_POST && isset($_SESSION['new-agent-passwd']))
$form->data($_SESSION['new-agent-passwd']); $form->data($_SESSION['new-agent-passwd']);
...@@ -76,6 +77,7 @@ class StaffAjaxAPI extends AjaxController { ...@@ -76,6 +77,7 @@ class StaffAjaxAPI extends AjaxController {
Http::response(404, 'No such agent'); Http::response(404, 'No such agent');
$form = new PasswordChangeForm($_POST); $form = new PasswordChangeForm($_POST);
$errors = array();
if ($_POST && $form->isValid()) { if ($_POST && $form->isValid()) {
$clean = $form->getClean(); $clean = $form->getClean();
......
...@@ -869,8 +869,6 @@ implements TemplateVariable { ...@@ -869,8 +869,6 @@ implements TemplateVariable {
} }
function getVar($what) { function getVar($what) {
global $cfg;
// TODO: Rebase date format so that locale is discovered HERE. // TODO: Rebase date format so that locale is discovered HERE.
switch ($what) { switch ($what) {
...@@ -906,20 +904,21 @@ extends FormattedLocalDate { ...@@ -906,20 +904,21 @@ extends FormattedLocalDate {
return (string) new FormattedLocalDate($this->date, $cfg->getTimezone(), false, $this->fromdb); return (string) new FormattedLocalDate($this->date, $cfg->getTimezone(), false, $this->fromdb);
} }
function getVar($what, $context) { function getVar($what, $context=null) {
global $cfg; global $cfg;
if ($rv = parent::getVar($what)) if ($rv = parent::getVar($what, $context))
return $rv; return $rv;
switch ($what) { switch ($what) {
case 'user': case 'user':
// Fetch $recipient from the context and find that user's time zone // Fetch $recipient from the context and find that user's time zone
if ($recipient = $context->getObj('recipient')) { if ($context && ($recipient = $context->getObj('recipient'))) {
$tz = $recipient->getTimezone() ?: $cfg->getDefaultTimezone(); $tz = $recipient->getTimezone() ?: $cfg->getDefaultTimezone();
return new FormattedLocalDate($this->date, $tz, $recipient); return new FormattedLocalDate($this->date, $tz, $recipient);
} }
break; // Don't resolve the variable until correspondance is sent out
return false;
case 'system': case 'system':
return new FormattedLocalDate($this->date, $cfg->getDefaultTimezone()); return new FormattedLocalDate($this->date, $cfg->getDefaultTimezone());
} }
......
...@@ -2447,7 +2447,7 @@ implements TemplateVariable { ...@@ -2447,7 +2447,7 @@ implements TemplateVariable {
return $message; return $message;
$this->lastmessage = SqlFunction::NOW(); $this->lastmessage = SqlFunction::NOW();
$this->save(); $this->save(true);
return $message; return $message;
} }
...@@ -2460,7 +2460,7 @@ implements TemplateVariable { ...@@ -2460,7 +2460,7 @@ implements TemplateVariable {
return $resp; return $resp;
$this->lastresponse = SqlFunction::NOW(); $this->lastresponse = SqlFunction::NOW();
$this->save(); $this->save(true);
return $resp; return $resp;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment