1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Fixes for injecting settings object into email blade templates

This commit is contained in:
David Bomba 2020-09-27 19:22:34 +10:00
parent 3c4bc4a516
commit c965e8d08b
12 changed files with 28 additions and 3 deletions

View File

@ -12,6 +12,7 @@
namespace App\Http\Requests\RecurringInvoice;
use App\Http\Requests\Request;
use App\Models\Client;
use App\Models\RecurringInvoice;
use App\Utils\Traits\CleanLineItems;
use App\Utils\Traits\MakesHash;
@ -98,7 +99,11 @@ class StoreRecurringInvoiceRequest extends Request
if(isset($input['auto_bill']))
$input['auto_bill_enabled'] = $this->setAutoBillFlag($input['auto_bill']);
else{
$client = Client::find($this->decodePrimaryKey($input['client_id']));
$input['auto_bill'] = $client->getSetting('auto_bill');
}
$this->replace($input);
}

View File

@ -47,7 +47,7 @@ class SendVerificationNotification implements ShouldQueue
MultiDB::setDB($event->company->db);
try {
$event->user->notify(new VerifyUser($event->user));
$event->user->notify(new VerifyUser($event->user, $event->company));
Ninja::registerNinjaUser($event->user);

View File

@ -200,6 +200,11 @@ class RecurringInvoice extends BaseModel
public function nextSendDate() :?Carbon
{
if(!$this->next_send_date){
return null;
// $this->next_send_date = now()->format('Y-m-d');
}
switch ($this->frequency_id) {
case self::FREQUENCY_WEEKLY:
return Carbon::parse($this->next_send_date)->addWeek();

View File

@ -101,6 +101,7 @@ class EntitySentNotification extends Notification implements ShouldQueue
'button' => ctrans("texts.view_{$this->entity_name}"),
'signature' => $this->settings->email_signature,
'logo' => $this->company->present()->logo(),
'settings' => $this->settings,
];
return (new MailMessage)

View File

@ -146,6 +146,8 @@ class EntityViewedNotification extends Notification implements ShouldQueue
'button' => ctrans("texts.view_{$this->entity_name}"),
'signature' => $this->settings->email_signature,
'logo' => $this->company->present()->logo(),
'settings' => $this->settings,
];
return $data;

View File

@ -96,6 +96,8 @@ class InvoiceSentNotification extends Notification implements ShouldQueue
'button' => ctrans('texts.view_invoice'),
'signature' => $this->settings->email_signature,
'logo' => $this->company->present()->logo(),
'settings' => $this->settings,
];
return (new MailMessage)

View File

@ -96,6 +96,8 @@ class InvoiceViewedNotification extends Notification implements ShouldQueue
'button' => ctrans('texts.view_invoice'),
'signature' => $this->settings->email_signature,
'logo' => $this->company->present()->logo(),
'settings' => $this->settings,
];
return (new MailMessage)

View File

@ -94,6 +94,7 @@ class NewPartialPaymentNotification extends Notification implements ShouldQueue
'button' => ctrans('texts.view_payment'),
'signature' => $this->settings->email_signature,
'logo' => $this->company->present()->logo(),
'settings' => $this->settings,
];
return (new MailMessage)

View File

@ -97,6 +97,7 @@ class NewPaymentNotification extends Notification implements ShouldQueue
'button' => ctrans('texts.view_payment'),
'signature' => $this->settings->email_signature,
'logo' => $this->company->present()->logo(),
'settings' => $this->settings,
];
return (new MailMessage)

View File

@ -73,6 +73,7 @@ class NewAccountCreated extends Notification implements ShouldQueue
'button' => ctrans('texts.account_login'),
'signature' => $this->company->settings->email_signature,
'logo' => $this->company->present()->logo(),
'settings' => $this->company->settings,
];
return (new MailMessage)

View File

@ -73,6 +73,7 @@ class NewAccountCreated extends Notification implements ShouldQueue
'button' => ctrans('texts.account_login'),
'signature' => $this->company->settings->email_signature,
'logo' => $this->company->present()->logo(),
'settings' => $this->company->settings,
];
return (new MailMessage)

View File

@ -32,9 +32,12 @@ class VerifyUser extends Notification implements ShouldQueue
*/
protected $user;
public function __construct($user)
private $company;
public function __construct($user, $company)
{
$this->user = $user;
$this->company = $company;
}
/**
@ -63,6 +66,7 @@ class VerifyUser extends Notification implements ShouldQueue
'button' => ctrans('texts.button_confirmation_message'),
'signature' => '',
'logo' => 'https://www.invoiceninja.com/wp-content/uploads/2019/01/InvoiceNinja-Logo-Round-300x300.png',
'settings' => $this->company->settings,
];
return (new MailMessage)