This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
khosb/application/classes/Task/Account/Complete.php

34 lines
828 B
PHP
Raw Normal View History

2013-10-10 02:44:53 +00:00
<?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);
}
}
?>