Changes for white label license

This commit is contained in:
Hillel Coren 2016-04-21 22:01:17 +03:00
parent f9c36fd761
commit ad68d64dca
4 changed files with 26 additions and 8 deletions

View File

@ -62,8 +62,12 @@ class SendRenewalInvoices extends Command
$invoice->due_date = date('Y-m-d', strtotime('+ 10 days')); $invoice->due_date = date('Y-m-d', strtotime('+ 10 days'));
$invoice->save(); $invoice->save();
$this->mailer->sendInvoice($invoice); if ($term == PLAN_TERM_YEARLY) {
$this->info("Sent invoice to {$client->getDisplayName()}"); $this->mailer->sendInvoice($invoice);
$this->info("Sent {$term}ly {$plan} invoice to {$client->getDisplayName()}");
} else {
$this->info("Created {$term}ly {$plan} invoice for {$client->getDisplayName()}");
}
} }
$this->info('Done'); $this->info('Done');

View File

@ -142,7 +142,9 @@ class StartupCheck
} elseif ($productId == PRODUCT_WHITE_LABEL) { } elseif ($productId == PRODUCT_WHITE_LABEL) {
if ($data == 'valid') { if ($data == 'valid') {
$company = Auth::user()->account->company; $company = Auth::user()->account->company;
$company->plan_term = PLAN_TERM_YEARLY;
$company->plan_paid = date_create()->format('Y-m-d'); $company->plan_paid = date_create()->format('Y-m-d');
$company->plan_expires = date_create()->modify('+1 year')->format('Y-m-d');
$company->plan = PLAN_WHITE_LABEL; $company->plan = PLAN_WHITE_LABEL;
$company->save(); $company->save();

View File

@ -554,6 +554,7 @@ if (!defined('CONTACT_EMAIL')) {
define('NINJA_GATEWAY_CONFIG', 'NINJA_GATEWAY_CONFIG'); define('NINJA_GATEWAY_CONFIG', 'NINJA_GATEWAY_CONFIG');
define('NINJA_WEB_URL', 'https://www.invoiceninja.com'); define('NINJA_WEB_URL', 'https://www.invoiceninja.com');
define('NINJA_APP_URL', 'https://app.invoiceninja.com'); define('NINJA_APP_URL', 'https://app.invoiceninja.com');
define('NINJA_DATE', '2000-01-01');
define('NINJA_VERSION', '2.5.1.3'); define('NINJA_VERSION', '2.5.1.3');
define('SOCIAL_LINK_FACEBOOK', 'https://www.facebook.com/invoiceninja'); define('SOCIAL_LINK_FACEBOOK', 'https://www.facebook.com/invoiceninja');

View File

@ -127,13 +127,24 @@ class EnterprisePlan extends Migration
$company->plan_started = $primaryAccount->pro_plan_paid; $company->plan_started = $primaryAccount->pro_plan_paid;
$company->plan_paid = $primaryAccount->pro_plan_paid; $company->plan_paid = $primaryAccount->pro_plan_paid;
$expires = DateTime::createFromFormat('Y-m-d', $primaryAccount->pro_plan_paid);
$expires->modify('+1 year');
$expires = $expires->format('Y-m-d');
// check for self host white label licenses
if (!Utils::isNinjaProd()) { if (!Utils::isNinjaProd()) {
$company->plan = 'white_label'; if ($company->plan_paid) {
$company->plan_term = null; $company->plan = 'white_label';
} elseif ($company->plan_paid != '2000-01-01'/* NINJA_DATE*/) { // old ones were unlimited, new ones are yearly
$expires = DateTime::createFromFormat('Y-m-d', $primaryAccount->pro_plan_paid); if ($company->plan_paid == NINJA_DATE) {
$expires->modify('+1 year'); $company->plan_term = null;
$company->plan_expires = $expires->format('Y-m-d'); } else {
$company->plan_term = PLAN_TERM_YEARLY;
$company->plan_expires = $expires;
}
}
} elseif ($company->plan_paid != NINJA_DATE) {
$company->plan_expires = $expires;
} }
} }