Standardisation work, changed accnum() to refnum()
This commit is contained in:
parent
c57e166834
commit
01f6c7ba5e
@ -25,7 +25,7 @@ abstract class lnApp_Controller_User_Account extends Controller_Account {
|
|||||||
$this->ao->reload();
|
$this->ao->reload();
|
||||||
|
|
||||||
Block::factory()
|
Block::factory()
|
||||||
->title(sprintf('Account: %s',$this->ao->accnum()))
|
->title(sprintf('Account: %s',$this->ao->refnum()))
|
||||||
->title_icon('fa-wrench')
|
->title_icon('fa-wrench')
|
||||||
->type('form-horizontal')
|
->type('form-horizontal')
|
||||||
->body(View::factory('account/user/edit')->set('o',$this->ao));
|
->body(View::factory('account/user/edit')->set('o',$this->ao));
|
||||||
@ -64,7 +64,7 @@ abstract class lnApp_Controller_User_Account extends Controller_Account {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Block::factory()
|
Block::factory()
|
||||||
->title(sprintf('Password Reset: %s',$this->ao->accnum()))
|
->title(sprintf('Password Reset: %s',$this->ao->refnum()))
|
||||||
->title_icon('fa-cog')
|
->title_icon('fa-cog')
|
||||||
->id('reset')
|
->id('reset')
|
||||||
->type('form-horizontal')
|
->type('form-horizontal')
|
||||||
|
@ -34,19 +34,30 @@ abstract class lnApp_Model_Account extends Model_Auth_UserDefault {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
protected $_form = array('id'=>'id','value'=>'name(TRUE)');
|
protected $_form = array('id'=>'id','value'=>'name()');
|
||||||
|
|
||||||
protected $_save_message = TRUE;
|
protected $_save_message = TRUE;
|
||||||
|
|
||||||
|
/** REQUIRED ABSTRACT METHODS **/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an account name
|
||||||
|
*/
|
||||||
|
public function name($variable=NULL) {
|
||||||
|
return trim(sprintf('%s %s',$this->first_name,$this->last_name));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function refnum($short=FALSE) {
|
||||||
|
return ($short ? '' : sprintf('%02s-',Site::id())).sprintf('%04s',$this->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** LOCAL METHODS **/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Our account number format
|
* Our account number format
|
||||||
*/
|
*/
|
||||||
public function accnum() {
|
|
||||||
return sprintf('%s-%04s',Company::instance()->site(TRUE),$this->id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function activate_code() {
|
public function activate_code() {
|
||||||
return md5(sprintf('%s-%s-%s-%s',$this->accnum(),$this->date_orig,$this->date_last,$this->email));
|
return md5(sprintf('%s-%s-%s-%s',$this->refnum(),$this->date_orig,$this->date_last,$this->email));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function activated() {
|
public function activated() {
|
||||||
@ -101,29 +112,23 @@ abstract class lnApp_Model_Account extends Model_Auth_UserDefault {
|
|||||||
if (empty($result[$mmo->id]))
|
if (empty($result[$mmo->id]))
|
||||||
$result[$mmo->id] = $mmo;
|
$result[$mmo->id] = $mmo;
|
||||||
|
|
||||||
Sort::MAsort($result,'module->name,menu_display');
|
Sort::MAsort($result,array('module->name','menu_display'));
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return an account name
|
|
||||||
*/
|
|
||||||
public function name() {
|
|
||||||
return trim(sprintf('%s %s',$this->first_name,$this->last_name));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a token valid for this user
|
* Return a token valid for this user
|
||||||
*/
|
*/
|
||||||
public function token($token_expire,$module,$method,$uses) {
|
public function token($token_expire,$module,$method,$uses) {
|
||||||
return $this->id.':'.md5(sprintf('%s-%s',$this->accnum(),$this->date_last));
|
return $this->id.':'.md5(sprintf('%s-%s',$this->refnum(),$this->date_last));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search for accounts matching a term
|
* Search for accounts matching a term
|
||||||
*/
|
*/
|
||||||
public function list_autocomplete($term,$index,$value,array $label,array $limit=array(),array $options=NULL) {
|
public function list_autocomplete($term,$index,$value,array $label,array $limit=array(),array $options=NULL) {
|
||||||
|
if (! isset($options['parentbypass'])) {
|
||||||
$ao = Auth::instance()->get_user();
|
$ao = Auth::instance()->get_user();
|
||||||
|
|
||||||
$this->clear();
|
$this->clear();
|
||||||
@ -155,6 +160,7 @@ abstract class lnApp_Model_Account extends Model_Auth_UserDefault {
|
|||||||
|
|
||||||
// Restrict results to authorised accounts
|
// Restrict results to authorised accounts
|
||||||
// @todo
|
// @todo
|
||||||
|
}
|
||||||
|
|
||||||
return parent::list_autocomplete($term,$index,$value,$label,$limit,$options);
|
return parent::list_autocomplete($term,$index,$value,$label,$limit,$options);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user