diff --git a/app/Listeners/Invoice/UpdateInvoiceActivity.php b/app/Listeners/Invoice/UpdateInvoiceActivity.php index 9c7a0cb04015..5f7bbd8cad62 100644 --- a/app/Listeners/Invoice/UpdateInvoiceActivity.php +++ b/app/Listeners/Invoice/UpdateInvoiceActivity.php @@ -50,7 +50,8 @@ class UpdateInvoiceActivity implements ShouldQueue $fields->user_id = $event->invoice->user_id; $fields->company_id = $event->invoice->company_id; $fields->activity_type_id = Activity::UPDATE_INVOICE; - + $fields->invoice_id = $event->invoice->id; + $this->activity_repo->save($fields, $event->invoice); } } diff --git a/app/Models/Presenters/ClientPresenter.php b/app/Models/Presenters/ClientPresenter.php index e3686629955b..b13d007437f0 100644 --- a/app/Models/Presenters/ClientPresenter.php +++ b/app/Models/Presenters/ClientPresenter.php @@ -25,15 +25,20 @@ class ClientPresenter extends EntityPresenter */ public function name() { + if($this->entity->name) + return $this->entity->name; + $contact = $this->entity->primary_contact->first(); $contact_name = 'No Contact Set'; - if ($contact) { + if ($contact && (strlen($contact->first_name) >=1 || strlen($contact->last_name) >=1)) { $contact_name = $contact->first_name. ' '. $contact->last_name; } + elseif($contact && (strlen($contact->email))) + $contact_name = $contact->email; - return $this->entity->name ?: $contact_name; + return $contact_name; } public function primary_contact_name() diff --git a/database/factories/AccountFactory.php b/database/factories/AccountFactory.php index 67868546c159..dc068b1ae9ac 100644 --- a/database/factories/AccountFactory.php +++ b/database/factories/AccountFactory.php @@ -7,5 +7,6 @@ $factory->define(App\Models\Account::class, function (Faker $faker) { return [ 'default_company_id' => 1, 'key' => Str::random(32), + 'report_errors' => 1, ]; });