mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Clarify license validation error
This commit is contained in:
parent
a320c0d0de
commit
a40a04e4ff
@ -135,33 +135,20 @@ class StartupCheck
|
|||||||
$url = (Utils::isNinjaDev() ? SITE_URL : NINJA_APP_URL) . "/claim_license?license_key={$licenseKey}&product_id={$productId}&get_date=true";
|
$url = (Utils::isNinjaDev() ? SITE_URL : NINJA_APP_URL) . "/claim_license?license_key={$licenseKey}&product_id={$productId}&get_date=true";
|
||||||
$data = trim(CurlUtils::get($url));
|
$data = trim(CurlUtils::get($url));
|
||||||
|
|
||||||
if ($productId == PRODUCT_INVOICE_DESIGNS) {
|
if ($data == RESULT_FAILURE) {
|
||||||
if ($data = json_decode($data)) {
|
Session::flash('error', trans('texts.invalid_white_label_license'));
|
||||||
foreach ($data as $item) {
|
} elseif ($data) {
|
||||||
$design = new InvoiceDesign();
|
$company = Auth::user()->account->company;
|
||||||
$design->id = $item->id;
|
$company->plan_term = PLAN_TERM_YEARLY;
|
||||||
$design->name = $item->name;
|
$company->plan_paid = $data;
|
||||||
$design->pdfmake = $item->pdfmake;
|
$date = max(date_create($data), date_create($company->plan_expires));
|
||||||
$design->save();
|
$company->plan_expires = $date->modify('+1 year')->format('Y-m-d');
|
||||||
}
|
$company->plan = PLAN_WHITE_LABEL;
|
||||||
|
$company->save();
|
||||||
|
|
||||||
Cache::forget('invoiceDesigns');
|
Session::flash('message', trans('texts.bought_white_label'));
|
||||||
Session::flash('message', trans('texts.bought_designs'));
|
} else {
|
||||||
}
|
Session::flash('error', trans('texts.white_label_license_error'));
|
||||||
} elseif ($productId == PRODUCT_WHITE_LABEL) {
|
|
||||||
if ($data && $data != RESULT_FAILURE) {
|
|
||||||
$company = Auth::user()->account->company;
|
|
||||||
$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();
|
|
||||||
|
|
||||||
Session::flash('message', trans('texts.bought_white_label'));
|
|
||||||
} else {
|
|
||||||
Session::flash('error', trans('texts.invalid_white_label_license'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2491,6 +2491,7 @@ $LANG = array(
|
|||||||
'invalid_file' => 'Invalid file type',
|
'invalid_file' => 'Invalid file type',
|
||||||
'add_documents_to_invoice' => 'Add documents to invoice',
|
'add_documents_to_invoice' => 'Add documents to invoice',
|
||||||
'mark_expense_paid' => 'Mark paid',
|
'mark_expense_paid' => 'Mark paid',
|
||||||
|
'white_label_license_error' => 'Failed to validate the license, check storage/logs/laravel-error.log for more details.',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user