From e619bacf66946a4d73184e5fef675cb1f8365e47 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 4 Feb 2016 22:50:30 +0200 Subject: [PATCH] Fix for renewel logic --- app/Services/PaymentService.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Services/PaymentService.php b/app/Services/PaymentService.php index 85b20ef81245..dab7bd2924fe 100644 --- a/app/Services/PaymentService.php +++ b/app/Services/PaymentService.php @@ -218,7 +218,9 @@ class PaymentService extends BaseService $account = Account::with('users')->find($invoice->client->public_id); if ($account->pro_plan_paid && $account->pro_plan_paid != '0000-00-00') { $date = DateTime::createFromFormat('Y-m-d', $account->pro_plan_paid); - $account->pro_plan_paid = $date->modify('+1 year')->format('Y-m-d'); + $date->modify('+1 year'); + $date = max($date, date_create()); + $account->pro_plan_paid = $date->format('Y-m-d'); } else { $account->pro_plan_paid = date_create()->format('Y-m-d'); }