1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 06:32:40 +01:00

Merge pull request #5632 from beganovich/v5-0605-tax-rate-fixes

(v5) Fixing the 500 when using negative taxes
This commit is contained in:
Benjamin Beganović 2021-05-06 12:46:51 +02:00 committed by GitHub
commit 8f2a1f657b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -318,36 +318,24 @@ trait MakesInvoiceValues
$data[$key][$table_type.'.discount'] = '';
}
if (isset($item->tax_rate1) && $item->tax_rate1 > 0) {
// Previously we used to check for tax_rate value,
// but that's no longer necessary.
if (isset($item->tax_rate1)) {
$data[$key][$table_type.'.tax_rate1'] = round($item->tax_rate1, 2).'%';
$data[$key][$table_type.'.tax1'] = &$data[$key][$table_type.'.tax_rate1'];
}
if (isset($item->tax_rate2) && $item->tax_rate2 > 0) {
if (isset($item->tax_rate2)) {
$data[$key][$table_type.'.tax_rate2'] = round($item->tax_rate2, 2).'%';
$data[$key][$table_type.'.tax2'] = &$data[$key][$table_type.'.tax_rate2'];
}
if (isset($item->tax_rate3) && $item->tax_rate3 > 0) {
if (isset($item->tax_rate3)) {
$data[$key][$table_type.'.tax_rate3'] = round($item->tax_rate3, 2).'%';
$data[$key][$table_type.'.tax3'] = &$data[$key][$table_type.'.tax_rate3'];
}
if (isset($item->tax_rate1) && $item->tax_rate1 == 0) {
$data[$key][$table_type.'.tax_rate1'] = '';
$data[$key][$table_type.'.tax1'] = &$data[$key][$table_type.'.tax_rate1'];
}
if (isset($item->tax_rate2) && $item->tax_rate2 == 0) {
$data[$key][$table_type.'.tax_rate2'] = '';
$data[$key][$table_type.'.tax2'] = &$data[$key][$table_type.'.tax_rate2'];
}
if (isset($item->tax_rate3) && $item->tax_rate3 == 0) {
$data[$key][$table_type.'.tax_rate3'] = '';
$data[$key][$table_type.'.tax3'] = &$data[$key][$table_type.'.tax_rate3'];
}
$data[$key]['task_id'] = optional($item)->task_id;
}