diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php index 553a3da2f9c56b079cee698eff687f7b7f844ca5..92863db2fd331d0b5cbb5b239e6b9a8555ea219d 100644 --- a/include/class.dynamic_forms.php +++ b/include/class.dynamic_forms.php @@ -566,6 +566,10 @@ class DynamicFormEntryAnswer extends VerySimpleModel { function toString() { return $this->getField()->toString($this->getValue()); } + + function __toString() { + return $this->toString(); + } } /** diff --git a/include/class.ticket.php b/include/class.ticket.php index f4dd51c0ddac73c880d4bf741397c2fee7a9187c..596254830eb8b4536bcee86df05d25d975643897 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -109,8 +109,8 @@ class Ticket { if (!$this->_answers) { foreach (DynamicFormEntry::forTicket($this->getId(), true) as $form) foreach ($form->getAnswers() as $answer) - $this->_answers[$answer->getField()->get('name')] = - $answer->getValue(); + $this->_answers[$answer->getField()->get('name')] + = $answer; } } @@ -290,13 +290,13 @@ class Ticket { function getPriorityId() { global $cfg; - if ($a = $this->_answers['priority']) + if ($a = $this->_answers['priority']->getValue()) return $a->getId(); return $cfg->getDefaultPriorityId(); } function getPriority() { - if ($a = $this->_answers['priority']) + if ($a = $this->_answers['priority']->getValue()) return $a->getDesc(); return '...ummm...'; } @@ -1095,9 +1095,9 @@ class Ticket { break; default: if (isset($this->_answers[$tag])) - # TODO: Use DynamicField to format the value, also, - # private field data should never go external, via - # email, for instance + // The answer object is retrieved here which will + // automatically invoke the toString() method when the + // answer is coerced into text return $this->_answers[$tag]; }