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

forms: Fix issue details showing up on edit

parent ce3ceaeb
No related branches found
No related tags found
No related merge requests found
......@@ -1079,6 +1079,14 @@ class DynamicFormEntry extends VerySimpleModel {
return $this->_fields;
}
function filterFields($filter) {
$this->getFields();
foreach ($this->_fields as $i=>$f) {
if ($filter($f))
unset($this->_fields[$i]);
}
}
function getSource() {
return $this->_source ?: (isset($this->id) ? false : $_POST);
}
......
......@@ -433,7 +433,10 @@ if($ticket) {
$inc = 'ticket-edit.inc.php';
if (!$forms) $forms=DynamicFormEntry::forTicket($ticket->getId());
// Auto add new fields to the entries
foreach ($forms as $f) $f->addMissingFields();
foreach ($forms as $f) {
$f->filterFields(function($f) { return !$f->isStorable(); });
$f->addMissingFields();
}
} elseif($_REQUEST['a'] == 'print' && !$ticket->pdfExport($_REQUEST['psize'], $_REQUEST['notes']))
$errors['err'] = __('Internal error: Unable to export the ticket to PDF for print.');
} else {
......
......@@ -51,6 +51,7 @@ if ($_POST && is_object($ticket) && $ticket->getId()) {
$forms=DynamicFormEntry::forTicket($ticket->getId());
$changes = array();
foreach ($forms as $form) {
$form->filterFields(function($f) { return !$f->isStorable(); });
$form->setSource($_POST);
if (!$form->isValid())
$errors = array_merge($errors, $form->errors());
......@@ -120,7 +121,10 @@ if($ticket && $ticket->checkUserAccess($thisclient)) {
$inc = 'edit.inc.php';
if (!$forms) $forms=DynamicFormEntry::forTicket($ticket->getId());
// Auto add new fields to the entries
foreach ($forms as $f) $f->addMissingFields();
foreach ($forms as $f) {
$f->filterFields(function($f) { return !$f->isStorable(); });
$f->addMissingFields();
}
}
else
$inc='view.inc.php';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment