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

Merge pull request #53 from greezybacon/feature/ticket-user-vars


Add %{ticket.user} to ticket template variables

Reviewed-By: default avatarPeter Rotich <peter@osticket.com>
parents be4d48b5 6d735ab8
Branches
Tags
No related merge requests found
...@@ -1094,6 +1094,9 @@ class Ticket { ...@@ -1094,6 +1094,9 @@ class Ticket {
return $closedate; return $closedate;
break; break;
case 'user':
return $this->getOwner();
break;
default: default:
if (isset($this->_answers[$tag])) if (isset($this->_answers[$tag]))
// The answer object is retrieved here which will // The answer object is retrieved here which will
......
...@@ -107,15 +107,31 @@ class User extends UserModel { ...@@ -107,15 +107,31 @@ class User extends UserModel {
return new PersonsName($this->name); return new PersonsName($this->name);
} }
function asVar() {
return (string) $this->getName();
}
function getVar($tag) {
if($tag && is_callable(array($this, 'get'.ucfirst($tag))))
return call_user_func(array($this, 'get'.ucfirst($tag)));
$tag = strtolower($tag);
foreach ($this->getDynamicData() as $e)
if ($e->getAnswer($tag))
return $e;
}
function getDynamicData() { function getDynamicData() {
$data = DynamicFormEntry::forClient($this->id); if (!isset($this->_entries)) {
if (!$data[0]) { $this->_entries = DynamicFormEntry::forClient($this->id);
$data = array(); if (!$this->_entries[0]) {
$g = UserForm::getInstance(); $this->_entries = array();
$g->setClientId($this->id); $g = UserForm::getInstance();
$data[] = $g; $g->setClientId($this->id);
$this->_entries[] = $g;
}
} }
return $data; return $this->_entries;
} }
function save($refetch=false) { function save($refetch=false) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment