From 2b145e883302beeb4e7854bd055a7c232e1d12f2 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 7 Mar 2022 08:53:32 +1100 Subject: [PATCH] Fixes for getting first contact/primary --- app/Http/Controllers/ClientPortal/NinjaPlanController.php | 2 +- app/Services/Credit/GetCreditPdf.php | 2 +- app/Services/Invoice/GetInvoicePdf.php | 2 +- app/Services/Quote/GetQuotePdf.php | 2 +- resources/views/portal/ninja2020/layout/app.blade.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/ClientPortal/NinjaPlanController.php b/app/Http/Controllers/ClientPortal/NinjaPlanController.php index d980dd3a27ec..c24ee6293e80 100644 --- a/app/Http/Controllers/ClientPortal/NinjaPlanController.php +++ b/app/Http/Controllers/ClientPortal/NinjaPlanController.php @@ -163,7 +163,7 @@ class NinjaPlanController extends Controller $recurring_invoice->service()->start(); - return redirect('/'); + return redirect('https://invoicing.co'); } diff --git a/app/Services/Credit/GetCreditPdf.php b/app/Services/Credit/GetCreditPdf.php index 22d60ea52cac..91ae1605a434 100644 --- a/app/Services/Credit/GetCreditPdf.php +++ b/app/Services/Credit/GetCreditPdf.php @@ -34,7 +34,7 @@ class GetCreditPdf extends AbstractService public function run() { if (! $this->contact) { - $this->contact = $this->credit->client->primary_contact()->first(); + $this->contact = $this->credit->client->primary_contact()->first() ?: $this->credit->client->contacts()->first(); } $path = $this->credit->client->credit_filepath($this->invitation); diff --git a/app/Services/Invoice/GetInvoicePdf.php b/app/Services/Invoice/GetInvoicePdf.php index 9f519cab7fbe..0923c0ea2205 100644 --- a/app/Services/Invoice/GetInvoicePdf.php +++ b/app/Services/Invoice/GetInvoicePdf.php @@ -30,7 +30,7 @@ class GetInvoicePdf extends AbstractService public function run() { if (! $this->contact) { - $this->contact = $this->invoice->client->primary_contact()->first(); + $this->contact = $this->invoice->client->primary_contact()->first() ?: $this->invoice->client->contacts()->first(); } $invitation = $this->invoice->invitations->where('client_contact_id', $this->contact->id)->first(); diff --git a/app/Services/Quote/GetQuotePdf.php b/app/Services/Quote/GetQuotePdf.php index d904ea7029f4..9555367461cc 100644 --- a/app/Services/Quote/GetQuotePdf.php +++ b/app/Services/Quote/GetQuotePdf.php @@ -30,7 +30,7 @@ class GetQuotePdf extends AbstractService public function run() { if (! $this->contact) { - $this->contact = $this->quote->client->primary_contact()->first(); + $this->contact = $this->quote->client->primary_contact()->first() ?: $this->quote->client->contacts()->first(); } $invitation = $this->quote->invitations->where('client_contact_id', $this->contact->id)->first(); diff --git a/resources/views/portal/ninja2020/layout/app.blade.php b/resources/views/portal/ninja2020/layout/app.blade.php index 5a0dcbcb52ea..8b50d6859ef8 100644 --- a/resources/views/portal/ninja2020/layout/app.blade.php +++ b/resources/views/portal/ninja2020/layout/app.blade.php @@ -57,7 +57,7 @@ - @if(!auth()->guard('contact')->user()->user->account->isPaid()) + @if(auth()->guard('contact')->user() && !auth()->guard('contact')->user()->user->account->isPaid()) @endif