From 97f16f12f941cefc9403b963d9146ffa641ca378 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Tue, 22 Apr 2014 12:12:08 -0500 Subject: [PATCH] Don't clobber custom data for new clients --- include/class.dynamic_forms.php | 6 ++++++ include/class.user.php | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php index af36795fa..cf302780b 100644 --- a/include/class.dynamic_forms.php +++ b/include/class.dynamic_forms.php @@ -166,6 +166,12 @@ class UserForm extends DynamicForm { static::$instance = static::getUserForm()->instanciate(); return static::$instance; } + + static function getNewInstance() { + $o = static::objects(); + static::$instance = $o[0]->instanciate(); + return static::$instance; + } } class TicketForm extends DynamicForm { diff --git a/include/class.user.php b/include/class.user.php index a52c239b2..e8ed94158 100644 --- a/include/class.user.php +++ b/include/class.user.php @@ -252,8 +252,7 @@ class User extends UserModel { } function addDynamicData($data) { - - $uf = UserForm::getInstance(); + $uf = UserForm::getNewInstance(); $uf->setClientId($this->id); foreach ($uf->getFields() as $f) if (isset($data[$f->get('name')])) @@ -267,7 +266,7 @@ class User extends UserModel { if (!isset($this->_entries)) { $this->_entries = DynamicFormEntry::forClient($this->id)->all(); if (!$this->_entries) { - $g = UserForm::getInstance(); + $g = UserForm::getNewInstance(); $g->setClientId($this->id); $g->save(); $this->_entries[] = $g; -- GitLab