From b121e03608135c921673d3b02d9ca293ca28c66a Mon Sep 17 00:00:00 2001 From: Sam Georges Date: Sat, 12 Jul 2014 18:45:13 +1000 Subject: [PATCH] Fixes a bug when editing My Account --- modules/backend/behaviors/FormController.php | 12 +++++------- modules/backend/controllers/Users.php | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/modules/backend/behaviors/FormController.php b/modules/backend/behaviors/FormController.php index 981671e14..589d626fb 100644 --- a/modules/backend/behaviors/FormController.php +++ b/modules/backend/behaviors/FormController.php @@ -137,9 +137,9 @@ class FormController extends ControllerBehavior * Ajax handler for saving from the creation form. * @return mixed */ - public function create_onSave() + public function create_onSave($context = null) { - $this->context = $this->getConfig('update[context]', 'create'); + $this->context = strlen($context) ? $context : $this->getConfig('create[context]', 'create'); $model = $this->controller->formCreateModelObject(); $this->initForm($model); @@ -190,9 +190,9 @@ class FormController extends ControllerBehavior * @param int $recordId The model primary key to update. * @return mixed */ - public function update_onSave($recordId = null) + public function update_onSave($recordId = null, $context = null) { - $this->context = $this->getConfig('update[context]', 'update'); + $this->context = strlen($context) ? $context : $this->getConfig('update[context]', 'update'); $model = $this->controller->formFindModelObject($recordId); $this->initForm($model); @@ -259,7 +259,6 @@ class FormController extends ControllerBehavior } } - // // Utils // @@ -596,5 +595,4 @@ class FormController extends ControllerBehavior $model->{$attribute} = $value; } } - -} \ No newline at end of file +} diff --git a/modules/backend/controllers/Users.php b/modules/backend/controllers/Users.php index 5ff369d7b..454bd57a5 100644 --- a/modules/backend/controllers/Users.php +++ b/modules/backend/controllers/Users.php @@ -65,7 +65,7 @@ class Users extends Controller */ public function myaccount_onSave() { - $result = $this->getClassExtension('Backend.Behaviors.FormController')->update_onSave($this->user->id); + $result = $this->getClassExtension('Backend.Behaviors.FormController')->update_onSave($this->user->id, 'mysettings'); /* * If the password or login name has been updated, reauthenticate the user