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

oops: Avoid handling fields without answers in save

parent 0440111d
No related branches found
No related tags found
No related merge requests found
...@@ -930,12 +930,16 @@ class DynamicFormEntry extends VerySimpleModel { ...@@ -930,12 +930,16 @@ class DynamicFormEntry extends VerySimpleModel {
} }
} }
function save() { function save($refetch=false) {
if (count($this->dirty)) if (count($this->dirty))
$this->set('updated', new SqlFunction('NOW')); $this->set('updated', new SqlFunction('NOW'));
parent::save(); if (!parent::save($refetch || count($this->dirty)))
return false;
foreach ($this->getFields() as $field) { foreach ($this->getFields() as $field) {
$a = $field->getAnswer(); if (!($a = $field->getAnswer()))
continue;
if ($this->object_type == 'U' if ($this->object_type == 'U'
&& in_array($field->get('name'), array('name','email'))) && in_array($field->get('name'), array('name','email')))
continue; continue;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment