mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 10:24:31 -04:00
Notification cleanup
This commit is contained in:
parent
120d2c21ab
commit
5076b8c70c
@ -77,39 +77,6 @@ class EntitySentNotification extends Notification implements ShouldQueue
|
|||||||
*/
|
*/
|
||||||
public function toMail($notifiable)
|
public function toMail($notifiable)
|
||||||
{
|
{
|
||||||
//@TODO THESE ARE @DEPRECATED NOW we are now using app/Mail/Admin/*
|
|
||||||
$amount = Number::formatMoney($this->entity->amount, $this->entity->client);
|
|
||||||
$subject = ctrans(
|
|
||||||
"texts.notification_{$this->entity_name}_sent_subject",
|
|
||||||
[
|
|
||||||
'client' => $this->contact->present()->name(),
|
|
||||||
'invoice' => $this->entity->number,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
$data = [
|
|
||||||
'title' => $subject,
|
|
||||||
'message' => ctrans(
|
|
||||||
"texts.notification_{$this->entity_name}_sent",
|
|
||||||
[
|
|
||||||
'amount' => $amount,
|
|
||||||
'client' => $this->contact->present()->name(),
|
|
||||||
'invoice' => $this->entity->number,
|
|
||||||
]
|
|
||||||
),
|
|
||||||
'url' => $this->invitation->getAdminLink(),
|
|
||||||
'button' => ctrans("texts.view_{$this->entity_name}"),
|
|
||||||
'signature' => $this->settings->email_signature,
|
|
||||||
'logo' => $this->company->present()->logo(),
|
|
||||||
'settings' => $this->settings,
|
|
||||||
];
|
|
||||||
|
|
||||||
return (new MailMessage)
|
|
||||||
->subject($subject)
|
|
||||||
->markdown('email.admin.generic', $data)
|
|
||||||
->withSwiftMessage(function ($message) {
|
|
||||||
$message->getHeaders()->addTextHeader('Tag', $this->company->company_key);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,6 +20,8 @@ use Illuminate\Notifications\Notification;
|
|||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
|
||||||
|
//@deprecated
|
||||||
class NewAccountCreated extends Notification
|
class NewAccountCreated extends Notification
|
||||||
{
|
{
|
||||||
// use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
// use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||||
|
@ -19,6 +19,7 @@ use Illuminate\Notifications\Notification;
|
|||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
//@deprecated
|
||||||
class VerifyUser extends Notification
|
class VerifyUser extends Notification
|
||||||
{
|
{
|
||||||
// use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
// use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||||
|
@ -1,124 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://opensource.org/licenses/AAL
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace App\Notifications;
|
|
||||||
|
|
||||||
use App\Models\Invoice;
|
|
||||||
use App\Utils\Number;
|
|
||||||
use Illuminate\Bus\Queueable;
|
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
|
||||||
use Illuminate\Notifications\Messages\SlackMessage;
|
|
||||||
use Illuminate\Notifications\Notification;
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
|
||||||
|
|
||||||
class SendGenericNotification extends BaseNotification
|
|
||||||
{
|
|
||||||
// use Queueable;
|
|
||||||
// use Dispatchable;
|
|
||||||
// use SerializesModels;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected $invitation;
|
|
||||||
|
|
||||||
protected $entity;
|
|
||||||
|
|
||||||
protected $contact;
|
|
||||||
|
|
||||||
protected $entity_string;
|
|
||||||
|
|
||||||
protected $settings;
|
|
||||||
|
|
||||||
public $is_system;
|
|
||||||
|
|
||||||
protected $body;
|
|
||||||
|
|
||||||
protected $subject;
|
|
||||||
|
|
||||||
public function __construct($invitation, $entity_string, $subject, $body)
|
|
||||||
{
|
|
||||||
$this->entity = $invitation->{$entity_string};
|
|
||||||
$this->contact = $invitation->contact;
|
|
||||||
$this->settings = $this->entity->client->getMergedSettings();
|
|
||||||
$this->subject = $subject;
|
|
||||||
$this->body = $body;
|
|
||||||
$this->invitation = $invitation;
|
|
||||||
$this->entity_string = $entity_string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the notification's delivery channels.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function via($notifiable)
|
|
||||||
{
|
|
||||||
return ['mail'];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the mail representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
* @return MailMessage
|
|
||||||
*/
|
|
||||||
public function toMail($notifiable)
|
|
||||||
{
|
|
||||||
$mail_message = (new MailMessage)
|
|
||||||
->withSwiftMessage(function ($message) {
|
|
||||||
$message->getHeaders()->addTextHeader('Tag', $this->invitation->company->company_key);
|
|
||||||
})->markdown($this->getTemplateView(), $this->buildMailMessageData());
|
|
||||||
//})->markdown('email.template.plain', $this->buildMailMessageData());
|
|
||||||
|
|
||||||
$mail_message = $this->buildMailMessageSettings($mail_message);
|
|
||||||
|
|
||||||
return $mail_message;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the array representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function toArray($notifiable)
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
//
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function toSlack($notifiable)
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
// $logo = $this->company->present()->logo();
|
|
||||||
// $amount = Number::formatMoney($this->invoice->amount, $this->invoice->client);
|
|
||||||
|
|
||||||
// return (new SlackMessage)
|
|
||||||
// ->success()
|
|
||||||
// ->from(ctrans('texts.notification_bot'))
|
|
||||||
// ->image($logo)
|
|
||||||
// ->content(ctrans(
|
|
||||||
// 'texts.notification_invoice_viewed',
|
|
||||||
// [
|
|
||||||
// 'amount' => $amount,
|
|
||||||
// 'client' => $this->contact->present()->name(),
|
|
||||||
// 'invoice' => $this->invoice->number
|
|
||||||
// ]
|
|
||||||
// ));
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user