diff --git a/app/Http/Controllers/EmailController.php b/app/Http/Controllers/EmailController.php index 62760c5acce3..8bfa7ffef5c4 100644 --- a/app/Http/Controllers/EmailController.php +++ b/app/Http/Controllers/EmailController.php @@ -122,11 +122,15 @@ class EmailController extends BaseController $invitation->contact->notify((new SendGenericNotification($invitation, $entity_string, $subject, $body))->delay($when)); - EntitySentMailer::dispatch($invitation, $entity_string, $entity_obj->user, $invitation->company); - } }); + + /*Only notify the admin ONCE, not once per contact/invite*/ + $invitation = $entity_obj->invitations->first(); + + EntitySentMailer::dispatch($invitation, $entity_string, $entity_obj->user, $invitation->company); + if ($this instanceof Invoice) { $this->entity_type = Invoice::class ; diff --git a/app/Http/Controllers/SetupController.php b/app/Http/Controllers/SetupController.php index 43a8378fd324..84f3fdd6325d 100644 --- a/app/Http/Controllers/SetupController.php +++ b/app/Http/Controllers/SetupController.php @@ -62,8 +62,13 @@ class SetupController extends Controller $mail_driver = 'log'; } + $url = $request->input('url'); + + if(substr($url, -1) != '/') + $url = $url . '/'; + $_ENV['APP_KEY'] = config('app.key'); - $_ENV['APP_URL'] = $request->input('url'); + $_ENV['APP_URL'] = $url; $_ENV['APP_DEBUG'] = $request->input('debug') ? 'true' : 'false'; $_ENV['REQUIRE_HTTPS'] = $request->input('https') ? 'true' : 'false'; $_ENV['DB_TYPE'] = 'mysql'; diff --git a/app/Jobs/Mail/EntitySentMailer.php b/app/Jobs/Mail/EntitySentMailer.php index 2eee1d4d6022..9680851a35bd 100644 --- a/app/Jobs/Mail/EntitySentMailer.php +++ b/app/Jobs/Mail/EntitySentMailer.php @@ -56,7 +56,6 @@ class EntitySentMailer extends BaseMailerJob implements ShouldQueue */ public function handle() { - info("entity sent mailer"); //Set DB MultiDB::setDb($this->company->db); diff --git a/app/Jobs/Mail/EntityViewedMailer.php b/app/Jobs/Mail/EntityViewedMailer.php index c5fd76e36dd4..be1102a948f9 100644 --- a/app/Jobs/Mail/EntityViewedMailer.php +++ b/app/Jobs/Mail/EntityViewedMailer.php @@ -57,8 +57,6 @@ class EntityViewedMailer extends BaseMailerJob implements ShouldQueue public function handle() { - info("entity viewed mailer"); - //Set DB MultiDB::setDb($this->company->db); diff --git a/app/Listeners/Invoice/InvoiceEmailedNotification.php b/app/Listeners/Invoice/InvoiceEmailedNotification.php index 5673afb03778..ec20f01f79d4 100644 --- a/app/Listeners/Invoice/InvoiceEmailedNotification.php +++ b/app/Listeners/Invoice/InvoiceEmailedNotification.php @@ -44,6 +44,7 @@ class InvoiceEmailedNotification implements ShouldQueue { MultiDB::setDb($event->company->db); + $first_notification_sent = true; foreach ($invitation->company->company_users as $company_user) { @@ -53,7 +54,7 @@ class InvoiceEmailedNotification implements ShouldQueue $methods = $this->findUserNotificationTypes($invitation, $company_user, 'invoice', ['all_notifications', 'invoice_sent']); - if (($key = array_search('mail', $methods)) !== false) { + if (($key = array_search('mail', $methods)) !== false && $first_notification_sent === true) { unset($methods[$key]); //Fire mail notification here!!! @@ -61,6 +62,8 @@ class InvoiceEmailedNotification implements ShouldQueue //handle the mailer EntitySentMailer::dispatch($invitation, 'invoice', $user, $invitation->company); + $first_notification_sent = false; + } $notification->method = $methods; diff --git a/app/Listeners/Misc/InvitationViewedListener.php b/app/Listeners/Misc/InvitationViewedListener.php index 501655e20698..1997c2baf4b5 100644 --- a/app/Listeners/Misc/InvitationViewedListener.php +++ b/app/Listeners/Misc/InvitationViewedListener.php @@ -46,7 +46,6 @@ class InvitationViewedListener implements ShouldQueue $invitation = $event->invitation; $notification = new EntityViewedNotification($invitation, $entity_name); - $notification_not_fired_yet = true; foreach ($invitation->company->company_users as $company_user) { @@ -54,11 +53,10 @@ class InvitationViewedListener implements ShouldQueue $methods = $this->findUserNotificationTypes($invitation, $company_user, $entity_name, ['all_notifications', $entity_viewed]); - if (($key = array_search('mail', $methods)) !== false && $notification_not_fired_yet) { + if (($key = array_search('mail', $methods)) !== false) { unset($methods[$key]); EntityViewedMailer::dispatch($invitation, $entity_name, $company_user->user, $invitation->company); - $notification_not_fired_yet = false; } diff --git a/app/Models/InvoiceInvitation.php b/app/Models/InvoiceInvitation.php index 57675418b247..466ec9fd7583 100644 --- a/app/Models/InvoiceInvitation.php +++ b/app/Models/InvoiceInvitation.php @@ -126,8 +126,6 @@ class InvoiceInvitation extends BaseModel public function markViewed() { - info('marking viewed here'); - $this->viewed_date = Carbon::now(); $this->save(); } diff --git a/app/Notifications/Admin/InvoiceSentNotification.php b/app/Notifications/Admin/InvoiceSentNotification.php index 245d4f6d852a..100d6e0200fb 100644 --- a/app/Notifications/Admin/InvoiceSentNotification.php +++ b/app/Notifications/Admin/InvoiceSentNotification.php @@ -85,7 +85,7 @@ class InvoiceSentNotification extends Notification implements ShouldQueue 'invoice' => $this->invoice->number, ] ), - 'url' => config('ninja.app_url') . '/invoices/' . $this->invoice->hashed_id, + 'url' => config('ninja.app_url') . 'invoices/' . $this->invoice->hashed_id, 'button' => ctrans('texts.view_invoice'), 'signature' => $this->settings->email_signature, 'logo' => $this->company->present()->logo(), diff --git a/app/Notifications/Admin/InvoiceViewedNotification.php b/app/Notifications/Admin/InvoiceViewedNotification.php index 5bc49983f311..f1249299189b 100644 --- a/app/Notifications/Admin/InvoiceViewedNotification.php +++ b/app/Notifications/Admin/InvoiceViewedNotification.php @@ -85,7 +85,7 @@ class InvoiceViewedNotification extends Notification implements ShouldQueue 'invoice' => $this->invoice->number, ] ), - 'url' => config('ninja.app_url') . '/invoices/' . $this->invoice->hashed_id, + 'url' => config('ninja.app_url') . 'invoices/' . $this->invoice->hashed_id, 'button' => ctrans('texts.view_invoice'), 'signature' => $this->settings->email_signature, 'logo' => $this->company->present()->logo(), diff --git a/app/Notifications/Admin/NewPartialPaymentNotification.php b/app/Notifications/Admin/NewPartialPaymentNotification.php index 5298eb5ce921..384857195af1 100644 --- a/app/Notifications/Admin/NewPartialPaymentNotification.php +++ b/app/Notifications/Admin/NewPartialPaymentNotification.php @@ -83,7 +83,7 @@ class NewPartialPaymentNotification extends Notification implements ShouldQueue 'invoice' => $invoice_texts, ] ), - 'url' => config('ninja.app_url') . '/payments/' . $this->payment->hashed_id, + 'url' => config('ninja.app_url') . 'payments/' . $this->payment->hashed_id, 'button' => ctrans('texts.view_payment'), 'signature' => $this->settings->email_signature, 'logo' => $this->company->present()->logo(), diff --git a/app/Notifications/Admin/NewPaymentNotification.php b/app/Notifications/Admin/NewPaymentNotification.php index ca0c77f368fa..f3e3ee30233a 100644 --- a/app/Notifications/Admin/NewPaymentNotification.php +++ b/app/Notifications/Admin/NewPaymentNotification.php @@ -86,7 +86,7 @@ class NewPaymentNotification extends Notification implements ShouldQueue 'invoice' => $invoice_texts, ] ), - 'url' => config('ninja.app_url') . '/payments/' . $this->payment->hashed_id, + 'url' => config('ninja.app_url') . 'payments/' . $this->payment->hashed_id, 'button' => ctrans('texts.view_payment'), 'signature' => $this->settings->email_signature, 'logo' => $this->company->present()->logo(), diff --git a/app/Utils/HtmlEngine.php b/app/Utils/HtmlEngine.php index 337c170d45ea..fc922bc5f3cd 100644 --- a/app/Utils/HtmlEngine.php +++ b/app/Utils/HtmlEngine.php @@ -496,7 +496,8 @@ class HtmlEngine */ public function generateAppUrl() { - return rtrim(config('ninja.app_url'), "/"); + //return rtrim(config('ninja.app_url'), "/"); + return config('ninja.app_url'); } /** diff --git a/app/Utils/Traits/MakesInvoiceValues.php b/app/Utils/Traits/MakesInvoiceValues.php index c824707954c3..626241f57894 100644 --- a/app/Utils/Traits/MakesInvoiceValues.php +++ b/app/Utils/Traits/MakesInvoiceValues.php @@ -749,7 +749,8 @@ trait MakesInvoiceValues */ public function generateAppUrl() { - return rtrim(config('ninja.app_url'), "/"); + //return rtrim(config('ninja.app_url'), "/"); + return config('ninja.app_url'); } /** diff --git a/resources/views/layouts/guest.blade.php b/resources/views/layouts/guest.blade.php index 6db093859999..8187713a24e0 100644 --- a/resources/views/layouts/guest.blade.php +++ b/resources/views/layouts/guest.blade.php @@ -36,7 +36,7 @@ - + diff --git a/resources/views/layouts/master.blade.php b/resources/views/layouts/master.blade.php index 72325ca5ffae..0928ce4dbbea 100644 --- a/resources/views/layouts/master.blade.php +++ b/resources/views/layouts/master.blade.php @@ -35,7 +35,7 @@ - + --/> @@ -57,7 +57,7 @@ - + diff --git a/resources/views/portal/ninja2020/layout/clean.blade.php b/resources/views/portal/ninja2020/layout/clean.blade.php index e6862eacd91b..8ad112620787 100644 --- a/resources/views/portal/ninja2020/layout/clean.blade.php +++ b/resources/views/portal/ninja2020/layout/clean.blade.php @@ -54,7 +54,7 @@ {{-- --}} - + {{-- Feel free to push anything to header using @push('header') --}} @stack('head')