30 lines
749 B
PHP
30 lines
749 B
PHP
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
/**
|
|
* Fix up the missing Tax in invoices.
|
|
*
|
|
* @package Invoice
|
|
* @category Tasks
|
|
* @author Deon George
|
|
* @copyright (c) 2009-2013 Open Source Billing
|
|
* @license http://dev.osbill.net/license.html
|
|
*/
|
|
class Task_Devel_Invoice_Fixtax extends Minion_Task {
|
|
protected function _execute(array $params) {
|
|
$c = array();
|
|
|
|
foreach (ORM::factory('Invoice')->find_all() as $io)
|
|
if ($io->due() < 0)
|
|
foreach ($io->subitems() as $iio)
|
|
if ($iio->tax->find_all()->count() === 0) {
|
|
$iio->subitem_add($io->account->country,FALSE);
|
|
$iio->save();
|
|
|
|
array_push($c,$iio);
|
|
}
|
|
|
|
return sprintf('%s items updated (%s)',count($c),join('|',$c));
|
|
}
|
|
}
|
|
?>
|