Work on invoice
This commit is contained in:
34
modules/invoice/classes/Task/Invoice/Complete.php
Normal file
34
modules/invoice/classes/Task/Invoice/Complete.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?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.
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Invoice
|
||||
* @category Task/Invoice
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Open Source Billing
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user