1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Catch edge case where client tax data is not configured

This commit is contained in:
David Bomba 2023-07-03 19:28:59 +10:00
parent 0b55e49111
commit 57f6bce7d9

View File

@ -145,11 +145,6 @@ class BaseRule implements RuleInterface
$this->client = $invoice->client;
if(!$this->client->tax_data){
$this->should_calc_tax = false;
return $this;
}
$this->resolveRegions();
if(!$this->isTaxableRegion())
@ -240,7 +235,7 @@ class BaseRule implements RuleInterface
$this->client_region = $this->region_codes[$this->client->country->iso_3166_2];
match($this->client_region){
'US' => $this->client_subregion = strlen($this->invoice?->client?->tax_data?->geoState) > 1 ? $this->invoice->client->tax_data->geoState : $this->getUSState(),
'US' => $this->client_subregion = isset($this->invoice?->client?->tax_data?->geoState) ? $this->invoice->client->tax_data->geoState : $this->getUSState(),
'EU' => $this->client_subregion = $this->client->country->iso_3166_2,
'AU' => $this->client_subregion = 'AU',
default => $this->client_subregion = $this->client->country->iso_3166_2,