Open Source Billing
This commit is contained in:
33
application/classes/Task/Account/Complete.php
Normal file
33
application/classes/Task/Account/Complete.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* Mark all accounts that have no outstanding invoices and active services as disabled.
|
||||
*
|
||||
* @package Account
|
||||
* @category Tasks
|
||||
* @author Deon George
|
||||
* @copyright (c) 2009-2013 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Task_Account_Complete extends Task {
|
||||
protected function _execute(array $params) {
|
||||
$c = 0;
|
||||
|
||||
$o = ORM::factory('Account')
|
||||
->where_active();
|
||||
|
||||
foreach ($o->find_all() as $ao) {
|
||||
if (count($ao->invoice->where_unprocessed()->find_all()) == 0 AND count($ao->service->where_active()->find_all()) == 0)
|
||||
// @todo Cant update status=0, problem with sessions in CLI
|
||||
echo $ao->id.',';
|
||||
|
||||
$ao->save();
|
||||
|
||||
if ($ao->saved())
|
||||
$c++;
|
||||
}
|
||||
|
||||
printf('%s services updated',$c);
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user