Fixes a bug when editing My Account

This commit is contained in:
Sam Georges 2014-07-12 18:45:13 +10:00
parent 3e2755f297
commit b121e03608
2 changed files with 6 additions and 8 deletions

View File

@ -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;
}
}
}
}

View File

@ -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