Merge pull request #9908 from turbo124/v5-develop

v5.10.23
This commit is contained in:
David Bomba 2024-08-14 23:35:22 +10:00 committed by GitHub
commit 2481a44c6d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 37 additions and 6 deletions

View File

@ -1 +1 @@
5.10.22
5.10.23

View File

@ -130,9 +130,8 @@ class BaseRule implements RuleInterface
return $this;
}
public function shouldCalcTax(): bool
{
return $this->should_calc_tax;
public function shouldCalcTax(): bool {
return $this->should_calc_tax && $this->checkIfInvoiceLocked();
}
/**
* Initializes the tax rule for the entity.
@ -400,4 +399,36 @@ class BaseRule implements RuleInterface
return ! in_array($iso_3166_2, array_merge($this->eu_country_codes, array_keys($this->region_codes)));
}
private function checkIfInvoiceLocked(): bool
{
$lock_invoices = $this->client->getSetting('lock_invoices');
switch ($lock_invoices) {
case 'off':
return true;
case 'when_sent':
if ($this->invoice->status_id == Invoice::STATUS_SENT) {
return false;
}
return true;
case 'when_paid':
if ($this->invoice->status_id == Invoice::STATUS_PAID) {
return false;
}
return true;
//if now is greater than the end of month the invoice was dated - do not modify
case 'end_of_month':
if(\Carbon\Carbon::parse($this->invoice->date)->setTimezone($this->invoice->company->timezone()->name)->endOfMonth()->lte(now())) {
return false;
}
return true;
default:
return true;
}
}
}

View File

@ -17,8 +17,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => env('APP_VERSION', '5.10.22'),
'app_tag' => env('APP_TAG', '5.10.22'),
'app_version' => env('APP_VERSION', '5.10.23'),
'app_tag' => env('APP_TAG', '5.10.23'),
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', false),