Some cleanup, setup improvements and other misc items
This commit is contained in:
@@ -47,7 +47,7 @@ class Controller_Reseller_Service_Adsl extends Controller_Service {
|
||||
}
|
||||
|
||||
public function action_list() {
|
||||
$svs = ORM::factory('Service')->where('account_id','IN',$this->ao->RTM->customers($this->ao->RTM))->list_byplugin('ADSL');
|
||||
$svs = ORM::factory('Service')->where_authorised($this->ao)->list_byplugin('ADSL');
|
||||
|
||||
$data = $this->consoltraffic($svs,time());
|
||||
|
||||
|
@@ -148,15 +148,16 @@ $(document).ready(function() {
|
||||
->title_icon('icon-th-list')
|
||||
->body(Table::factory()
|
||||
->page_items(50)
|
||||
->data(ORM::factory('Charge')->where('account_id','IN',$this->ao->RTM->customers($this->ao->RTM))->order_by('id DESC')->find_all())
|
||||
->data(ORM::factory('Charge')->where_authorised('account_id',$this->ao)->where('void','is',NULL)->order_by('id DESC')->find_all())
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'date_orig'=>'Processed',
|
||||
'date_charge'=>'Date',
|
||||
'processed(TRUE)'=>'Processed',
|
||||
'invoice_item->invoice_id'=>'Invoice',
|
||||
'sweep_type'=>'Sweep',
|
||||
'status'=>'Status',
|
||||
'quantity'=>'Quantity',
|
||||
'amount'=>'Amount',
|
||||
'total(TRUE)'=>'Total',
|
||||
'description'=>'Description',
|
||||
'service_id'=>'Service',
|
||||
'account->accnum()'=>'Cust ID',
|
||||
@@ -164,6 +165,7 @@ $(document).ready(function() {
|
||||
))
|
||||
->prepend(array(
|
||||
'id'=>array('url'=>URL::link('reseller','charge/edit/')),
|
||||
'invoice_item->invoice_id'=>array('url'=>URL::link('user','invoice/view/')),
|
||||
))
|
||||
);
|
||||
}
|
||||
|
@@ -13,6 +13,9 @@ class Model_Charge extends ORM_OSB {
|
||||
protected $_belongs_to = array(
|
||||
'account'=>array(),
|
||||
);
|
||||
protected $_has_one = array(
|
||||
'invoice_item'=>array('far_key'=>'id'),
|
||||
);
|
||||
|
||||
protected $_nullifempty = array(
|
||||
'attributes',
|
||||
@@ -23,14 +26,23 @@ class Model_Charge extends ORM_OSB {
|
||||
);
|
||||
|
||||
protected $_display_filters = array(
|
||||
'amount'=>array(
|
||||
array('Currency::display',array(':value')),
|
||||
),
|
||||
'date_orig'=>array(
|
||||
array('Config::date',array(':value')),
|
||||
),
|
||||
'date_charge'=>array(
|
||||
array('Config::date',array(':value')),
|
||||
),
|
||||
'amount'=>array(
|
||||
array('Currency::display',array(':value')),
|
||||
'processed'=>array(
|
||||
array('StaticList_YesNo::get',array(':value')),
|
||||
),
|
||||
'sweep_type'=>array(
|
||||
array('StaticList_SweepType::get',array(':value')),
|
||||
),
|
||||
'void'=>array(
|
||||
array('StaticList_YesNo::get',array(':value')),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -47,6 +59,10 @@ class Model_Charge extends ORM_OSB {
|
||||
}
|
||||
}
|
||||
|
||||
public function processed($render=FALSE) {
|
||||
return $this->label_bool('processed',$render);
|
||||
}
|
||||
|
||||
public function total($format=FALSE) {
|
||||
$result = $this->quantity * $this->amount;
|
||||
|
||||
|
@@ -20,7 +20,7 @@ class Controller_Reseller_Service_Domain extends Controller_Service {
|
||||
->title_icon('icon-th-list')
|
||||
->body(Table::factory()
|
||||
->jssort('domain')
|
||||
->data(ORM::factory('Service')->where('account_id','IN',$this->ao->RTM->customers($this->ao->RTM))->list_byplugin('DOMAIN'))
|
||||
->data(ORM::factory('Service')->where_authorised($this->ao)->list_byplugin('DOMAIN'))
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'name()'=>'Service',
|
||||
|
@@ -20,7 +20,7 @@ class Controller_Reseller_Service_Host extends Controller_Service {
|
||||
->title_icon('icon-th-list')
|
||||
->body(Table::factory()
|
||||
->jssort('host')
|
||||
->data(ORM::factory('Service')->where('account_id','IN',$this->ao->RTM->customers($this->ao->RTM))->list_byplugin('HOST'))
|
||||
->data(ORM::factory('Service')->where_authorised($this->ao)->list_byplugin('HOST'))
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'name()'=>'Service',
|
||||
|
@@ -20,7 +20,7 @@ class Controller_Reseller_Invoice extends Controller_Invoice {
|
||||
->title_icon('icon-th-list')
|
||||
->body(Table::factory()
|
||||
->jssort('invoices')
|
||||
->data(ORM::factory('Invoice')->where('account_id','IN',$this->ao->RTM->customers($this->ao->RTM))->where_active()->find_all())
|
||||
->data(ORM::factory('Invoice')->where_authorised('account_id',$this->ao)->where_active()->find_all())
|
||||
->page_items(25)
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
|
@@ -657,7 +657,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
||||
static $result = array();
|
||||
|
||||
if (! $result)
|
||||
foreach ($this->_where_active()->_where_unprocessed()->find_all() as $io)
|
||||
foreach ($this->_where_active()->_where_unprocessed()->where_authorised()->find_all() as $io)
|
||||
if ($io->due())
|
||||
array_push($result,$io);
|
||||
|
||||
@@ -713,12 +713,12 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
||||
public function list_due($time=NULL) {
|
||||
$result = array();
|
||||
|
||||
if (is_null($time))
|
||||
$time = time();
|
||||
|
||||
foreach ($this->_list_due() as $io)
|
||||
if (is_null($time) OR $io->due_date > time())
|
||||
if (is_null($time))
|
||||
array_push($result,$io);
|
||||
elseif ($io->due_date <= $time)
|
||||
array_push($result,$io);
|
||||
if ($io->due_date > $time)
|
||||
array_push($result,$io);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
class Task_Invoice_Complete extends Minion_Task {
|
||||
protected function _execute(array $params) {
|
||||
$c = 0;
|
||||
$c = array();
|
||||
|
||||
$o = ORM::factory('Invoice')
|
||||
->where_unprocessed();
|
||||
@@ -23,10 +23,10 @@ class Task_Invoice_Complete extends Minion_Task {
|
||||
$io->save();
|
||||
|
||||
if ($io->saved())
|
||||
$c++;
|
||||
array_push($c,$io->id);
|
||||
}
|
||||
|
||||
return sprintf('%s invoices updated',$c);
|
||||
return sprintf('%s invoices updated (%s)',count($c),join('|',$c));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
class Task_Invoice_Service extends Minion_Task {
|
||||
protected $_options = array(
|
||||
'days'=>1, // Days in advance to generate for
|
||||
'days'=>0, // Days in advance to generate for
|
||||
'id'=>NULL, // Service invoice to generate for
|
||||
);
|
||||
|
||||
|
Submodule modules/lnApp updated: 9e191ab0be...45cadf0945
@@ -23,7 +23,7 @@ class Controller_Reseller_Payment extends Controller_Payment {
|
||||
->title_icon('icon-th-list')
|
||||
->body(Table::factory()
|
||||
->page_items(50)
|
||||
->data(ORM::factory('Payment')->where('account_id','IN',$this->ao->RTM->customers($this->ao->RTM))->find_all())
|
||||
->data(ORM::factory('Payment')->where_authorised($this->ao)->find_all())
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'date_payment'=>'Date',
|
||||
|
@@ -25,7 +25,7 @@ class Controller_Reseller_Service extends Controller_Service {
|
||||
->title_icon('icon-th-list')
|
||||
->body(Table::factory()
|
||||
->jssort('services')
|
||||
->data(ORM::factory('Service')->where('account_id','IN',$this->ao->RTM->customers($this->ao->RTM))->find_all())
|
||||
->data(ORM::factory('Service')->where_authorised($this->ao)->find_all())
|
||||
->columns(array(
|
||||
'id'=>'ID',
|
||||
'service_name()'=>'Service',
|
||||
@@ -49,7 +49,7 @@ class Controller_Reseller_Service extends Controller_Service {
|
||||
// @todo This needs to be configurable
|
||||
$go = ORM::factory('Group',array('name'=>'Personal'));
|
||||
|
||||
foreach (ORM::factory('Account')->where_active()->where('id','IN',$this->ao->RTM->customers($this->ao->RTM))->find_all() as $ao)
|
||||
foreach (ORM::factory('Account')->where_active()->where_authoised($this->ao,'id')->find_all() as $ao)
|
||||
if ($ao->has_any('group',array($go)))
|
||||
foreach ($ao->service->list_active() as $so)
|
||||
if (! $so->service_billing->checkout_id)
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class provides Admin TASK management
|
||||
* This class provides TASK management
|
||||
*
|
||||
* @package Task
|
||||
* @category Controllers
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* List all Active Tasks defined in the DB
|
||||
* List all Tasks defined in the DB
|
||||
*
|
||||
* @package Task
|
||||
* @category Tasks
|
||||
@@ -9,15 +9,24 @@
|
||||
* @copyright (c) 2009-2013 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Task_Task_Listactive extends Minion_Task {
|
||||
class Task_Task_List extends Minion_Task {
|
||||
protected $_options = array(
|
||||
'active'=>0, // Show only active services
|
||||
);
|
||||
|
||||
protected function _execute(array $params) {
|
||||
$header = "%2s %30s %21s %21s %40s\n";
|
||||
$header = "%2s %1s %30s %21s %21s %40s\n";
|
||||
|
||||
$output = sprintf($header,'ID','Command','Last Run','Next Run','Description');
|
||||
$output = sprintf($header,'ID','?','Command','Last Run','Next Run','Description');
|
||||
|
||||
foreach (ORM::factory('Task')->list_active() as $to)
|
||||
$t = ORM::factory('Task');
|
||||
if ($params['active'])
|
||||
$t->where_active();
|
||||
|
||||
foreach ($t->find_all() as $to)
|
||||
$output .= sprintf($header,
|
||||
$to->id,
|
||||
$to->status ? 'A' : 'I',
|
||||
$to->command,
|
||||
$to->display('date_run'),
|
||||
$to->next_run(TRUE),
|
Reference in New Issue
Block a user