diff --git a/app/Http/Controllers/NinjaController.php b/app/Http/Controllers/NinjaController.php index dd25b4c58dcb..520551578d5c 100644 --- a/app/Http/Controllers/NinjaController.php +++ b/app/Http/Controllers/NinjaController.php @@ -258,12 +258,7 @@ class NinjaController extends BaseController if ($productId == PRODUCT_INVOICE_DESIGNS) { return file_get_contents(storage_path() . '/invoice_designs.txt'); } else { - // temporary fix to enable previous version to work - if (Input::get('get_date')) { - return $license->created_at->format('Y-m-d'); - } else { - return 'valid'; - } + return $license->created_at->format('Y-m-d'); } } else { return RESULT_FAILURE; diff --git a/app/Http/Middleware/StartupCheck.php b/app/Http/Middleware/StartupCheck.php index 7056e0a9bc46..6f96aee3ba3c 100644 --- a/app/Http/Middleware/StartupCheck.php +++ b/app/Http/Middleware/StartupCheck.php @@ -171,14 +171,18 @@ class StartupCheck if ($data == RESULT_FAILURE) { Session::flash('error', trans('texts.invalid_white_label_license')); } elseif ($data) { - $company->plan_term = PLAN_TERM_YEARLY; - $company->plan_paid = $data; - $date = max(date_create($data), date_create($company->plan_expires)); - $company->plan_expires = $date->modify('+1 year')->format('Y-m-d'); - $company->plan = PLAN_WHITE_LABEL; - $company->save(); + $date = date_create($data)->modify('+1 year'); + if ($date < date_create()) { + Session::flash('message', trans('texts.expired_white_label')); + } else { + $company->plan_term = PLAN_TERM_YEARLY; + $company->plan_paid = $data; + $company->plan_expires = $date->format('Y-m-d'); + $company->plan = PLAN_WHITE_LABEL; + $company->save(); - Session::flash('message', trans('texts.bought_white_label')); + Session::flash('message', trans('texts.bought_white_label')); + } } else { Session::flash('error', trans('texts.white_label_license_error')); } diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 3e12c9f8a6e9..e7004f3db101 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -2644,6 +2644,7 @@ $LANG = array( 'signature_on_invoice_help' => 'Add the following code to show your client\'s signature on the PDF.', 'signature_on_pdf' => 'Show on PDF', 'signature_on_pdf_help' => 'Show the client signature on the invoice/quote PDF.', + 'expired_white_label' => 'The white label license has expired', );