From b854115389c72532b2f1fe6d46faca67815472be Mon Sep 17 00:00:00 2001 From: Christopher Di Carlo Date: Thu, 9 May 2019 07:07:15 -0400 Subject: [PATCH] Display contact in activity dashboard and client activity --- app/Models/Activity.php | 3 ++- app/Ninja/Datatables/ActivityDatatable.php | 2 +- app/Ninja/Repositories/ActivityRepository.php | 1 - resources/lang/en/texts.php | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Models/Activity.php b/app/Models/Activity.php index cf9f948eee..c0b4926668 100644 --- a/app/Models/Activity.php +++ b/app/Models/Activity.php @@ -121,6 +121,7 @@ class Activity extends Eloquent $user = $this->user; $invoice = $this->invoice; $contactId = $this->contact_id; + $contact = $this->contact; $payment = $this->payment; $credit = $this->credit; $expense = $this->expense; @@ -133,7 +134,7 @@ class Activity extends Eloquent 'user' => $isSystem ? '' . trans('texts.system') . '' : e($user->getDisplayName()), 'invoice' => $invoice ? link_to($invoice->getRoute(), $invoice->getDisplayName()) : null, 'quote' => $invoice ? link_to($invoice->getRoute(), $invoice->getDisplayName()) : null, - 'contact' => $contactId ? link_to($client->getRoute(), $client->getDisplayName()) : e($user->getDisplayName()), + 'contact' => $contactId ? link_to($client->getRoute(), $contact->getDisplayName()) : e($user->getDisplayName()), 'payment' => $payment ? e($payment->transaction_reference) : null, 'payment_amount' => $payment ? $account->formatMoney($payment->amount, $payment) : null, 'adjustment' => $this->adjustment ? $account->formatMoney($this->adjustment, $this) : null, diff --git a/app/Ninja/Datatables/ActivityDatatable.php b/app/Ninja/Datatables/ActivityDatatable.php index 5d555c4853..eded41be72 100644 --- a/app/Ninja/Datatables/ActivityDatatable.php +++ b/app/Ninja/Datatables/ActivityDatatable.php @@ -44,7 +44,7 @@ class ActivityDatatable extends EntityDatatable 'user' => $model->is_system ? '' . trans('texts.system') . '' : Utils::getPersonDisplayName($model->user_first_name, $model->user_last_name, $model->user_email), 'invoice' => $model->invoice ? link_to('/invoices/' . $model->invoice_public_id, $model->is_recurring ? trans('texts.recurring_invoice') : $model->invoice)->toHtml() : null, 'quote' => $model->invoice ? link_to('/quotes/' . $model->invoice_public_id, $model->invoice)->toHtml() : null, - 'contact' => $model->contact_id ? link_to('/clients/' . $model->client_public_id, Utils::getClientDisplayName($model))->toHtml() : Utils::getPersonDisplayName($model->user_first_name, $model->user_last_name, $model->user_email), + 'contact' => $model->contact_id ? link_to('/clients/' . $model->client_public_id, Utils::getPersonDisplayName($model->first_name, $model->last_name, $model->email))->toHtml() : Utils::getPersonDisplayName($model->user_first_name, $model->user_last_name, $model->user_email), 'payment' => $model->payment ? e($model->payment) : '', 'credit' => $model->payment_amount ? Utils::formatMoney($model->credit, $model->currency_id, $model->country_id) : '', 'payment_amount' => $model->payment_amount ? Utils::formatMoney($model->payment_amount, $model->currency_id, $model->country_id) : null, diff --git a/app/Ninja/Repositories/ActivityRepository.php b/app/Ninja/Repositories/ActivityRepository.php index 85153a4468..3932d6742a 100644 --- a/app/Ninja/Repositories/ActivityRepository.php +++ b/app/Ninja/Repositories/ActivityRepository.php @@ -79,7 +79,6 @@ class ActivityRepository ->leftJoin('expenses', 'expenses.id', '=', 'activities.expense_id') ->leftJoin('tickets', 'tickets.id', '=', 'activities.ticket_id') ->where('clients.id', '=', $clientId) - ->where('contacts.is_primary', '=', 1) ->whereNull('contacts.deleted_at') ->select( DB::raw('COALESCE(clients.currency_id, accounts.currency_id) currency_id'), diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 7c5f7e3b21..bc8ae2d6ce 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -756,7 +756,7 @@ $LANG = array( 'activity_3' => ':user deleted client :client', 'activity_4' => ':user created invoice :invoice', 'activity_5' => ':user updated invoice :invoice', - 'activity_6' => ':user emailed invoice :invoice to :contact', + 'activity_6' => ':user emailed invoice :invoice for :client to :contact', 'activity_7' => ':contact viewed invoice :invoice', 'activity_8' => ':user archived invoice :invoice', 'activity_9' => ':user deleted invoice :invoice', @@ -770,7 +770,7 @@ $LANG = array( 'activity_17' => ':user deleted :credit credit', 'activity_18' => ':user created quote :quote', 'activity_19' => ':user updated quote :quote', - 'activity_20' => ':user emailed quote :quote to :contact', + 'activity_20' => ':user emailed quote :quote for :client to :contact', 'activity_21' => ':contact viewed quote :quote', 'activity_22' => ':user archived quote :quote', 'activity_23' => ':user deleted quote :quote',