mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
only send one notification per invoice
This commit is contained in:
parent
00a3d36fcd
commit
fe4885f5a6
@ -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 ;
|
||||
|
@ -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';
|
||||
|
@ -56,7 +56,6 @@ class EntitySentMailer extends BaseMailerJob implements ShouldQueue
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
info("entity sent mailer");
|
||||
//Set DB
|
||||
MultiDB::setDb($this->company->db);
|
||||
|
||||
|
@ -57,8 +57,6 @@ class EntityViewedMailer extends BaseMailerJob implements ShouldQueue
|
||||
public function handle()
|
||||
{
|
||||
|
||||
info("entity viewed mailer");
|
||||
|
||||
//Set DB
|
||||
MultiDB::setDb($this->company->db);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
@ -126,8 +126,6 @@ class InvoiceInvitation extends BaseModel
|
||||
|
||||
public function markViewed()
|
||||
{
|
||||
info('marking viewed here');
|
||||
|
||||
$this->viewed_date = Carbon::now();
|
||||
$this->save();
|
||||
}
|
||||
|
@ -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(),
|
||||
|
@ -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(),
|
||||
|
@ -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(),
|
||||
|
@ -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(),
|
||||
|
@ -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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,7 +36,7 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.4.1/css/simple-line-icons.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">
|
||||
<link rel="canonical" href="{{ config('ninja.app_url') }}/{{ request()->path() }}"/>
|
||||
<link rel="canonical" href="{{ config('ninja.app_url') }}{{ request()->path() }}"/>
|
||||
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
|
||||
|
@ -35,7 +35,7 @@
|
||||
<meta property="og:site_name" content="Invoice Ninja"/>
|
||||
<meta property="og:url" content="{{ config('ninja.app_url') }}"/>
|
||||
<meta property="og:title" content="Invoice Ninja"/>
|
||||
<meta property="og:image" content="{{ config('ninja.app_url') }}/images/logo.png"/>
|
||||
<meta property="og:image" content="{{ config('ninja.app_url') }}images/logo.png"/>
|
||||
<meta property="og:description" content="Create. Send. Get Paid."/>
|
||||
--/>
|
||||
<!-- http://realfavicongenerator.net -->
|
||||
@ -57,7 +57,7 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.4.1/css/simple-line-icons.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">
|
||||
<link rel="canonical" href="{{ config('ninja.app_url') }}/{{ request()->path() }}"/>
|
||||
<link rel="canonical" href="{{ config('ninja.app_url') }}{{ request()->path() }}"/>
|
||||
<link rel="stylesheet" href="{{ mix('/css/ninja.min.css') }}">
|
||||
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
|
||||
|
@ -54,7 +54,7 @@
|
||||
<link href="{{ mix('css/app.css') }}" rel="stylesheet">
|
||||
{{-- <link href="{{ mix('favicon.png') }}" rel="shortcut icon" type="image/png"> --}}
|
||||
|
||||
<link rel="canonical" href="{{ config('ninja.app_url') }}/{{ request()->path() }}"/>
|
||||
<link rel="canonical" href="{{ config('ninja.app_url') }}{{ request()->path() }}"/>
|
||||
|
||||
{{-- Feel free to push anything to header using @push('header') --}}
|
||||
@stack('head')
|
||||
|
Loading…
Reference in New Issue
Block a user