diff --git a/VERSION.txt b/VERSION.txt index f4a6c6023..dd7e5a287 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.5.70 \ No newline at end of file +5.5.71 \ No newline at end of file diff --git a/app/Jobs/Entity/CreateEntityPdf.php b/app/Jobs/Entity/CreateEntityPdf.php index 6c12b1c1e..0f31c9f9e 100644 --- a/app/Jobs/Entity/CreateEntityPdf.php +++ b/app/Jobs/Entity/CreateEntityPdf.php @@ -76,19 +76,15 @@ class CreateEntityPdf implements ShouldQueue $this->invitation = $invitation; if ($invitation instanceof InvoiceInvitation) { - // $invitation->load('contact.client.company','invoice.client','invoice.user.account'); $this->entity = $invitation->invoice; $this->entity_string = 'invoice'; } elseif ($invitation instanceof QuoteInvitation) { - // $invitation->load('contact.client.company','quote.client','quote.user.account'); $this->entity = $invitation->quote; $this->entity_string = 'quote'; } elseif ($invitation instanceof CreditInvitation) { - // $invitation->load('contact.client.company','credit.client','credit.user.account'); $this->entity = $invitation->credit; $this->entity_string = 'credit'; } elseif ($invitation instanceof RecurringInvoiceInvitation) { - // $invitation->load('contact.client.company','recurring_invoice'); $this->entity = $invitation->recurring_invoice; $this->entity_string = 'recurring_invoice'; } diff --git a/app/Jobs/Ledger/ClientLedgerBalanceUpdate.php b/app/Jobs/Ledger/ClientLedgerBalanceUpdate.php index b63fc6562..ae39b4384 100644 --- a/app/Jobs/Ledger/ClientLedgerBalanceUpdate.php +++ b/app/Jobs/Ledger/ClientLedgerBalanceUpdate.php @@ -19,25 +19,16 @@ use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; +use Illuminate\Queue\Middleware\WithoutOverlapping; use Illuminate\Queue\SerializesModels; class ClientLedgerBalanceUpdate implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - public $tries = 1; - - public $company; - - public $client; - public $deleteWhenMissingModels = true; - - public function __construct(Company $company, Client $client) - { - $this->company = $company; - $this->client = $client; - } + public function __construct(public Company $company, public Client $client) + {} /** * Execute the job. @@ -78,4 +69,11 @@ class ClientLedgerBalanceUpdate implements ShouldQueue }); } + + + public function middleware() + { + return [(new WithoutOverlapping($this->client->id))->dontRelease()]; + } + } diff --git a/app/Jobs/Quote/QuoteWorkflowSettings.php b/app/Jobs/Quote/QuoteWorkflowSettings.php index ec95340a7..9090dc2b9 100644 --- a/app/Jobs/Quote/QuoteWorkflowSettings.php +++ b/app/Jobs/Quote/QuoteWorkflowSettings.php @@ -56,9 +56,5 @@ class QuoteWorkflowSettings implements ShouldQueue $this->quote->service()->sendEmail($invitation->contact); }); } - - // if ($this->client->getSetting('auto_archive_quote')) { - // $this->base_repository->archive($this->quote); - // } } } diff --git a/app/Listeners/Credit/CreditCreatedNotification.php b/app/Listeners/Credit/CreditCreatedNotification.php index ca8b569af..b4b4221bc 100644 --- a/app/Listeners/Credit/CreditCreatedNotification.php +++ b/app/Listeners/Credit/CreditCreatedNotification.php @@ -24,6 +24,8 @@ class CreditCreatedNotification implements ShouldQueue { use UserNotifies; + public $delay = 10; + public function __construct() { } @@ -65,10 +67,8 @@ class CreditCreatedNotification implements ShouldQueue $nmo->to_user = $user; - NinjaMailerJob::dispatch($nmo); + (new NinjaMailerJob($nmo))->handle(); - /* This prevents more than one notification being sent */ - // $first_notification_sent = false; } /* Override the methods in the Notification Class */ diff --git a/app/Listeners/Credit/CreditEmailedNotification.php b/app/Listeners/Credit/CreditEmailedNotification.php index a983fc6f7..db09b5a6a 100644 --- a/app/Listeners/Credit/CreditEmailedNotification.php +++ b/app/Listeners/Credit/CreditEmailedNotification.php @@ -62,14 +62,10 @@ class CreditEmailedNotification implements ShouldQueue $nmo->to_user = $user; - NinjaMailerJob::dispatch($nmo); + (new NinjaMailerJob($nmo))->handle(); - // $first_notification_sent = false; } - // $notification->method = $methods; - - // $user->notify($notification); } } } diff --git a/app/Listeners/Invoice/InvoiceCreatedNotification.php b/app/Listeners/Invoice/InvoiceCreatedNotification.php index 1436c1b8d..c353345e1 100644 --- a/app/Listeners/Invoice/InvoiceCreatedNotification.php +++ b/app/Listeners/Invoice/InvoiceCreatedNotification.php @@ -24,7 +24,7 @@ class InvoiceCreatedNotification implements ShouldQueue { use UserNotifies; - public $delay = 5; + public $delay = 7; public function __construct() { @@ -71,7 +71,7 @@ class InvoiceCreatedNotification implements ShouldQueue $nmo->to_user = $user; - NinjaMailerJob::dispatch($nmo); + (new NinjaMailerJob($nmo))->handle(); /* This prevents more than one notification being sent */ $first_notification_sent = false; diff --git a/app/Listeners/Invoice/InvoiceEmailedNotification.php b/app/Listeners/Invoice/InvoiceEmailedNotification.php index ffde68b79..dbae039b3 100644 --- a/app/Listeners/Invoice/InvoiceEmailedNotification.php +++ b/app/Listeners/Invoice/InvoiceEmailedNotification.php @@ -24,7 +24,7 @@ class InvoiceEmailedNotification implements ShouldQueue { use UserNotifies; - public $delay = 5; + public $delay = 10; public function __construct() { @@ -69,7 +69,7 @@ class InvoiceEmailedNotification implements ShouldQueue $nmo->to_user = $user; - NinjaMailerJob::dispatch($nmo); + (new NinjaMailerJob($nmo))->handle(); /* This prevents more than one notification being sent */ $first_notification_sent = false; diff --git a/app/Listeners/Invoice/InvoiceFailedEmailNotification.php b/app/Listeners/Invoice/InvoiceFailedEmailNotification.php index c0264f4eb..754631174 100644 --- a/app/Listeners/Invoice/InvoiceFailedEmailNotification.php +++ b/app/Listeners/Invoice/InvoiceFailedEmailNotification.php @@ -29,6 +29,8 @@ class InvoiceFailedEmailNotification use UserNotifies, Dispatchable, InteractsWithQueue, Queueable, SerializesModels; + public $delay = 7; + public function __construct() { } @@ -63,7 +65,7 @@ class InvoiceFailedEmailNotification $nmo->to_user = $user; - NinjaMailerJob::dispatch($nmo); + (new NinjaMailerJob($nmo))->handle(); $first_notification_sent = false; } diff --git a/app/Listeners/Invoice/InvoicePaidActivity.php b/app/Listeners/Invoice/InvoicePaidActivity.php index 71d9c8204..77ccdad0c 100644 --- a/app/Listeners/Invoice/InvoicePaidActivity.php +++ b/app/Listeners/Invoice/InvoicePaidActivity.php @@ -59,10 +59,5 @@ class InvoicePaidActivity implements ShouldQueue $event->invoice->subscription->service()->planPaid($event->invoice); } - // try { - // $event->invoice->service()->touchPdf(); - // } catch (\Exception $e) { - // nlog(print_r($e->getMessage(), 1)); - // } } } diff --git a/app/Listeners/Misc/InvitationViewedListener.php b/app/Listeners/Misc/InvitationViewedListener.php index 7003a464d..5c3db320f 100644 --- a/app/Listeners/Misc/InvitationViewedListener.php +++ b/app/Listeners/Misc/InvitationViewedListener.php @@ -76,7 +76,7 @@ class InvitationViewedListener implements ShouldQueue unset($methods[$key]); $nmo->to_user = $company_user->user; - NinjaMailerJob::dispatch($nmo); + (new NinjaMailerJob($nmo))->handle(); } } } diff --git a/app/Listeners/Payment/PaymentEmailedActivity.php b/app/Listeners/Payment/PaymentEmailedActivity.php index b4d75181f..52ee83b3f 100644 --- a/app/Listeners/Payment/PaymentEmailedActivity.php +++ b/app/Listeners/Payment/PaymentEmailedActivity.php @@ -39,7 +39,6 @@ class PaymentEmailedActivity implements ShouldQueue public function handle($event) { MultiDB::setDb($event->company->db); - $payment = $event->payment; } } diff --git a/app/Listeners/Payment/PaymentNotification.php b/app/Listeners/Payment/PaymentNotification.php index 40d407125..054b6bf42 100644 --- a/app/Listeners/Payment/PaymentNotification.php +++ b/app/Listeners/Payment/PaymentNotification.php @@ -26,7 +26,7 @@ class PaymentNotification implements ShouldQueue { use UserNotifies; - public $delay = 5; + public $delay = 20; /** * Create the event listener. @@ -74,7 +74,7 @@ class PaymentNotification implements ShouldQueue $nmo->to_user = $user; - NinjaMailerJob::dispatch($nmo); + (new NinjaMailerJob($nmo))->handle(); } } diff --git a/app/Listeners/PurchaseOrder/PurchaseOrderAcceptedListener.php b/app/Listeners/PurchaseOrder/PurchaseOrderAcceptedListener.php index 802a82582..7b0cd07d5 100644 --- a/app/Listeners/PurchaseOrder/PurchaseOrderAcceptedListener.php +++ b/app/Listeners/PurchaseOrder/PurchaseOrderAcceptedListener.php @@ -67,7 +67,7 @@ class PurchaseOrderAcceptedListener implements ShouldQueue $nmo->to_user = $user; - NinjaMailerJob::dispatch($nmo); + (new NinjaMailerJob($nmo))->handle(); /* This prevents more than one notification being sent */ $first_notification_sent = false; diff --git a/app/Listeners/PurchaseOrder/PurchaseOrderCreatedListener.php b/app/Listeners/PurchaseOrder/PurchaseOrderCreatedListener.php index 3d22d4fb0..11a5b7620 100644 --- a/app/Listeners/PurchaseOrder/PurchaseOrderCreatedListener.php +++ b/app/Listeners/PurchaseOrder/PurchaseOrderCreatedListener.php @@ -25,6 +25,8 @@ class PurchaseOrderCreatedListener implements ShouldQueue { use UserNotifies; + public $delay = 7; + public function __construct() { } @@ -71,7 +73,7 @@ class PurchaseOrderCreatedListener implements ShouldQueue $nmo->to_user = $user; - NinjaMailerJob::dispatch($nmo); + (new NinjaMailerJob($nmo))->handle(); /* This prevents more than one notification being sent */ $first_notification_sent = false; diff --git a/app/Listeners/PurchaseOrder/PurchaseOrderEmailedNotification.php b/app/Listeners/PurchaseOrder/PurchaseOrderEmailedNotification.php index 9def7f062..dd34be7d5 100644 --- a/app/Listeners/PurchaseOrder/PurchaseOrderEmailedNotification.php +++ b/app/Listeners/PurchaseOrder/PurchaseOrderEmailedNotification.php @@ -69,7 +69,7 @@ class PurchaseOrderEmailedNotification implements ShouldQueue $nmo->to_user = $user; - NinjaMailerJob::dispatch($nmo); + (new NinjaMailerJob($nmo))->handle(); /* This prevents more than one notification being sent */ $first_notification_sent = false; diff --git a/app/Listeners/Quote/QuoteApprovedNotification.php b/app/Listeners/Quote/QuoteApprovedNotification.php index 47bb68867..0c07011f0 100644 --- a/app/Listeners/Quote/QuoteApprovedNotification.php +++ b/app/Listeners/Quote/QuoteApprovedNotification.php @@ -25,7 +25,7 @@ class QuoteApprovedNotification implements ShouldQueue { use UserNotifies; - public $delay = 5; + public $delay = 8; public function __construct() { @@ -69,7 +69,7 @@ class QuoteApprovedNotification implements ShouldQueue $nmo->to_user = $user; - NinjaMailerJob::dispatch($nmo); + (new NinjaMailerJob($nmo))->handle(); /* This prevents more than one notification being sent */ $first_notification_sent = false; diff --git a/app/Listeners/Quote/QuoteCreatedNotification.php b/app/Listeners/Quote/QuoteCreatedNotification.php index dfecf70cd..2f2b2562e 100644 --- a/app/Listeners/Quote/QuoteCreatedNotification.php +++ b/app/Listeners/Quote/QuoteCreatedNotification.php @@ -71,7 +71,7 @@ class QuoteCreatedNotification implements ShouldQueue $nmo->to_user = $user; - NinjaMailerJob::dispatch($nmo); + (new NinjaMailerJob($nmo))->handle(); /* This prevents more than one notification being sent */ $first_notification_sent = false; diff --git a/app/Listeners/Quote/QuoteEmailedNotification.php b/app/Listeners/Quote/QuoteEmailedNotification.php index 8c67b1e84..296e7df11 100644 --- a/app/Listeners/Quote/QuoteEmailedNotification.php +++ b/app/Listeners/Quote/QuoteEmailedNotification.php @@ -54,8 +54,6 @@ class QuoteEmailedNotification implements ShouldQueue foreach ($event->invitation->company->company_users as $company_user) { $user = $company_user->user; - // $notification = new EntitySentNotification($event->invitation, 'quote'); - $methods = $this->findUserNotificationTypes($event->invitation, $company_user, 'quote', ['all_notifications', 'quote_sent', 'quote_sent_all', 'quote_sent_user']); if (($key = array_search('mail', $methods)) !== false) { @@ -63,14 +61,10 @@ class QuoteEmailedNotification implements ShouldQueue $nmo->to_user = $user; - NinjaMailerJob::dispatch($nmo); + (new NinjaMailerJob($nmo))->handle(); - // $first_notification_sent = false; } - // $notification->method = $methods; - - // $user->notify($notification); } } } diff --git a/app/Mail/Admin/EntityPaidObject.php b/app/Mail/Admin/EntityPaidObject.php index eb3c8153d..aa806d66e 100644 --- a/app/Mail/Admin/EntityPaidObject.php +++ b/app/Mail/Admin/EntityPaidObject.php @@ -16,6 +16,7 @@ use App\Utils\Ninja; use App\Utils\Number; use Illuminate\Support\Facades\App; use stdClass; +use App\Models\Payment; class EntityPaidObject { @@ -29,7 +30,7 @@ class EntityPaidObject public $settings; - public function __construct($payment) + public function __construct(public Payment $payment) { $this->payment = $payment; $this->company = $payment->company; diff --git a/app/Mail/Engine/PaymentEmailEngine.php b/app/Mail/Engine/PaymentEmailEngine.php index 6a76d5209..a16e3338e 100644 --- a/app/Mail/Engine/PaymentEmailEngine.php +++ b/app/Mail/Engine/PaymentEmailEngine.php @@ -330,7 +330,7 @@ class PaymentEmailEngine extends BaseEmailEngine $invoice_list = '

'; foreach ($this->payment->invoices as $invoice) { - $invoice_list .= ctrans('texts.invoice_number_short')." {$invoice->number} - ".Number::formatMoney($invoice->pivot->amount, $this->client).'
'; + $invoice_list .= ctrans('texts.invoice_number_short')." {$invoice->number} ".Number::formatMoney($invoice->pivot->amount, $this->client).'
'; } return $invoice_list; diff --git a/app/Models/CompanyGateway.php b/app/Models/CompanyGateway.php index bdee65f7f..7439d55ea 100644 --- a/app/Models/CompanyGateway.php +++ b/app/Models/CompanyGateway.php @@ -78,6 +78,8 @@ class CompanyGateway extends BaseModel // const TYPE_WEPAY = 309; // const TYPE_PAYFAST = 310; // const TYPE_PAYTRACE = 311; + // const TYPE_MOLLIE = 312; + // const TYPE_EWAY = 313; // const TYPE_FORTE = 314; public $gateway_consts = [ @@ -91,6 +93,8 @@ class CompanyGateway extends BaseModel '8fdeed552015b3c7b44ed6c8ebd9e992' => 309, 'd6814fc83f45d2935e7777071e629ef9' => 310, 'bbd736b3254b0aabed6ad7fda1298c88' => 311, + '1bd651fb213ca0c9d66ae3c336dc77e7' => 312, + '944c20175bbe6b9972c05bcfe294c2c7' => 313, 'kivcvjexxvdiyqtj3mju5d6yhpeht2xs' => 314, '65faab2ab6e3223dbe848b1686490baz' => 320, 'b9886f9257f0c6ee7c302f1c74475f6c' => 321, diff --git a/app/Models/CreditInvitation.php b/app/Models/CreditInvitation.php index d029f915e..1f600e19a 100644 --- a/app/Models/CreditInvitation.php +++ b/app/Models/CreditInvitation.php @@ -11,7 +11,6 @@ namespace App\Models; -use App\Events\Credit\CreditWasUpdated; use App\Jobs\Entity\CreateEntityPdf; use App\Utils\Ninja; use App\Utils\Traits\Inviteable; @@ -44,38 +43,6 @@ class CreditInvitation extends BaseModel return self::class; } - // public function getSignatureDateAttribute($value) - // { - // if (!$value) { - // return (new Carbon($value))->format('Y-m-d'); - // } - // return $value; - // } - - // public function getSentDateAttribute($value) - // { - // if (!$value) { - // return (new Carbon($value))->format('Y-m-d'); - // } - // return $value; - // } - - // public function getViewedDateAttribute($value) - // { - // if (!$value) { - // return (new Carbon($value))->format('Y-m-d'); - // } - // return $value; - // } - - // public function getOpenedDateAttribute($value) - // { - // if (!$value) { - // return (new Carbon($value))->format('Y-m-d'); - // } - // return $value; - // } - public function entityType() { return Credit::class; @@ -129,7 +96,6 @@ class CreditInvitation extends BaseModel $storage_path = Storage::url($this->credit->client->quote_filepath($this).$this->credit->numberFormatter().'.pdf'); if (! Storage::exists($this->credit->client->credit_filepath($this).$this->credit->numberFormatter().'.pdf')) { - event(new CreditWasUpdated($this->credit, $this->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null))); (new CreateEntityPdf($this))->handle(); } diff --git a/app/Models/QuoteInvitation.php b/app/Models/QuoteInvitation.php index c3508b23f..d5cb22710 100644 --- a/app/Models/QuoteInvitation.php +++ b/app/Models/QuoteInvitation.php @@ -101,7 +101,6 @@ class QuoteInvitation extends BaseModel $storage_path = Storage::url($this->quote->client->quote_filepath($this).$this->quote->numberFormatter().'.pdf'); if (! Storage::exists($this->quote->client->quote_filepath($this).$this->quote->numberFormatter().'.pdf')) { - event(new QuoteWasUpdated($this->quote, $this->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null))); (new CreateEntityPdf($this))->handle(); } diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index a8814c6e5..52faa2bf3 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -409,12 +409,10 @@ class EventServiceProvider extends ServiceProvider ], InvoiceWasUpdated::class => [ UpdateInvoiceActivity::class, - CreateInvoicePdf::class, ], InvoiceWasCreated::class => [ CreateInvoiceActivity::class, InvoiceCreatedNotification::class, - // CreateInvoicePdf::class, ], InvoiceWasPaid::class => [ InvoicePaidActivity::class, @@ -453,7 +451,7 @@ class EventServiceProvider extends ServiceProvider InvitationViewedListener::class, ], PaymentWasEmailed::class => [ - PaymentEmailedActivity::class, + // PaymentEmailedActivity::class, ], PaymentWasEmailedAndFailed::class => [ // PaymentEmailFailureActivity::class, diff --git a/app/Services/Bank/BankMatchingService.php b/app/Services/Bank/BankMatchingService.php index 663e72041..da729dad5 100644 --- a/app/Services/Bank/BankMatchingService.php +++ b/app/Services/Bank/BankMatchingService.php @@ -33,8 +33,9 @@ use Illuminate\Support\Facades\Cache; class BankMatchingService implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - - public function __construct(public $company_id, public $db){} + public function __construct(public $company_id, public $db) + { + } public function handle() :void { diff --git a/app/Services/Credit/ApplyPayment.php b/app/Services/Credit/ApplyPayment.php index f5494a4a2..20a082cee 100644 --- a/app/Services/Credit/ApplyPayment.php +++ b/app/Services/Credit/ApplyPayment.php @@ -138,6 +138,7 @@ class ApplyPayment ->updateBalance($this->amount_applied * -1) ->updatePaidToDate($this->amount_applied) ->updateStatus() + ->touchPdf() ->save(); $this->credit diff --git a/config/ninja.php b/config/ninja.php index 7896e4f4d..6708a4099 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -14,8 +14,8 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'), - 'app_version' => '5.5.70', - 'app_tag' => '5.5.70', + 'app_version' => '5.5.71', + 'app_tag' => '5.5.71', 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', ''),