mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 10:54:36 -04:00
Remove checks for send_email
This commit is contained in:
parent
8ce94012fb
commit
2d791f26b7
@ -65,6 +65,9 @@ class InvitationController extends Controller
|
|||||||
private function genericRouter(string $entity, string $invitation_key)
|
private function genericRouter(string $entity, string $invitation_key)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if(!in_array($entity, ['invoice', 'credit', 'quote', 'recurring_invoice']))
|
||||||
|
return response()->json(['message' => 'Invalid resource request']);
|
||||||
|
|
||||||
$key = $entity.'_id';
|
$key = $entity.'_id';
|
||||||
|
|
||||||
$entity_obj = 'App\Models\\'.ucfirst(Str::camel($entity)).'Invitation';
|
$entity_obj = 'App\Models\\'.ucfirst(Str::camel($entity)).'Invitation';
|
||||||
@ -133,6 +136,9 @@ class InvitationController extends Controller
|
|||||||
private function returnRawPdf(string $entity, string $invitation_key)
|
private function returnRawPdf(string $entity, string $invitation_key)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if(!in_array($entity, ['invoice', 'credit', 'quote', 'recurring_invoice']))
|
||||||
|
return response()->json(['message' => 'Invalid resource request']);
|
||||||
|
|
||||||
$key = $entity.'_id';
|
$key = $entity.'_id';
|
||||||
|
|
||||||
$entity_obj = 'App\Models\\'.ucfirst(Str::camel($entity)).'Invitation';
|
$entity_obj = 'App\Models\\'.ucfirst(Str::camel($entity)).'Invitation';
|
||||||
|
@ -127,7 +127,7 @@ class EmailController extends BaseController
|
|||||||
|
|
||||||
$entity_obj->invitations->each(function ($invitation) use ($data, $entity_string, $entity_obj, $template) {
|
$entity_obj->invitations->each(function ($invitation) use ($data, $entity_string, $entity_obj, $template) {
|
||||||
|
|
||||||
if (!$invitation->contact->trashed() && $invitation->contact->send_email && $invitation->contact->email) {
|
if (!$invitation->contact->trashed() && $invitation->contact->email) {
|
||||||
|
|
||||||
$entity_obj->service()->markSent()->save();
|
$entity_obj->service()->markSent()->save();
|
||||||
|
|
||||||
|
@ -59,15 +59,15 @@ class SendRecurring implements ShouldQueue
|
|||||||
public function handle() : void
|
public function handle() : void
|
||||||
{
|
{
|
||||||
//reset all contacts here
|
//reset all contacts here
|
||||||
$this->recurring_invoice->client->contacts()->update(['send_email' => false]);
|
// $this->recurring_invoice->client->contacts()->update(['send_email' => false]);
|
||||||
|
|
||||||
$this->recurring_invoice->invitations->each(function ($invitation){
|
// $this->recurring_invoice->invitations->each(function ($invitation){
|
||||||
|
|
||||||
$contact = $invitation->contact;
|
// $contact = $invitation->contact;
|
||||||
$contact->send_email = true;
|
// $contact->send_email = true;
|
||||||
$contact->save();
|
// $contact->save();
|
||||||
|
|
||||||
});
|
// });
|
||||||
|
|
||||||
// Generate Standard Invoice
|
// Generate Standard Invoice
|
||||||
$invoice = RecurringInvoiceToInvoiceFactory::create($this->recurring_invoice, $this->recurring_invoice->client);
|
$invoice = RecurringInvoiceToInvoiceFactory::create($this->recurring_invoice, $this->recurring_invoice->client);
|
||||||
@ -153,7 +153,7 @@ class SendRecurring implements ShouldQueue
|
|||||||
}
|
}
|
||||||
|
|
||||||
//important catch all here - we should never leave contacts send_email to false incase they are permanently set to false in the future.
|
//important catch all here - we should never leave contacts send_email to false incase they are permanently set to false in the future.
|
||||||
$this->recurring_invoice->client->contacts()->update(['send_email' => true]);
|
// $this->recurring_invoice->client->contacts()->update(['send_email' => true]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,7 +395,7 @@ class BaseDriver extends AbstractPaymentDriver
|
|||||||
|
|
||||||
$invoices->first()->invitations->each(function ($invitation) use ($nmo) {
|
$invoices->first()->invitations->each(function ($invitation) use ($nmo) {
|
||||||
|
|
||||||
if ($invitation->contact->send_email && $invitation->contact->email) {
|
if ($invitation->contact->email) {
|
||||||
|
|
||||||
$nmo->to_user = $invitation->contact;
|
$nmo->to_user = $invitation->contact;
|
||||||
NinjaMailerJob::dispatch($nmo);
|
NinjaMailerJob::dispatch($nmo);
|
||||||
@ -459,7 +459,7 @@ class BaseDriver extends AbstractPaymentDriver
|
|||||||
|
|
||||||
$invoices->first()->invitations->each(function ($invitation) use ($nmo){
|
$invoices->first()->invitations->each(function ($invitation) use ($nmo){
|
||||||
|
|
||||||
if (!$invitation->contact->trashed() && $invitation->contact->send_email && $invitation->contact->email) {
|
if (!$invitation->contact->trashed() && $invitation->contact->email) {
|
||||||
|
|
||||||
$nmo->to_user = $invitation->contact;
|
$nmo->to_user = $invitation->contact;
|
||||||
NinjaMailerJob::dispatch($nmo);
|
NinjaMailerJob::dispatch($nmo);
|
||||||
|
@ -44,7 +44,7 @@ class SendEmail
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->credit->invitations->each(function ($invitation) {
|
$this->credit->invitations->each(function ($invitation) {
|
||||||
if (!$invitation->contact->trashed() && $invitation->contact->send_email && $invitation->contact->email) {
|
if (!$invitation->contact->trashed() && $invitation->contact->email) {
|
||||||
$email_builder = (new CreditEmail())->build($invitation, $this->reminder_template);
|
$email_builder = (new CreditEmail())->build($invitation, $this->reminder_template);
|
||||||
|
|
||||||
// EmailCredit::dispatchNow($email_builder, $invitation, $invitation->company);
|
// EmailCredit::dispatchNow($email_builder, $invitation, $invitation->company);
|
||||||
|
@ -44,7 +44,7 @@ class SendEmail extends AbstractService
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->invoice->invitations->each(function ($invitation) {
|
$this->invoice->invitations->each(function ($invitation) {
|
||||||
if (!$invitation->contact->trashed() && $invitation->contact->send_email && $invitation->contact->email) {
|
if (!$invitation->contact->trashed() && $invitation->contact->email) {
|
||||||
EmailEntity::dispatchNow($invitation, $invitation->company, $this->reminder_template);
|
EmailEntity::dispatchNow($invitation, $invitation->company, $this->reminder_template);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -33,7 +33,7 @@ class SendEmail
|
|||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
$this->payment->client->contacts->each(function ($contact) {
|
$this->payment->client->contacts->each(function ($contact) {
|
||||||
if ($contact->send_email && $contact->email) {
|
if ($contact->email) {
|
||||||
EmailPayment::dispatchNow($this->payment, $this->payment->company, $contact);
|
EmailPayment::dispatchNow($this->payment, $this->payment->company, $contact);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -42,7 +42,7 @@ class SendEmail
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->quote->invitations->each(function ($invitation) {
|
$this->quote->invitations->each(function ($invitation) {
|
||||||
if (!$invitation->contact->trashed() && $invitation->contact->send_email && $invitation->contact->email) {
|
if (!$invitation->contact->trashed() && $invitation->contact->email) {
|
||||||
EmailEntity::dispatchNow($invitation, $invitation->company, $this->reminder_template);
|
EmailEntity::dispatchNow($invitation, $invitation->company, $this->reminder_template);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user