diff --git a/app/Http/Requests/Client/StoreClientRequest.php b/app/Http/Requests/Client/StoreClientRequest.php index 3a1d3841bfc4..a8ae0fb5fbae 100644 --- a/app/Http/Requests/Client/StoreClientRequest.php +++ b/app/Http/Requests/Client/StoreClientRequest.php @@ -93,7 +93,7 @@ class StoreClientRequest extends Request $rules['number'] = ['bail', 'nullable', Rule::unique('clients')->where('company_id', $user->company()->id)]; $rules['id_number'] = ['bail', 'nullable', Rule::unique('clients')->where('company_id', $user->company()->id)]; - $rules['classification'] = 'bail|sometimes|nullable|in:individual,company,partnership,trust,charity,government,other'; + $rules['classification'] = 'bail|sometimes|nullable|in:individual,business,partnership,trust,charity,government,other'; return $rules; } diff --git a/app/Http/Requests/Client/UpdateClientRequest.php b/app/Http/Requests/Client/UpdateClientRequest.php index 0c2f3628874f..13ee38e3ee14 100644 --- a/app/Http/Requests/Client/UpdateClientRequest.php +++ b/app/Http/Requests/Client/UpdateClientRequest.php @@ -60,7 +60,7 @@ class UpdateClientRequest extends Request $rules['size_id'] = 'integer|nullable'; $rules['country_id'] = 'integer|nullable'; $rules['shipping_country_id'] = 'integer|nullable'; - $rules['classification'] = 'bail|sometimes|nullable|in:individual,company,partnership,trust,charity,government,other'; + $rules['classification'] = 'bail|sometimes|nullable|in:individual,business,partnership,trust,charity,government,other'; if ($this->id_number) { $rules['id_number'] = Rule::unique('clients')->where('company_id', $user->company()->id)->ignore($this->client->id); diff --git a/app/Services/Invoice/EInvoice/FacturaEInvoice.php b/app/Services/Invoice/EInvoice/FacturaEInvoice.php index 700bad3602a8..4592275a490f 100644 --- a/app/Services/Invoice/EInvoice/FacturaEInvoice.php +++ b/app/Services/Invoice/EInvoice/FacturaEInvoice.php @@ -182,9 +182,9 @@ class FacturaEInvoice extends AbstractService Storage::makeDirectory($this->invoice->client->e_invoice_filepath($this->invoice->invitations->first())); } - $this->fac->export(Storage::disk($disk)->path($this->invoice->client->e_invoice_filepath($this->invoice->invitations->first()) . $this->invoice->getFileName("xsig"))); - - return $this->invoice->client->e_invoice_filepath($this->invoice->invitations->first()) . $this->invoice->getFileName("xsig"); + // $this->fac->export(Storage::disk($disk)->path($this->invoice->client->e_invoice_filepath($this->invoice->invitations->first()) . $this->invoice->getFileName("xsig"))); + return $this->fac->export(); + // return $this->invoice->client->e_invoice_filepath($this->invoice->invitations->first()) . $this->invoice->getFileName("xsig"); } @@ -469,9 +469,10 @@ class FacturaEInvoice extends AbstractService $company = $this->invoice->company; $seller = new FacturaeParty([ - "isLegalEntity" => $company->custom_value1, // Se asume true si se omite + // "isLegalEntity" => $company->custom_value1, // Se asume true si se omite + "isLegalEntity" => $this->invoice->client->classification === 'individual' ? false : true, "taxNumber" => $company->settings->vat_number, - "name" => substr($company->present()->name(), 0, 40), + "name" => $company->getSetting('classification') === 'individual' ? substr($company->owner()->present()->name(), 0, 40) : substr($company->present()->name(), 0, 40), "address" => substr($company->settings->address1, 0, 80), "postCode" => substr($this->invoice->client->postal_code, 0, 5), "town" => substr($company->settings->city, 0, 50), @@ -504,7 +505,7 @@ class FacturaEInvoice extends AbstractService { $buyer = new FacturaeParty([ - "isLegalEntity" => $this->invoice->client->has_valid_vat_number, + "isLegalEntity" => $this->invoice->client->classification === 'individual' ? false : true, "taxNumber" => $this->invoice->client->vat_number, "name" => substr($this->invoice->client->present()->name(),0, 40), "firstSurname" => substr($this->invoice->client->present()->first_name(),0, 40),