diff --git a/app/Models/Presenters/UserPresenter.php b/app/Models/Presenters/UserPresenter.php index d370ed92912d..68c5722581c6 100644 --- a/app/Models/Presenters/UserPresenter.php +++ b/app/Models/Presenters/UserPresenter.php @@ -17,9 +17,11 @@ namespace App\Models\Presenters; class UserPresenter extends EntityPresenter { /** + * Returns the first and last names concatenated. + * * @return string */ - public function name() + public function name(): string { if (! $this->entity) { return 'No User Object Available'; @@ -30,8 +32,13 @@ class UserPresenter extends EntityPresenter return $first_name.' '.$last_name; } - - public function getDisplayName() + + /** + * Returns a full name (with fallback) of the user + * + * @return string + */ + public function getDisplayName(): string { if ($this->getFullName()) { return $this->getFullName(); @@ -43,6 +50,7 @@ class UserPresenter extends EntityPresenter } /** + * Returns the full name of the user * @return string */ public function getFullName() @@ -53,4 +61,35 @@ class UserPresenter extends EntityPresenter return ''; } } + + /** + * Returns the first name of the user + * + * @return string + */ + public function firstName(): string + { + if (! $this->entity) { + return 'No First Name Available'; + } + + return $this->entity->first_name ?? 'First Name'; + + } + + /** + * Returns the last name of the user + * + * @return string + */ + public function lastName(): string + { + if (! $this->entity) { + return 'No Last Name Available'; + } + + return $this->entity->last_name ?? 'Last Name'; + } + + } diff --git a/app/Services/Invoice/EInvoice/FacturaEInvoice.php b/app/Services/Invoice/EInvoice/FacturaEInvoice.php index 9afa4ab037d3..aebebd103e14 100644 --- a/app/Services/Invoice/EInvoice/FacturaEInvoice.php +++ b/app/Services/Invoice/EInvoice/FacturaEInvoice.php @@ -482,6 +482,8 @@ class FacturaEInvoice extends AbstractService "fax" => "", "website" => substr($company->settings->website, 0, 50), "contactPeople" => substr($company->owner()->present()->name(), 0, 40), + "firstName" => $company->owner()->present()->firstName(), + "lastName" => $company->owner()->present()->lastName(); // 'centres' => $this->setFace(), // "cnoCnae" => "04647", // Clasif. Nacional de Act. Económicas // "ineTownCode" => "280796" // Cód. de municipio del INE diff --git a/app/Utils/Traits/Notifications/UserNotifies.php b/app/Utils/Traits/Notifications/UserNotifies.php index 7f0e7f5d16ad..35f065757b3d 100644 --- a/app/Utils/Traits/Notifications/UserNotifies.php +++ b/app/Utils/Traits/Notifications/UserNotifies.php @@ -163,7 +163,7 @@ trait UserNotifies * Underrated method right here, last ones * are always the best * - * @param CompanyUser $company_user + * @param \App\Models\CompanyUser $company_user * @param Invoice | Quote | Credit | PurchaseOrder | Product $entity * @param array $required_notification *