Some cleanup, setup improvements and other misc items

This commit is contained in:
Deon George
2013-10-09 16:43:41 +11:00
parent 638d123739
commit c473bf6e7d
54 changed files with 477 additions and 3991 deletions

View File

@@ -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',

View File

@@ -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;
}

View File

@@ -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));
}
}
?>

View File

@@ -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
);