Replace status with active in tables
This commit is contained in:
@@ -118,7 +118,7 @@ class Auth_OSB extends Auth_ORM {
|
||||
$password = $this->hash($password);
|
||||
|
||||
// If the passwords match, perform a login
|
||||
if ($user->status AND $user->has_any('group',ORM::factory('Group',array('name'=>'Registered Users'))->list_childgrps(TRUE)) AND $user->password === $password) {
|
||||
if ($user->active AND $user->has_any('group',ORM::factory('Group',array('name'=>'Registered Users'))->list_childgrps(TRUE)) AND $user->password === $password) {
|
||||
|
||||
// @todo This is not currently used.
|
||||
if ($remember === TRUE) {
|
||||
|
@@ -21,7 +21,7 @@ class Company {
|
||||
if (! $this->so->loaded())
|
||||
throw new Kohana_Exception(_('Site [:site] not defined in DB?'),array(':site'=>URL::base('http')));
|
||||
|
||||
Kohana::$environment = (int)$this->so->status;
|
||||
Kohana::$environment = (int)$this->so->active;
|
||||
}
|
||||
|
||||
public static function instance() {
|
||||
|
@@ -43,7 +43,7 @@ class Controller_Reseller_Account extends Controller_Account {
|
||||
public function action_view() {
|
||||
$ao = ORM::factory('Account',$this->request->param('id'));
|
||||
|
||||
if (! $ao->loaded() OR ! $ao->status OR ! Auth::instance()->authorised($ao))
|
||||
if (! $ao->loaded() OR ! $ao->active OR ! Auth::instance()->authorised($ao))
|
||||
throw HTTP_Exception::factory(403,'Account either doesnt exist, or you are not authorised to see it');
|
||||
|
||||
$this->meta->title = 'Customer: '.$ao->name();
|
||||
|
@@ -31,15 +31,15 @@ class Model_Account extends lnApp_Model_Account {
|
||||
);
|
||||
|
||||
protected $_display_filters = array(
|
||||
'active'=>array(
|
||||
array('StaticList_YesNo::get',array(':value',TRUE)),
|
||||
),
|
||||
'date_orig'=>array(
|
||||
array('Site::Date',array(':value')),
|
||||
),
|
||||
'date_last'=>array(
|
||||
array('Site::Date',array(':value')),
|
||||
),
|
||||
'status'=>array(
|
||||
array('StaticList_YesNo::get',array(':value',TRUE)),
|
||||
),
|
||||
);
|
||||
|
||||
/** REQUIRED ABSTRACT METHODS **/
|
||||
|
@@ -19,7 +19,7 @@ class Model_Group extends Model_Auth_Role {
|
||||
);
|
||||
|
||||
protected $_display_filters = array(
|
||||
'status'=>array(
|
||||
'active'=>array(
|
||||
array('StaticList_YesNo::get',array(':value',TRUE)),
|
||||
),
|
||||
);
|
||||
|
@@ -1,55 +0,0 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* OSB Application Module Model
|
||||
*
|
||||
* This module must remain in applications/ as it is used very early in the
|
||||
* OSB initialisation.
|
||||
*
|
||||
* @package OSB
|
||||
* @category Models
|
||||
* @author Deon George
|
||||
* @copyright (c) 2009-2013 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Model_Module extends ORM {
|
||||
// Relationships
|
||||
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(
|
||||
'name'=>'ASC',
|
||||
);
|
||||
|
||||
protected $_display_filters = array(
|
||||
'external'=>array(
|
||||
array('StaticList_YesNo::get',array(':value',TRUE)),
|
||||
),
|
||||
'name'=>array(
|
||||
array('strtoupper',array(':value')),
|
||||
),
|
||||
'status'=>array(
|
||||
array('StaticList_YesNo::get',array(':value',TRUE)),
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Return an instance of this Module's Model
|
||||
*
|
||||
* @param $id PK of Model
|
||||
*/
|
||||
public function instance($id=NULL) {
|
||||
if (! $this->loaded())
|
||||
throw new Kohana_Exception('Cant call an instance of a model when it is not loaded');
|
||||
|
||||
return ORM::factory(Kohana::classname($this->name),$id);
|
||||
}
|
||||
|
||||
public function list_external() {
|
||||
return $this->_where_active()->where('external','=',TRUE)->find_all();
|
||||
}
|
||||
}
|
||||
?>
|
@@ -45,13 +45,6 @@ abstract class ORM extends lnApp_ORM {
|
||||
return parent::_build($type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function help to find records that are active
|
||||
*/
|
||||
final protected function _where_active() {
|
||||
return $this->where('status','=',TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the account is authoised by the user
|
||||
*/
|
||||
@@ -188,13 +181,23 @@ abstract class ORM extends lnApp_ORM {
|
||||
* Function help to find records that are active
|
||||
*/
|
||||
final public function list_active($active=TRUE) {
|
||||
$x=($active ? $this->_where_active() : $this);
|
||||
$x=($active ? $this->where_active() : $this);
|
||||
|
||||
return $x->find_all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function help to find records that are active
|
||||
*/
|
||||
final public function where_active() {
|
||||
return $this->_where_active();
|
||||
return $this->where($this->_table_name.'.active','=',TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function help to find records that are inactive
|
||||
*/
|
||||
final public function where_inactive() {
|
||||
return $this->where_open()->where($this->_table_name.'.active','=',FALSE)->or_where($this->_table_name.'.active','IS',NULL)->where_close();
|
||||
}
|
||||
|
||||
// @todo This function shouldnt be here.
|
||||
|
@@ -26,7 +26,7 @@ class Request extends lnApp_Request {
|
||||
|
||||
$mo = ORM::factory('Module',array('name'=>$c));
|
||||
|
||||
if ($mo->loaded() AND $mo->status) {
|
||||
if ($mo->loaded() AND $mo->active) {
|
||||
$method = strtolower($this->_directory ? sprintf('%s:%s',$this->_directory.($x ? '_'.$x : ''),$this->_action) : $this->_action);
|
||||
|
||||
// Get the method number
|
||||
|
@@ -18,7 +18,7 @@ class Task_Account_Complete extends Minion_Task {
|
||||
|
||||
foreach ($o->find_all() as $ao) {
|
||||
if (count($ao->invoice->where_unprocessed()->find_all()) == 0 AND count($ao->service->where_active()->find_all()) == 0)
|
||||
$ao->status = 0;
|
||||
$ao->active = 0;
|
||||
|
||||
$ao->save();
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
->jssort('customer')
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'status'=>'Active',
|
||||
'active'=>'Active',
|
||||
'refnum()'=>'Num',
|
||||
'name()'=>'Account',
|
||||
'email'=>'Email',
|
||||
|
@@ -5,6 +5,6 @@
|
||||
->title(sprintf('InActive Services for Account: %s',$o->refnum()))
|
||||
->title_icon('fa fa-barcode')
|
||||
->span(6)
|
||||
->body(View::factory('service/user/list/inactive')->set('o',$o->service->where('status','!=',1)->or_where('status','IS',null)->find_all())); ?>
|
||||
->body(View::factory('service/user/list/inactive')->set('o',$o->service->where_inactive()->find_all())); ?>
|
||||
|
||||
<?php echo View::factory('invoice/user/next')->set('o',$o); ?>
|
||||
|
Reference in New Issue
Block a user