mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Fix for blank contact name
This commit is contained in:
parent
bf6044006d
commit
01f53e1689
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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()
|
||||
|
@ -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,
|
||||
];
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user