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/modules/invoice/classes/Task/Invoice/Complete.php

34 lines
701 B
PHP
Raw Normal View History

2013-02-08 11:41:29 +00:00
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* Mark all invoices that have been paid as complete, so that they are not processed again.
*
2013-03-19 22:35:19 +00:00
* @package Invoice
* @category Tasks
2013-02-08 11:41:29 +00:00
* @author Deon George
2013-03-19 22:35:19 +00:00
* @copyright (c) 2009-2013 Open Source Billing
2013-02-08 11:41:29 +00:00
* @license http://dev.osbill.net/license.html
*/
class Task_Invoice_Complete extends Task {
protected function _execute(array $params) {
$c = 0;
$o = ORM::factory('Invoice')
->where_active()
->where_unprocessed();
foreach ($o->find_all() as $io) {
if ($io->due() == 0)
$io->process_status = 1;
$io->save();
if ($io->saved())
$c++;
}
printf('%s invoices updated',$c);
}
}
?>