mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
commit
2481a44c6d
@ -1 +1 @@
|
||||
5.10.22
|
||||
5.10.23
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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),
|
||||
|
Loading…
x
Reference in New Issue
Block a user