Skip to content

Commit

Permalink
CIVIQBO-110 Better error messages when tax code can't be loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
agileware-fj authored and agileware-dev committed Oct 21, 2024
1 parent 9c71c66 commit cdbc82c
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions CRM/Civiquickbooks/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,18 @@ protected function mapToAccounts($db_contribution, $accountsID, $SyncToken, $qb_

$tax_codes[] = $tmp;
} catch (CiviCRM_API3_Exception $e) {
$tax_errormsg[] = ts(
'Could not load "Sales Tax Account is" relationship for FinancialType %1. Error: %2',
[
1 => $line_item['financial_type_id'],
2 => $e->getMessage(),
]
);

$tax_types[$line_item['financial_type_id']] = [
'sale_tax_acctgCode' => NULL,
'sale_tax_account_type_code' => NULL,
];
}
}

Expand All @@ -570,8 +581,6 @@ protected function mapToAccounts($db_contribution, $accountsID, $SyncToken, $qb_

$i = 1;

$QBO_errormsg = [];

$item_errormsg = [];

$tax_errormsg = [];
Expand Down Expand Up @@ -632,12 +641,13 @@ protected function mapToAccounts($db_contribution, $accountsID, $SyncToken, $qb_
],
'UnitPrice' => $lineTotal / $line_item['qty'] * 1.00,
'Qty' => $line_item['qty'] * 1,
'TaxCodeRef' => [
'value' => $line_item_tax_ref,
],
],
];

if(!empty($line_item_tax_ref)) {
$tmp['SalesItemLineDetail']['TaxCodeRef'] = [ 'value' => $line_item_tax_ref ];
}

$line_items[] = $tmp;
$i += 1;
}
Expand Down

0 comments on commit cdbc82c

Please sign in to comment.