Prevent e_invoice_type being changed if a legal entity id is present.

This commit is contained in:
David Bomba
2025-12-21 07:50:39 +11:00
parent 0b339e48ca
commit 3c5081aa83

View File

@@ -130,15 +130,26 @@ class UpdateCompanyRequest extends Request
$input['portal_domain'] = rtrim(strtolower($input['portal_domain']), "/");
}
// /** Disabled on the hosted platform */
// if (isset($input['expense_mailbox']) && Ninja::isHosted() && !($this->company->account->isPaid() && $this->company->account->plan == 'enterprise')) {
// unset($input['expense_mailbox']);
// }
if (isset($input['settings'])) {
$input['settings'] = (array) $this->filterSaveableSettings($input['settings']);
}
/**
* @var \App\Models\User $user
*/
$user = auth()->user();
/**
* @var \App\Models\Company $company
*/
$company = $user->company();
if(isset($company->legal_entity_id) && intval($company->legal_entity_id) > 0){
$input['settings']['e_invoice_type'] = 'PEPPOL';
}
if (isset($input['subdomain']) && $this->company->subdomain == $input['subdomain']) {
unset($input['subdomain']);
}