First start at retiring Affiliate in favour of RTM

This commit is contained in:
Deon George
2013-04-05 09:42:29 +11:00
parent 9d4b2f50ff
commit 43dfd88bce
49 changed files with 680 additions and 570 deletions

View File

@@ -9,12 +9,52 @@
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Controller_User_Account extends Controller_TemplateDefault_User {
class Controller_User_Account extends Controller_Account {
protected $secure_actions = array(
'edit'=>TRUE,
'resetpassword'=>TRUE,
);
/**
* Enable User to Edit their Account Details
*/
public function action_edit() {
// Store our new values
$this->ao->values($_POST);
// Run validation and save
if ($this->ao->changed())
if ($this->ao->check()) {
SystemMessage::add(array(
'title'=>_('Record updated'),
'type'=>'info',
'body'=>_('Your account record has been updated.')
));
$this->ao->save();
} else {
$output = '';
foreach ($this->ao->validation()->errors('forms/login') as $field => $error)
$output .= sprintf('<li><b>%s</b> %s</li>',$field,$error);
if ($output)
$output = sprintf('<ul>%s</ul>',$output);
SystemMessage::add(array(
'title'=>_('Record NOT updated'),
'type'=>'error',
'body'=>_('Your updates didnt pass validation.').'<br/>'.$output,
));
}
Block::add(array(
'title'=>sprintf('%s: %s - %s',_('Account Edit'),$this->ao->accnum(),$this->ao->name(TRUE)),
'body'=>View::factory($this->viewpath())
->set('record',$this->ao),
));
}
public function action_resetpassword() {
// @todo Fix this next logic, since matches_ifset is not being called when the value is on the form, but empty
if (empty($_POST['password_confirm']))
@@ -60,45 +100,5 @@ class Controller_User_Account extends Controller_TemplateDefault_User {
->set('record',$this->ao),
));
}
/**
* Show a product
*/
public function action_edit() {
// Store our new values
$this->ao->values($_POST);
// Run validation and save
if ($this->ao->changed())
if ($this->ao->check()) {
SystemMessage::add(array(
'title'=>_('Record updated'),
'type'=>'info',
'body'=>_('Your account record has been updated.')
));
$this->ao->save();
} else {
$output = '';
foreach ($this->ao->validation()->errors('forms/login') as $field => $error)
$output .= sprintf('<li><b>%s</b> %s</li>',$field,$error);
if ($output)
$output = sprintf('<ul>%s</ul>',$output);
SystemMessage::add(array(
'title'=>_('Record NOT updated'),
'type'=>'error',
'body'=>_('Your updates didnt pass validation.').'<br/>'.$output,
));
}
Block::add(array(
'title'=>sprintf('%s: %s - %s',_('Account Edit'),$this->ao->accnum(),$this->ao->name(TRUE)),
'body'=>View::factory($this->viewpath())
->set('record',$this->ao),
));
}
}
?>

View File

@@ -9,17 +9,16 @@
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Controller_User_Welcome extends Controller_TemplateDefault_User {
class Controller_User_Welcome extends Controller_Welcome {
protected $auth_required = TRUE;
protected $secure_actions = array(
'index'=>FALSE,
);
'index'=>TRUE,
);
public function action_index() {
$ao = ORM::factory('Account',Auth::instance()->get_user()->id);
Block::add(array(
'title'=>sprintf('%s: %s %s',$ao->accnum(),$ao->first_name,$ao->last_name),
'body'=>'Please select from the tree on the left',
'title'=>sprintf('%s: %s',$this->ao->accnum(),$this->ao->name(TRUE)),
'body'=>View::factory('welcome/user'),
));
}
}