Work on Email and other major consistency work
This commit is contained in:
@@ -50,17 +50,29 @@ abstract class Controller_TemplateDefault extends lnApp_Controller_TemplateDefau
|
||||
parent::after();
|
||||
}
|
||||
|
||||
protected function save(Model $o) {
|
||||
try {
|
||||
$o->save();
|
||||
|
||||
return $o->saved();
|
||||
|
||||
} catch (ORM_Validation_Exception $e) {
|
||||
SystemMessage::factory()
|
||||
->title('Record NOT updated')
|
||||
->type('error')
|
||||
->body(join('<br/>',array_values($e->errors('models'))));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
protected function setup(array $config_items=array()) {
|
||||
$mo = ORM::factory('Module',array('name'=>Request::current()->controller()));
|
||||
if (! $mo->loaded())
|
||||
throw HTTP_Exception::factory(501,'Unknown module :module',array(':module'=>Request::current()->controller()));
|
||||
|
||||
if ($_POST AND isset($_POST['module_config'][$mo->id]))
|
||||
if (Config::instance()->module_config($mo->name,$_POST['module_config'][$mo->id])->save())
|
||||
SystemMessage::factory()
|
||||
->title('Record updated')
|
||||
->type('success')
|
||||
->body(_('Your setup record has been updated.'));
|
||||
Config::instance()->module_config($mo->name,$_POST['module_config'][$mo->id])->save();
|
||||
|
||||
if ($config_items) {
|
||||
Block::factory()
|
||||
@@ -68,7 +80,6 @@ abstract class Controller_TemplateDefault extends lnApp_Controller_TemplateDefau
|
||||
->title_icon('icon-wrench')
|
||||
->type('form-horizontal')
|
||||
->body(View::factory('setup/admin/module')->set('o',Company::instance()->so())->set('mid',$mo->id));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user