diff --git a/app/Http/Requests/Company/UpdateCompanyRequest.php b/app/Http/Requests/Company/UpdateCompanyRequest.php index be71818dd8d7..bfda05924c5a 100644 --- a/app/Http/Requests/Company/UpdateCompanyRequest.php +++ b/app/Http/Requests/Company/UpdateCompanyRequest.php @@ -11,12 +11,15 @@ namespace App\Http\Requests\Company; -use App\DataMapper\CompanySettings; -use App\Http\Requests\Request; -use App\Http\ValidationRules\Company\ValidSubdomain; -use App\Http\ValidationRules\ValidSettingsRule; use App\Utils\Ninja; +use App\Http\Requests\Request; use App\Utils\Traits\MakesHash; +use App\DataMapper\CompanySettings; +use InvoiceNinja\EInvoice\EInvoice; +use App\Http\ValidationRules\ValidSettingsRule; +use InvoiceNinja\EInvoice\Models\Peppol\Invoice; +use App\Http\ValidationRules\EInvoice\ValidScheme; +use App\Http\ValidationRules\Company\ValidSubdomain; class UpdateCompanyRequest extends Request { @@ -64,6 +67,7 @@ class UpdateCompanyRequest extends Request $rules['smtp_local_domain'] = 'sometimes|string|nullable'; // $rules['smtp_verify_peer'] = 'sometimes|string'; + $rules['e_invoice'] = ['sometimes','nullable', new ValidScheme()]; if (isset($input['portal_mode']) && ($input['portal_mode'] == 'domain' || $input['portal_mode'] == 'iframe')) { $rules['portal_domain'] = 'bail|nullable|sometimes|url'; @@ -113,11 +117,6 @@ class UpdateCompanyRequest extends Request $input['smtp_verify_peer'] == 'true' ? true : false; } - // if(isset($input['e_invoice'])){ - // nlog("am i set?"); - // $r = FatturaElettronica::validate($input['e_invoice']); - // } - $this->replace($input); } diff --git a/app/Http/ValidationRules/EInvoice/ValidScheme.php b/app/Http/ValidationRules/EInvoice/ValidScheme.php new file mode 100644 index 000000000000..bdd7a450df57 --- /dev/null +++ b/app/Http/ValidationRules/EInvoice/ValidScheme.php @@ -0,0 +1,62 @@ +validateRequest($value['Invoice'], Invoice::class); + + foreach ($errors as $key => $msg) { + + $this->validator->errors()->add( + "e_invoice.{$key}", + "{$key} - {$msg}" + ); + + } + + } + + /** + * Set the current validator. + */ + public function setValidator(Validator $validator): static + { + $this->validator = $validator; + + return $this; + } + + +} diff --git a/composer.lock b/composer.lock index e904c68fa779..f2bd5cbf964e 100644 --- a/composer.lock +++ b/composer.lock @@ -526,16 +526,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.314.3", + "version": "3.314.4", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "c9e8a31cfa07f47b7ab9ecc741845a3a9d50fc61" + "reference": "fd1261a60495a7aeb2661d8b7eecfd5fc16abd41" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/c9e8a31cfa07f47b7ab9ecc741845a3a9d50fc61", - "reference": "c9e8a31cfa07f47b7ab9ecc741845a3a9d50fc61", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/fd1261a60495a7aeb2661d8b7eecfd5fc16abd41", + "reference": "fd1261a60495a7aeb2661d8b7eecfd5fc16abd41", "shasum": "" }, "require": { @@ -615,9 +615,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.314.3" + "source": "https://github.com/aws/aws-sdk-php/tree/3.314.4" }, - "time": "2024-06-17T18:13:22+00:00" + "time": "2024-06-18T18:13:34+00:00" }, { "name": "bacon/bacon-qr-code", @@ -4173,12 +4173,12 @@ "source": { "type": "git", "url": "https://github.com/invoiceninja/einvoice.git", - "reference": "c26ae46a132b00d9cba5b047218f530ae660ccc7" + "reference": "468a2a3696e76b1216a129e79177eb7c16ea9bdb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/invoiceninja/einvoice/zipball/c26ae46a132b00d9cba5b047218f530ae660ccc7", - "reference": "c26ae46a132b00d9cba5b047218f530ae660ccc7", + "url": "https://api.github.com/repos/invoiceninja/einvoice/zipball/468a2a3696e76b1216a129e79177eb7c16ea9bdb", + "reference": "468a2a3696e76b1216a129e79177eb7c16ea9bdb", "shasum": "" }, "require": { @@ -4220,7 +4220,7 @@ "source": "https://github.com/invoiceninja/einvoice/tree/main", "issues": "https://github.com/invoiceninja/einvoice/issues" }, - "time": "2024-06-12T06:01:18+00:00" + "time": "2024-06-19T00:29:39+00:00" }, { "name": "invoiceninja/inspector", @@ -4725,16 +4725,16 @@ }, { "name": "laravel/framework", - "version": "v10.48.12", + "version": "v10.48.13", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "590afea38e708022662629fbf5184351fa82cf08" + "reference": "2c6816d697a4362c09c066118addda251b70b98a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/590afea38e708022662629fbf5184351fa82cf08", - "reference": "590afea38e708022662629fbf5184351fa82cf08", + "url": "https://api.github.com/repos/laravel/framework/zipball/2c6816d697a4362c09c066118addda251b70b98a", + "reference": "2c6816d697a4362c09c066118addda251b70b98a", "shasum": "" }, "require": { @@ -4928,20 +4928,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2024-05-28T15:46:19+00:00" + "time": "2024-06-18T16:46:35+00:00" }, { "name": "laravel/prompts", - "version": "v0.1.23", + "version": "v0.1.24", "source": { "type": "git", "url": "https://github.com/laravel/prompts.git", - "reference": "9bc4df7c699b0452c6b815e64a2d84b6d7f99400" + "reference": "409b0b4305273472f3754826e68f4edbd0150149" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/prompts/zipball/9bc4df7c699b0452c6b815e64a2d84b6d7f99400", - "reference": "9bc4df7c699b0452c6b815e64a2d84b6d7f99400", + "url": "https://api.github.com/repos/laravel/prompts/zipball/409b0b4305273472f3754826e68f4edbd0150149", + "reference": "409b0b4305273472f3754826e68f4edbd0150149", "shasum": "" }, "require": { @@ -4984,9 +4984,9 @@ "description": "Add beautiful and user-friendly forms to your command-line applications.", "support": { "issues": "https://github.com/laravel/prompts/issues", - "source": "https://github.com/laravel/prompts/tree/v0.1.23" + "source": "https://github.com/laravel/prompts/tree/v0.1.24" }, - "time": "2024-05-27T13:53:20+00:00" + "time": "2024-06-17T13:58:22+00:00" }, { "name": "laravel/serializable-closure", @@ -5111,16 +5111,16 @@ }, { "name": "laravel/socialite", - "version": "v5.14.0", + "version": "v5.15.0", "source": { "type": "git", "url": "https://github.com/laravel/socialite.git", - "reference": "c7b0193a3753a29aff8ce80aa2f511917e6ed68a" + "reference": "c8234bfb286a8210df8d62f94562c71bfda4a446" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/socialite/zipball/c7b0193a3753a29aff8ce80aa2f511917e6ed68a", - "reference": "c7b0193a3753a29aff8ce80aa2f511917e6ed68a", + "url": "https://api.github.com/repos/laravel/socialite/zipball/c8234bfb286a8210df8d62f94562c71bfda4a446", + "reference": "c8234bfb286a8210df8d62f94562c71bfda4a446", "shasum": "" }, "require": { @@ -5179,7 +5179,7 @@ "issues": "https://github.com/laravel/socialite/issues", "source": "https://github.com/laravel/socialite" }, - "time": "2024-05-03T20:31:38+00:00" + "time": "2024-06-11T13:33:20+00:00" }, { "name": "laravel/tinker", @@ -6178,16 +6178,16 @@ }, { "name": "livewire/livewire", - "version": "v3.5.0", + "version": "v3.5.1", "source": { "type": "git", "url": "https://github.com/livewire/livewire.git", - "reference": "72e900825c560f0e4e620185b26c5441a8914435" + "reference": "da044261bb5c5449397f18fda3409f14acf47c0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/livewire/livewire/zipball/72e900825c560f0e4e620185b26c5441a8914435", - "reference": "72e900825c560f0e4e620185b26c5441a8914435", + "url": "https://api.github.com/repos/livewire/livewire/zipball/da044261bb5c5449397f18fda3409f14acf47c0a", + "reference": "da044261bb5c5449397f18fda3409f14acf47c0a", "shasum": "" }, "require": { @@ -6242,7 +6242,7 @@ "description": "A front-end framework for Laravel.", "support": { "issues": "https://github.com/livewire/livewire/issues", - "source": "https://github.com/livewire/livewire/tree/v3.5.0" + "source": "https://github.com/livewire/livewire/tree/v3.5.1" }, "funding": [ { @@ -6250,7 +6250,7 @@ "type": "github" } ], - "time": "2024-05-21T13:39:04+00:00" + "time": "2024-06-18T11:10:42+00:00" }, { "name": "maennchen/zipstream-php",