Status updates, SSL updates
This commit is contained in:
@@ -183,8 +183,8 @@ class Controller_Admin_Module extends Controller_Module {
|
||||
'id'=>'ID',
|
||||
'name'=>'Name',
|
||||
'notes'=>'Notes',
|
||||
'status(TRUE)'=>'Active',
|
||||
'external(TRUE)'=>'External',
|
||||
'status'=>'Active',
|
||||
'external'=>'External',
|
||||
))
|
||||
->prepend(array(
|
||||
'id'=>array('url'=>URL::link('admin','module/edit/')),
|
||||
|
@@ -28,7 +28,7 @@ class Controller_Reseller_Account extends Controller_Account {
|
||||
->jssort('customer')
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'status(TRUE)'=>'Active',
|
||||
'status'=>'Active',
|
||||
'accnum()'=>'Num',
|
||||
'name(TRUE)'=>'Account',
|
||||
'email'=>'Email',
|
||||
|
43
application/classes/Controller/Reseller/Summary.php
Normal file
43
application/classes/Controller/Reseller/Summary.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class provides Reseller Summary Stats
|
||||
*
|
||||
* @package OSB
|
||||
* @category Controllers/Reseller
|
||||
* @author Deon George
|
||||
* @copyright (c) 2009-2013 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Controller_Reseller_Summary extends Controller_Account {
|
||||
protected $secure_actions = array(
|
||||
'index'=>TRUE,
|
||||
);
|
||||
|
||||
/**
|
||||
*/
|
||||
public function action_index() {
|
||||
$result = array();
|
||||
|
||||
// ADSL
|
||||
$svs = ORM::factory('Service')->where_authorised()->list_active();
|
||||
foreach ($svs as $so) {
|
||||
if (! isset($result[$so->product->prod_plugin_file][$so->product->supplier()])) {
|
||||
$result[$so->product->prod_plugin_file][$so->product->supplier()]['count'] = 0;
|
||||
$result[$so->product->prod_plugin_file][$so->product->supplier()]['cost'] = 0;
|
||||
$result[$so->product->prod_plugin_file][$so->product->supplier()]['revenue'] = 0;
|
||||
}
|
||||
|
||||
$result[$so->product->prod_plugin_file][$so->product->supplier()]['count']++;
|
||||
$result[$so->product->prod_plugin_file][$so->product->supplier()]['cost'] += $so->product->cost(TRUE);
|
||||
$result[$so->product->prod_plugin_file][$so->product->supplier()]['revenue'] += $so->revenue(TRUE);
|
||||
}
|
||||
|
||||
Block::factory()
|
||||
->title('Revenue / Cost Analysis')
|
||||
->title_icon('icon-info-sign')
|
||||
->span(6)
|
||||
->body(View::factory('summary/reseller/index')->set('o',$result));
|
||||
}
|
||||
}
|
||||
?>
|
@@ -94,7 +94,7 @@ class Controller_Reseller_Welcome extends Controller_Welcome {
|
||||
'date_payment'=>'Pay Date',
|
||||
'account->accnum()'=>'Num',
|
||||
'account->name()'=>'Account',
|
||||
'account->status(TRUE)'=>'Active',
|
||||
'account->status'=>'Active',
|
||||
'total(TRUE)'=>'Total',
|
||||
'balance(TRUE)'=>'Balance',
|
||||
))
|
||||
|
@@ -36,7 +36,7 @@ class Model_Account extends Model_Auth_UserDefault {
|
||||
array('Config::date',array(':value')),
|
||||
),
|
||||
'status'=>array(
|
||||
array('StaticList_YesNo::get',array(':value')),
|
||||
array('StaticList_YesNo::get',array(':value',TRUE)),
|
||||
),
|
||||
);
|
||||
|
||||
|
@@ -1,27 +0,0 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
*
|
||||
* @package OSB
|
||||
* @category Models
|
||||
* @author Deon George
|
||||
* @copyright (c) 2009-2013 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Model_Auth_RoleDefault extends Model_Auth_Role {
|
||||
/**
|
||||
* Show a bootstrap label button for a field with a boolean value
|
||||
*/
|
||||
public function label_bool($column,$render=FALSE) {
|
||||
if (! isset($this->_table_columns[$column]))
|
||||
return NULL;
|
||||
|
||||
if (! $render)
|
||||
return $this->display($column);
|
||||
|
||||
return View::factory(Config::theme().'/label/bool')
|
||||
->set('label',$this->$column ? 'label-success' : '')
|
||||
->set('column',$this->display($column));
|
||||
}
|
||||
}
|
||||
?>
|
@@ -8,7 +8,7 @@
|
||||
* @copyright (c) 2009-2013 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Model_Group extends Model_Auth_RoleDefault {
|
||||
class Model_Group extends Model_Auth_Role {
|
||||
// Relationships
|
||||
protected $_has_many = array(
|
||||
'account'=>array('through'=>'account_group'),
|
||||
@@ -20,7 +20,7 @@ class Model_Group extends Model_Auth_RoleDefault {
|
||||
|
||||
protected $_display_filters = array(
|
||||
'status'=>array(
|
||||
array('StaticList_YesNo::get',array(':value')),
|
||||
array('StaticList_YesNo::get',array(':value',TRUE)),
|
||||
),
|
||||
);
|
||||
|
||||
|
@@ -26,20 +26,16 @@ class Model_Module extends ORM_OSB {
|
||||
|
||||
protected $_display_filters = array(
|
||||
'external'=>array(
|
||||
array('StaticList_YesNo::get',array(':value')),
|
||||
array('StaticList_YesNo::get',array(':value',TRUE)),
|
||||
),
|
||||
'name'=>array(
|
||||
array('strtoupper',array(':value')),
|
||||
),
|
||||
'status'=>array(
|
||||
array('StaticList_YesNo::get',array(':value')),
|
||||
array('StaticList_YesNo::get',array(':value',TRUE)),
|
||||
),
|
||||
);
|
||||
|
||||
public function external($render=FALSE) {
|
||||
return $this->label_bool('external',$render);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance of this Module's Model
|
||||
*
|
||||
|
@@ -65,6 +65,18 @@ abstract class ORM extends Kohana_ORM {
|
||||
return $this->where('status','=',TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the account is authoised by the user
|
||||
*/
|
||||
public function authorised(Model $o=NULL,Model_Account $ao=NULL,$aid='account_id') {
|
||||
if (is_null($o))
|
||||
$o = $this;
|
||||
if (is_null($ao))
|
||||
$ao = Auth::instance()->get_user();
|
||||
|
||||
return in_array($o->{$aid},$ao->RTM->customers($ao->RTM));
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides Kohana cache so that it can be globally disabled.
|
||||
*/
|
||||
@@ -137,21 +149,6 @@ abstract class ORM extends Kohana_ORM {
|
||||
$this->_display_filters = Arr::merge($this->_display_filters,$filters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a bootstrap label button for a field with a boolean value
|
||||
*/
|
||||
public function label_bool($column,$render=FALSE) {
|
||||
if (! isset($this->_table_columns[$column]))
|
||||
return NULL;
|
||||
|
||||
if (! $render)
|
||||
return $this->display($column);
|
||||
|
||||
return View::factory(Config::theme().'/label/bool')
|
||||
->set('label',$this->$column ? 'label-success' : '')
|
||||
->set('column',$this->display($column));
|
||||
}
|
||||
|
||||
/**
|
||||
* Function help to find records that are active
|
||||
*/
|
||||
@@ -218,10 +215,6 @@ abstract class ORM extends Kohana_ORM {
|
||||
return $x;
|
||||
}
|
||||
|
||||
public function status($render=FALSE) {
|
||||
return $this->label_bool('status',$render);
|
||||
}
|
||||
|
||||
public function where_active() {
|
||||
return $this->_where_active();
|
||||
}
|
||||
|
@@ -17,11 +17,13 @@ class StaticList_YesNo extends StaticList {
|
||||
);
|
||||
}
|
||||
|
||||
public static function get($value) {
|
||||
public static function get($value,$format=FALSE) {
|
||||
if (! $value)
|
||||
$value = 0;
|
||||
|
||||
return static::factory()->_get($value);
|
||||
return $format ? View::factory(Config::theme().'/label/bool')
|
||||
->set('label',$value ? 'label-success' : '')
|
||||
->set('column',static::factory()->_get($value)) : $value;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user