mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 17:54:30 -04:00
Show dashboard alert when white label license is expired
This commit is contained in:
parent
cf0889bc90
commit
f0f62790a6
@ -47,6 +47,8 @@ class DashboardController extends BaseController
|
||||
&& env('BLUEVINE_PARTNER_UNIQUE_ID')
|
||||
&& $account->created_at <= date( 'Y-m-d', strtotime( '-1 month' ));
|
||||
|
||||
$showWhiteLabelExpired = Utils::isSelfHost() && $account->company->hasExpiredPlan(PLAN_WHITE_LABEL);
|
||||
|
||||
// check if the account has quotes
|
||||
$hasQuotes = false;
|
||||
foreach ([$upcoming, $pastDue] as $data) {
|
||||
@ -96,6 +98,7 @@ class DashboardController extends BaseController
|
||||
'expenses' => $expenses,
|
||||
'tasks' => $tasks,
|
||||
'showBlueVinePromo' => $showBlueVinePromo,
|
||||
'showWhiteLabelExpired' => $showWhiteLabelExpired,
|
||||
];
|
||||
|
||||
if ($showBlueVinePromo) {
|
||||
|
@ -6,6 +6,7 @@ use Input;
|
||||
use Utils;
|
||||
use View;
|
||||
use Validator;
|
||||
use Auth;
|
||||
use URL;
|
||||
use Cache;
|
||||
use Omnipay;
|
||||
@ -274,4 +275,15 @@ class NinjaController extends BaseController
|
||||
Session::flash('error', $message);
|
||||
Utils::logError("Payment Error [{$type}]: " . ($exception ? Utils::getErrorString($exception) : $message), 'PHP', true);
|
||||
}
|
||||
|
||||
public function hideWhiteLabelMessage()
|
||||
{
|
||||
$user = Auth::user();
|
||||
$company = $user->account->company;
|
||||
|
||||
$company->plan = null;
|
||||
$company->save();
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -228,6 +228,7 @@ Route::group(['middleware' => 'auth:user'], function() {
|
||||
Route::post('bluevine/signup', 'BlueVineController@signup');
|
||||
Route::get('bluevine/hide_message', 'BlueVineController@hideMessage');
|
||||
Route::get('bluevine/completed', 'BlueVineController@handleCompleted');
|
||||
Route::get('white_label/hide_message', 'NinjaController@hideWhiteLabelMessage');
|
||||
});
|
||||
|
||||
Route::group([
|
||||
|
@ -67,6 +67,11 @@ class Utils
|
||||
return self::isNinjaProd() || self::isNinjaDev();
|
||||
}
|
||||
|
||||
public static function isSelfHost()
|
||||
{
|
||||
return ! static::isNinjaProd();
|
||||
}
|
||||
|
||||
public static function isNinjaProd()
|
||||
{
|
||||
if (Utils::isReseller()) {
|
||||
|
@ -88,6 +88,15 @@ class Company extends Eloquent
|
||||
return Carbon::parse($this->plan_expires) >= Carbon::today();
|
||||
}
|
||||
|
||||
public function hasExpiredPlan($plan)
|
||||
{
|
||||
if ($this->plan != $plan) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Carbon::parse($this->plan_expires) < Carbon::today();
|
||||
}
|
||||
|
||||
public function hasEarnedPromo()
|
||||
{
|
||||
if ( ! Utils::isNinjaProd() || Utils::isPro()) {
|
||||
|
@ -2286,6 +2286,8 @@ $LANG = array(
|
||||
'require' => 'Require',
|
||||
'license_expiring' => 'Note: Your license will expire in :count days, :link to renew it.',
|
||||
'security_confirmation' => 'Your email address has been confirmed.',
|
||||
'white_label_expired' => 'Your white label license has expired, please consider renewing it to help support our project.',
|
||||
'renew_license' => 'Renew License',
|
||||
|
||||
);
|
||||
|
||||
|
@ -204,6 +204,10 @@
|
||||
@include('partials/bluevine_promo')
|
||||
@endif
|
||||
|
||||
@if ($showWhiteLabelExpired)
|
||||
@include('partials/white_label_expired')
|
||||
@endif
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="panel panel-default">
|
||||
|
Loading…
x
Reference in New Issue
Block a user