<?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 Minion_Task { protected function _execute(array $params) { $c = array(); $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) $ao->status = 0; $ao->save(); if ($ao->saved()) array_push($c,$ao->id); } printf("%s accounts made inactive (%s)\n",count($c),join('|',$c)); } } ?>