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/Devel/Invoice/Fixtax.php
2018-06-13 21:40:08 +10:00

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));
}
}
?>