diff --git a/app/Console/Commands/CheckData.php b/app/Console/Commands/CheckData.php index 96dec67b68d7..835038859f3b 100644 --- a/app/Console/Commands/CheckData.php +++ b/app/Console/Commands/CheckData.php @@ -866,7 +866,7 @@ class CheckData extends Command foreach(Invoice::with(['payments'])->whereHas('payments')->where('status_id', 4)->where('balance', '>', 0)->where('is_deleted',0)->cursor() as $invoice) { - $this->$this->wrong_paid_status++; + $this->wrong_paid_status++; $this->logMessage("# {$invoice->id} " . ' - '.$invoice->number." - Marked as paid, but balance = {$invoice->balance}"); diff --git a/app/Models/Account.php b/app/Models/Account.php index 0ad6674c9f1d..d41ec4e95267 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -375,7 +375,7 @@ class Account extends BaseModel { if(Carbon::createFromTimestamp($this->created_at)->diffInWeeks() == 0) - return 50; + return 20; if($this->isPaid()){ $limit = $this->paid_plan_email_quota; diff --git a/app/Services/Invoice/AutoBillInvoice.php b/app/Services/Invoice/AutoBillInvoice.php index 4a5c8cafca99..fa0f8f0bea05 100644 --- a/app/Services/Invoice/AutoBillInvoice.php +++ b/app/Services/Invoice/AutoBillInvoice.php @@ -123,6 +123,7 @@ class AutoBillInvoice extends AbstractService ->setPaymentHash($payment_hash) ->tokenBilling($gateway_token, $payment_hash); } catch (\Exception $e) { + $this->invoice->auto_bill_tries += 1; if ($this->invoice->auto_bill_tries == 3) { @@ -131,6 +132,8 @@ class AutoBillInvoice extends AbstractService $this->invoice->save(); } + $this->invoice->save(); + nlog("payment NOT captured for " . $this->invoice->number . " with error " . $e->getMessage()); } diff --git a/app/Services/Invoice/UpdateReminder.php b/app/Services/Invoice/UpdateReminder.php index 50148c23670c..52f604263e0a 100644 --- a/app/Services/Invoice/UpdateReminder.php +++ b/app/Services/Invoice/UpdateReminder.php @@ -58,6 +58,7 @@ class UpdateReminder extends AbstractService } if (is_null($this->invoice->reminder1_sent) && + $this->invoice->due_date && $this->settings->schedule_reminder1 == 'before_due_date') { $reminder_date = Carbon::parse($this->invoice->due_date)->startOfDay()->subDays($this->settings->num_days_reminder1)->addSeconds($offset); @@ -66,6 +67,7 @@ class UpdateReminder extends AbstractService } if (is_null($this->invoice->reminder1_sent) && + $this->invoice->due_date && $this->settings->schedule_reminder1 == 'after_due_date') { $reminder_date = Carbon::parse($this->invoice->due_date)->startOfDay()->addDays($this->settings->num_days_reminder1)->addSeconds($offset); @@ -82,6 +84,7 @@ class UpdateReminder extends AbstractService } if (is_null($this->invoice->reminder2_sent) && + $this->invoice->due_date && $this->settings->schedule_reminder2 == 'before_due_date') { $reminder_date = Carbon::parse($this->invoice->due_date)->startOfDay()->subDays($this->settings->num_days_reminder2)->addSeconds($offset); @@ -90,6 +93,7 @@ class UpdateReminder extends AbstractService } if (is_null($this->invoice->reminder2_sent) && + $this->invoice->due_date && $this->settings->schedule_reminder2 == 'after_due_date') { $reminder_date = Carbon::parse($this->invoice->due_date)->startOfDay()->addDays($this->settings->num_days_reminder2)->addSeconds($offset); @@ -106,6 +110,7 @@ class UpdateReminder extends AbstractService } if (is_null($this->invoice->reminder3_sent) && + $this->invoice->due_date && $this->settings->schedule_reminder3 == 'before_due_date') { $reminder_date = Carbon::parse($this->invoice->due_date)->startOfDay()->subDays($this->settings->num_days_reminder3)->addSeconds($offset); @@ -114,6 +119,7 @@ class UpdateReminder extends AbstractService } if (is_null($this->invoice->reminder3_sent) && + $this->invoice->due_date && $this->settings->schedule_reminder3 == 'after_due_date') { $reminder_date = Carbon::parse($this->invoice->due_date)->startOfDay()->addDays($this->settings->num_days_reminder3)->addSeconds($offset); diff --git a/app/Utils/Helpers.php b/app/Utils/Helpers.php index 28cf1adc2596..2bd59028e76d 100644 --- a/app/Utils/Helpers.php +++ b/app/Utils/Helpers.php @@ -116,6 +116,11 @@ class Helpers $replacements = [ 'literal' => [ + ':MONTHYEAR' => \sprintf( + '%s %s', + Carbon::createFromDate(now()->month)->translatedFormat('F'), + now()->year, + ), ':MONTH' => Carbon::createFromDate(now()->year, now()->month)->translatedFormat('F'), ':YEAR' => now()->year, ':QUARTER' => 'Q' . now()->quarter, @@ -139,6 +144,7 @@ class Helpers ), ], 'raw' => [ + ':MONTHYEAR' => now()->month, ':MONTH' => now()->month, ':YEAR' => now()->year, ':QUARTER' => now()->quarter, @@ -256,6 +262,18 @@ class Helpers $output = \Carbon\Carbon::create()->month($output)->translatedFormat('F'); } + if ($matches->keys()->first() == ':MONTHYEAR') { + + $final_date = now()->addMonths($output-now()->month); + + $output = \sprintf( + '%s %s', + $final_date->translatedFormat('F'), + $final_date->year, + ); + + } + $value = preg_replace( $target, $output, $value, 1 );