Send only invoice notification for customers
This commit is contained in:
parent
96f9a99077
commit
0bf994ef47
@ -10,7 +10,8 @@ use App\Models\Banking\Transaction;
|
|||||||
use App\Models\Common\Company;
|
use App\Models\Common\Company;
|
||||||
use App\Models\Common\Recurring;
|
use App\Models\Common\Recurring;
|
||||||
use App\Models\Document\Document;
|
use App\Models\Document\Document;
|
||||||
use App\Notifications\Sale\Invoice as Notification;
|
use App\Notifications\Purchase\Bill as BillNotification;
|
||||||
|
use App\Notifications\Sale\Invoice as InvoiceNotification;
|
||||||
use App\Utilities\Date;
|
use App\Utilities\Date;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
@ -133,7 +134,9 @@ class RecurringCheck extends Command
|
|||||||
event(new DocumentCreated($clone, request()));
|
event(new DocumentCreated($clone, request()));
|
||||||
|
|
||||||
if ($clone->type === Document::INVOICE_TYPE) {
|
if ($clone->type === Document::INVOICE_TYPE) {
|
||||||
event(new DocumentRecurring($clone, Notification::class));
|
event(new DocumentRecurring($clone, InvoiceNotification::class));
|
||||||
|
} elseif ($clone->type === Document::BILL_TYPE) {
|
||||||
|
event(new DocumentRecurring($clone, BillNotification::class));
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace App\Listeners\Document;
|
namespace App\Listeners\Document;
|
||||||
|
|
||||||
use App\Events\Document\DocumentRecurring as Event;
|
use App\Events\Document\DocumentRecurring as Event;
|
||||||
|
use App\Models\Document\Document;
|
||||||
|
|
||||||
class SendDocumentRecurringNotification
|
class SendDocumentRecurringNotification
|
||||||
{
|
{
|
||||||
@ -18,7 +19,7 @@ class SendDocumentRecurringNotification
|
|||||||
$notification = $event->notification;
|
$notification = $event->notification;
|
||||||
|
|
||||||
// Notify the customer
|
// Notify the customer
|
||||||
if ($document->contact && !empty($document->contact_email)) {
|
if ($document->type === Document::INVOICE_TYPE && $document->contact && !empty($document->contact_email)) {
|
||||||
$document->contact->notify(new $notification($document, "{$document->type}_recur_customer"));
|
$document->contact->notify(new $notification($document, "{$document->type}_recur_customer"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user