diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php index 424e6ebb16efd4770d817e81995f98e0ab8052b9..89e209ef509c046d922345914a70b255a16a5892 100644 --- a/include/class.dynamic_forms.php +++ b/include/class.dynamic_forms.php @@ -765,7 +765,13 @@ class DynamicFormEntryAnswer extends VerySimpleModel { } function asVar() { - return $this->toString(); + return (is_object($this->getValue())) + ? $this->getValue() : $this->toString(); + } + + function getVar($tag) { + if (is_object($this->getValue()) && method_exists($this->getValue(), 'getVar')) + return $this->getValue()->getVar($tag); } function __toString() { @@ -938,8 +944,9 @@ class DynamicListItem extends VerySimpleModel { function getVar($name) { $config = $this->getConfiguration(); + $name = mb_strtolower($name); foreach ($this->getConfigurationForm()->getFields() as $field) { - if (strcasecmp($field->get('name'), $name) === 0) + if (mb_strtolower($field->get('name')) == $name) return $config[$field->get('id')]; } } @@ -948,6 +955,10 @@ class DynamicListItem extends VerySimpleModel { return $this->get('value'); } + function __toString() { + return $this->toString(); + } + function delete() { # Don't really delete, just unset the list_id to un-associate it with # the list diff --git a/include/class.ticket.php b/include/class.ticket.php index a69109204c85f16a88ab60fa01f2c0b87b1a2d8f..6580a8088b1bf68065ee25d797c505b66bfa7d9f 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -1278,7 +1278,7 @@ class Ticket { // The answer object is retrieved here which will // automatically invoke the toString() method when the // answer is coerced into text - return (string)$this->_answers[$tag]; + return $this->_answers[$tag]; } return false;