Show message if white label license is expired

This commit is contained in:
Hillel Coren 2017-12-31 11:32:03 +02:00
parent 01d1c5a988
commit d91a3fd606
3 changed files with 13 additions and 13 deletions

View File

@ -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';
}
}
} else {
return RESULT_FAILURE;

View File

@ -171,14 +171,18 @@ class StartupCheck
if ($data == RESULT_FAILURE) {
Session::flash('error', trans('texts.invalid_white_label_license'));
} elseif ($data) {
$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;
$date = max(date_create($data), date_create($company->plan_expires));
$company->plan_expires = $date->modify('+1 year')->format('Y-m-d');
$company->plan_expires = $date->format('Y-m-d');
$company->plan = PLAN_WHITE_LABEL;
$company->save();
Session::flash('message', trans('texts.bought_white_label'));
}
} else {
Session::flash('error', trans('texts.white_label_license_error'));
}

View File

@ -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',
);