Application cleanup
This commit is contained in:
@@ -97,7 +97,7 @@ class Model_Account extends Model_Auth_UserDefault {
|
||||
}
|
||||
|
||||
public function log($message) {
|
||||
// Log the logout
|
||||
// Log a message for this account
|
||||
$alo = ORM::factory('Account_Log');
|
||||
$alo->account_id = $this->id;
|
||||
$alo->ip = Request::$client_ip;
|
||||
@@ -147,7 +147,7 @@ class Model_Account extends Model_Auth_UserDefault {
|
||||
return $active ? $o->where_active()->find_all() : $o->find_all();
|
||||
}
|
||||
|
||||
public function services_count($active=TRUE,$afid=NULL) {
|
||||
public function services_count($active=TRUE) {
|
||||
return $this->services($active)->count();
|
||||
}
|
||||
|
||||
|
@@ -45,7 +45,7 @@ class Model_Auth_UserDefault extends Model_Auth_User {
|
||||
// Columns to ignore
|
||||
protected $_ignored_columns = array('password_confirm');
|
||||
|
||||
/*
|
||||
/**
|
||||
* Complete our login
|
||||
*
|
||||
* For some database logins, we may not want to record the user last login
|
||||
@@ -53,24 +53,9 @@ class Model_Auth_UserDefault extends Model_Auth_User {
|
||||
* here.
|
||||
*
|
||||
* We can also do some other post-login actions here.
|
||||
* @todo Maybe we can do our session update here.
|
||||
*/
|
||||
public function complete_login() {
|
||||
return $this->log('Logged In');
|
||||
}
|
||||
|
||||
/**
|
||||
* Debug function to see that has() finds
|
||||
* @todo This function could be removed
|
||||
*/
|
||||
public function has_list($alias, $model) {
|
||||
// Return list of matches
|
||||
return DB::select()
|
||||
->from($this->_has_many[$alias]['through'])
|
||||
->where($this->_has_many[$alias]['foreign_key'], '=', $this->pk())
|
||||
->where($this->_has_many[$alias]['far_key'], '=', $model->pk())
|
||||
->execute($this->_db)
|
||||
->as_array();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -10,10 +10,14 @@
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Model_Country extends ORM_OSB {
|
||||
protected $_has_one = array(
|
||||
'currency'=>array('far_key'=>'id'),
|
||||
);
|
||||
|
||||
protected $_form = array('id'=>'id','value'=>'name');
|
||||
|
||||
public function currency() {
|
||||
return ORM::factory('Currency')->where('country_id','=',$this->id)->find();
|
||||
public static function icon() {
|
||||
return HTML::image(sprintf('media/img/country/%s.png',strtolower($this->two_code)),array('alt'=>$this->currency->symbol));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -14,23 +14,10 @@ class Model_Group extends Model_Auth_RoleDefault {
|
||||
'account'=>array('through'=>'account_group'),
|
||||
'module_method'=>array('through'=>'group_method','far_key'=>'method_id'),
|
||||
);
|
||||
|
||||
protected $_sorting = array(
|
||||
'name'=>'ASC',
|
||||
);
|
||||
|
||||
// Validation rules
|
||||
protected $_rules = array(
|
||||
'name' => array(
|
||||
'not_empty' => NULL,
|
||||
'min_length' => array(4),
|
||||
'max_length' => array(32),
|
||||
),
|
||||
'description' => array(
|
||||
'max_length' => array(255),
|
||||
),
|
||||
);
|
||||
|
||||
protected $_display_filters = array(
|
||||
'status'=>array(
|
||||
array('StaticList_YesNo::get',array(':value')),
|
||||
|
@@ -14,13 +14,12 @@
|
||||
*/
|
||||
class Model_Module extends ORM_OSB {
|
||||
// Relationships
|
||||
protected $_has_many = array(
|
||||
'module_method'=>array('far_key'=>'id'),
|
||||
);
|
||||
protected $_has_one = array(
|
||||
'record_id'=>array('model'=>'Record_ID','far_key'=>'id'),
|
||||
);
|
||||
|
||||
protected $_has_many = array(
|
||||
'module_method'=>array('far_key'=>'id'),
|
||||
);
|
||||
protected $_sorting = array(
|
||||
'status'=>'DESC',
|
||||
'name'=>'ASC',
|
||||
|
@@ -13,7 +13,6 @@ class Model_RTM extends ORM_OSB {
|
||||
protected $_belongs_to = array(
|
||||
'account' => array(),
|
||||
);
|
||||
|
||||
protected $_has_many = array(
|
||||
'customer' => array('model'=>'account','far_key'=>'id','foreign_key'=>'rtm_id'),
|
||||
'agent' => array('model'=>'rtm','far_key'=>'id','foreign_key'=>'parent_id'),
|
||||
|
@@ -7,7 +7,6 @@
|
||||
* @author Deon George
|
||||
* @copyright (c) 2009-2013 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
* @todo Rename to Record/ID.php
|
||||
*/
|
||||
class Model_Record_ID extends ORM_OSB {
|
||||
protected $_primary_key = 'module_id';
|
||||
@@ -16,7 +15,6 @@ class Model_Record_ID extends ORM_OSB {
|
||||
protected $_created_column = FALSE;
|
||||
protected $_updated_column = FALSE;
|
||||
|
||||
// @todo we need $mid here, since if there is no record, we cant figure out the module that called us.
|
||||
public function next_id($mid) {
|
||||
if (is_null($this->id)) {
|
||||
$this->module_id = $mid;
|
||||
@@ -34,7 +32,7 @@ class Model_Record_ID extends ORM_OSB {
|
||||
$this->id++;
|
||||
|
||||
if (! $this->save())
|
||||
throw new Koahan_Exception(_('Unable to increase ID for :table'),array(':table'=>$mid));
|
||||
throw HTTP_Exception::factory(501,'Unable to increase ID for :table',array(':table'=>$mid));
|
||||
|
||||
return $this->id;
|
||||
}
|
||||
|
Reference in New Issue
Block a user