diff --git a/app/Http/Requests/Company/UpdateCompanyRequest.php b/app/Http/Requests/Company/UpdateCompanyRequest.php index c514193931..c48ee397ee 100644 --- a/app/Http/Requests/Company/UpdateCompanyRequest.php +++ b/app/Http/Requests/Company/UpdateCompanyRequest.php @@ -65,7 +65,7 @@ class UpdateCompanyRequest extends Request $rules['smtp_local_domain'] = 'sometimes|string|nullable'; // $rules['smtp_verify_peer'] = 'sometimes|string'; - // $rules['e_invoice'] = ['sometimes','nullable', new ValidCompanyScheme()]; + $rules['e_invoice'] = ['sometimes','nullable', new ValidCompanyScheme()]; if (isset($input['portal_mode']) && ($input['portal_mode'] == 'domain' || $input['portal_mode'] == 'iframe')) { $rules['portal_domain'] = 'bail|nullable|sometimes|url'; diff --git a/app/Http/ValidationRules/EInvoice/ValidClientScheme.php b/app/Http/ValidationRules/EInvoice/ValidClientScheme.php index ff38a0aad2..f21582559e 100644 --- a/app/Http/ValidationRules/EInvoice/ValidClientScheme.php +++ b/app/Http/ValidationRules/EInvoice/ValidClientScheme.php @@ -34,18 +34,20 @@ class ValidClientScheme implements ValidationRule, ValidatorAwareRule public function validate(string $attribute, mixed $value, Closure $fail): void { - $r = new EInvoice(); - $errors = $r->validateRequest($value['Invoice'], ClientLevel::class); + if(isset($value['Invoice'])) + { + $r = new EInvoice(); + $errors = $r->validateRequest($value['Invoice'], ClientLevel::class); - foreach ($errors as $key => $msg) { + foreach ($errors as $key => $msg) { - $this->validator->errors()->add( - "e_invoice.{$key}", - "{$key} - {$msg}" - ); + $this->validator->errors()->add( + "e_invoice.{$key}", + "{$key} - {$msg}" + ); + } } - } /** diff --git a/app/Http/ValidationRules/EInvoice/ValidCompanyScheme.php b/app/Http/ValidationRules/EInvoice/ValidCompanyScheme.php index bd5777bf30..6c3975d11c 100644 --- a/app/Http/ValidationRules/EInvoice/ValidCompanyScheme.php +++ b/app/Http/ValidationRules/EInvoice/ValidCompanyScheme.php @@ -35,18 +35,21 @@ class ValidCompanyScheme implements ValidationRule, ValidatorAwareRule public function validate(string $attribute, mixed $value, Closure $fail): void { - $r = new EInvoice(); - $errors = $r->validateRequest($value['Invoice'], CompanyLevel::class); - - foreach ($errors as $key => $msg) { + if(isset($value['Invoice'])) + { + $r = new EInvoice(); + $errors = $r->validateRequest($value['Invoice'], CompanyLevel::class); + + foreach ($errors as $key => $msg) { - $this->validator->errors()->add( - "e_invoice.{$key}", - "{$key} - {$msg}" - ); + $this->validator->errors()->add( + "e_invoice.{$key}", + "{$key} - {$msg}" + ); + } } - + } /**