diff --git a/app/Http/Requests/Invoice/StoreInvoiceRequest.php b/app/Http/Requests/Invoice/StoreInvoiceRequest.php index bdcd35017781..0cf37f68e6e1 100644 --- a/app/Http/Requests/Invoice/StoreInvoiceRequest.php +++ b/app/Http/Requests/Invoice/StoreInvoiceRequest.php @@ -54,7 +54,7 @@ class StoreInvoiceRequest extends Request } elseif ($this->file('file')) { $rules['file'] = $this->file_validation; } - + $rules['client_id'] = 'bail|required|exists:clients,id,company_id,'.$user->company()->id.',is_deleted,0'; $rules['invitations.*.client_contact_id'] = 'distinct'; @@ -74,7 +74,7 @@ class StoreInvoiceRequest extends Request $rules['tax_name3'] = 'bail|sometimes|string|nullable'; $rules['exchange_rate'] = 'bail|sometimes|numeric'; $rules['partial'] = 'bail|sometimes|nullable|numeric'; - $rules['partial_due_date'] = 'bail|sometimes|required_if:partial,>0|date'; + $rules['partial_due_date'] = ['bail', 'sometimes', 'exclude_if:partial,0', Rule::requiredIf(fn () => $this->partial > 0), 'date']; return $rules; } diff --git a/app/Http/Requests/Invoice/UpdateInvoiceRequest.php b/app/Http/Requests/Invoice/UpdateInvoiceRequest.php index eef95d02cfc2..1237c0030831 100644 --- a/app/Http/Requests/Invoice/UpdateInvoiceRequest.php +++ b/app/Http/Requests/Invoice/UpdateInvoiceRequest.php @@ -65,6 +65,8 @@ class UpdateInvoiceRequest extends Request $rules['is_amount_discount'] = ['boolean']; + nlog($this->partial); + $rules['line_items'] = 'array'; $rules['discount'] = 'sometimes|numeric'; $rules['project_id'] = ['bail', 'sometimes', new ValidProjectForClient($this->all())]; @@ -77,7 +79,7 @@ class UpdateInvoiceRequest extends Request $rules['status_id'] = 'bail|sometimes|not_in:5'; //do not allow cancelled invoices to be modfified. $rules['exchange_rate'] = 'bail|sometimes|numeric'; $rules['partial'] = 'bail|sometimes|nullable|numeric'; - $rules['partial_due_date'] = 'bail|sometimes|required_if:partial,>0|date'; + $rules['partial_due_date'] = ['bail', 'sometimes', 'exclude_if:partial,0', Rule::requiredIf(fn () => $this->partial > 0), 'date']; return $rules; } diff --git a/composer.lock b/composer.lock index f798b135c2d2..6de1b9d36ffd 100644 --- a/composer.lock +++ b/composer.lock @@ -13804,16 +13804,16 @@ }, { "name": "turbo124/beacon", - "version": "v1.5.0", + "version": "v1.5.1", "source": { "type": "git", "url": "https://github.com/turbo124/beacon.git", - "reference": "ffc0a7b229129f6503fa699adaabc1d9f300e41c" + "reference": "a737499198a3aff2d194d4f2a4c834257187d9b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/turbo124/beacon/zipball/ffc0a7b229129f6503fa699adaabc1d9f300e41c", - "reference": "ffc0a7b229129f6503fa699adaabc1d9f300e41c", + "url": "https://api.github.com/repos/turbo124/beacon/zipball/a737499198a3aff2d194d4f2a4c834257187d9b8", + "reference": "a737499198a3aff2d194d4f2a4c834257187d9b8", "shasum": "" }, "require": { @@ -13860,9 +13860,9 @@ "turbo124" ], "support": { - "source": "https://github.com/turbo124/beacon/tree/v1.5.0" + "source": "https://github.com/turbo124/beacon/tree/v1.5.1" }, - "time": "2023-08-20T23:18:11+00:00" + "time": "2023-09-24T07:20:04+00:00" }, { "name": "twig/twig", @@ -16827,16 +16827,16 @@ }, { "name": "sebastian/exporter", - "version": "5.1.0", + "version": "5.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "c3fa8483f9539b190f7cd4bfc4a07631dd1df344" + "reference": "64f51654862e0f5e318db7e9dcc2292c63cdbddc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/c3fa8483f9539b190f7cd4bfc4a07631dd1df344", - "reference": "c3fa8483f9539b190f7cd4bfc4a07631dd1df344", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/64f51654862e0f5e318db7e9dcc2292c63cdbddc", + "reference": "64f51654862e0f5e318db7e9dcc2292c63cdbddc", "shasum": "" }, "require": { @@ -16850,7 +16850,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -16893,7 +16893,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", "security": "https://github.com/sebastianbergmann/exporter/security/policy", - "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.0" + "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.1" }, "funding": [ { @@ -16901,7 +16901,7 @@ "type": "github" } ], - "time": "2023-09-18T07:15:37+00:00" + "time": "2023-09-24T13:22:09+00:00" }, { "name": "sebastian/global-state",