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

33 lines
696 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 invoices that have been paid as complete, so that they are not processed again.
*
* @package Invoice
* @category Tasks
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Task_Invoice_Complete extends Minion_Task {
2013-10-10 02:44:53 +00:00
protected function _execute(array $params) {
$c = 0;
$o = ORM::factory('Invoice')
->where_unprocessed();
foreach ($o->find_all() as $io) {
if ($io->due() == 0)
$io->process_status = 1;
$io->save();
if ($io->saved())
$c++;
}
2013-07-06 14:00:10 +00:00
return sprintf('%s invoices updated',$c);
2013-10-10 02:44:53 +00:00
}
}
?>