diff --git a/app/Http/Controllers/LicenseController.php b/app/Http/Controllers/LicenseController.php index d762b69c9017..ba24a7d0650d 100644 --- a/app/Http/Controllers/LicenseController.php +++ b/app/Http/Controllers/LicenseController.php @@ -107,6 +107,12 @@ class LicenseController extends BaseController 'errors' => new stdClass, ]; + $account->plan_term = Account::PLAN_TERM_YEARLY; + $account->plan_paid = null; + $account->plan_expires = null; + $account->plan = Account::PLAN_FREE; + $account->save(); + return response()->json($error, 400); } else { $account = auth()->user()->company()->account; diff --git a/app/Jobs/Mail/NinjaMailerJob.php b/app/Jobs/Mail/NinjaMailerJob.php index 879057ff3409..f3730dece83b 100644 --- a/app/Jobs/Mail/NinjaMailerJob.php +++ b/app/Jobs/Mail/NinjaMailerJob.php @@ -116,10 +116,12 @@ class NinjaMailerJob implements ShouldQueue } catch (\Exception $e) { nlog("error failed with {$e->getMessage()}"); - // nlog($e); if($this->nmo->entity) $this->entityEmailFailed($e->getMessage()); + + if(Ninja::isHosted()) + app('sentry')->captureException($e); } } diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index 3659f52f6ba3..8b8ea1ab5a79 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -1618,6 +1618,9 @@ class Import implements ShouldQueue ->batch(); info(print_r($exception->getMessage(), 1)); + + if(Ninja::isHosted()) + app('sentry')->captureException($exception); } diff --git a/app/Services/Invoice/HandleRestore.php b/app/Services/Invoice/HandleRestore.php index fa346d3fb571..f79f1e4f5610 100644 --- a/app/Services/Invoice/HandleRestore.php +++ b/app/Services/Invoice/HandleRestore.php @@ -13,9 +13,13 @@ namespace App\Services\Invoice; use App\Models\Invoice; use App\Services\AbstractService; +use App\Utils\Ninja; +use App\Utils\Traits\GeneratesCounter; class HandleRestore extends AbstractService { + use GeneratesCounter; + private $invoice; private $payment_total = 0; @@ -100,10 +104,22 @@ class HandleRestore extends AbstractService } try { + + $exists = Invoice::where(['company_id' => $this->invoice->company_id, 'number' => $new_invoice_number])->exists(); + + if($exists) + $this->invoice->number = $this->getNextInvoiceNumber($this->invoice->client, $this->invoice, $this->invoice->recurring_id); + else $this->invoice->number = $new_invoice_number; + $this->invoice->save(); } catch (\Exception $e) { - info("I could not wind back the invoice number"); + nlog("I could not wind back the invoice number"); + + if(Ninja::isHosted()){ + \Sentry\captureMessage("I could not wind back the invoice number"); + app('sentry')->captureException($e); + } } } }