mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 17:44:32 -04:00
Added support for a white label license
This commit is contained in:
parent
012347afda
commit
04da12cecd
@ -43,6 +43,7 @@ class InvoiceController extends \BaseController {
|
||||
{
|
||||
$data = [
|
||||
'showClientHeader' => true,
|
||||
'hideLogo' => Session::get('white_label'),
|
||||
'title' => trans('texts.invoices'),
|
||||
'entityType'=>ENTITY_INVOICE,
|
||||
'columns'=>Utils::trans(['invoice_number', 'invoice_date', 'invoice_total', 'balance_due', 'due_date'])
|
||||
@ -155,7 +156,8 @@ class InvoiceController extends \BaseController {
|
||||
|
||||
Session::set($invitationKey, true);
|
||||
Session::set('invitation_key', $invitationKey);
|
||||
|
||||
Session::set('white_label', $client->account->isWhiteLabel());
|
||||
|
||||
$client->account->loadLocalizationSettings();
|
||||
|
||||
$invoice->invoice_date = Utils::fromSqlDate($invoice->invoice_date);
|
||||
@ -163,8 +165,9 @@ class InvoiceController extends \BaseController {
|
||||
$invoice->is_pro = $client->account->isPro();
|
||||
|
||||
$data = array(
|
||||
'showClientHeader' => true,
|
||||
'showClientHeader' => true,
|
||||
'showBreadcrumbs' => false,
|
||||
'hideLogo' => $client->account->isWhiteLabel(),
|
||||
'invoice' => $invoice->hidePrivateFields(),
|
||||
'invitation' => $invitation,
|
||||
'invoiceLabels' => $client->account->getInvoiceLabels(),
|
||||
|
@ -32,6 +32,7 @@ class PaymentController extends \BaseController
|
||||
{
|
||||
return View::make('public_list', array(
|
||||
'showClientHeader' => true,
|
||||
'hideLogo' => Session::get('white_label'),
|
||||
'entityType'=>ENTITY_PAYMENT,
|
||||
'title' => trans('texts.payments'),
|
||||
'columns'=>Utils::trans(['invoice', 'transaction_reference', 'method', 'payment_amount', 'payment_date'])
|
||||
@ -506,7 +507,7 @@ class PaymentController extends \BaseController
|
||||
$license->save();
|
||||
}
|
||||
|
||||
return $productId == PRODUCT_ONE_CLICK_INSTALL ? 'valid' : $_ENV['INVOICE_DESIGNS'];
|
||||
return $productId == PRODUCT_INVOICE_DESIGNS ? $_ENV['INVOICE_DESIGNS'] : 'valid';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -51,6 +51,7 @@ class QuoteController extends \BaseController {
|
||||
{
|
||||
$data = [
|
||||
'showClientHeader' => true,
|
||||
'hideLogo' => Session::get('white_label'),
|
||||
'title' => trans('texts.quotes'),
|
||||
'entityType'=>ENTITY_QUOTE,
|
||||
'columns'=>Utils::trans(['quote_number', 'quote_date', 'quote_total', 'due_date'])
|
||||
|
@ -32,7 +32,7 @@ App::before(function($request)
|
||||
if (Utils::isNinja()) {
|
||||
$data = Utils::getNewsFeedResponse();
|
||||
} else {
|
||||
$file = @file_get_contents(NINJA_URL . '/news_feed/' . Utils::getUserType() . '/' . NINJA_VERSION);
|
||||
$file = @file_get_contents(NINJA_APP_URL . '/news_feed/' . Utils::getUserType() . '/' . NINJA_VERSION);
|
||||
$data = @json_decode($file);
|
||||
}
|
||||
if ($data) {
|
||||
@ -84,10 +84,10 @@ App::before(function($request)
|
||||
$licenseKey = Input::get('license_key');
|
||||
$productId = Input::get('product_id');
|
||||
|
||||
$data = trim(file_get_contents((Utils::isNinjaDev() ? 'http://ninja.dev' : NINJA_APP_URL) . "/claim_license?license_key={$licenseKey}&product_id={$productId}"));
|
||||
|
||||
if ($productId == PRODUCT_INVOICE_DESIGNS)
|
||||
{
|
||||
$data = file_get_contents((Utils::isNinjaDev() ? 'http://ninja.dev' : NINJA_URL) . "/claim_license?license_key={$licenseKey}&product_id={$productId}");
|
||||
|
||||
if ($data = json_decode($data))
|
||||
{
|
||||
foreach ($data as $item)
|
||||
@ -99,13 +99,24 @@ App::before(function($request)
|
||||
$design->save();
|
||||
}
|
||||
|
||||
if (!Utils::isNinja()) {
|
||||
if (!Utils::isNinjaProd()) {
|
||||
Cache::forget('invoice_designs_cache_' . Auth::user()->maxInvoiceDesignId());
|
||||
}
|
||||
|
||||
Session::flash('message', trans('texts.bought_designs'));
|
||||
}
|
||||
}
|
||||
else if ($productId == PRODUCT_WHITE_LABEL)
|
||||
{
|
||||
if ($data == 'valid')
|
||||
{
|
||||
$account = Auth::user()->account;
|
||||
$account->pro_plan_paid = NINJA_DATE;
|
||||
$account->save();
|
||||
|
||||
Session::flash('message', trans('texts.bought_white_label'));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -468,6 +468,11 @@ return array(
|
||||
'payment_cvv' => '*This is the 3-4 digit number onthe back of your card',
|
||||
'payment_footer1' => '*Billing address must match address accociated with credit card.',
|
||||
'payment_footer2' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.',
|
||||
'vat_number' => 'Vat Number',
|
||||
|
||||
'white_label_link' => 'Purchase white label license',
|
||||
'white_label_text' => 'Purchase a white label license for $10.00 to remove the Invoice Ninja branding from the top of the client pages.',
|
||||
'white_label_header' => 'White Label',
|
||||
'bought_white_label' => 'Successfully enabled white label license',
|
||||
'white_labeled' => 'White labeled'
|
||||
|
||||
);
|
||||
|
@ -234,7 +234,7 @@ class Account extends Eloquent
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ($datePaid == '2000-01-01')
|
||||
else if ($datePaid == NINJA_DATE)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -246,6 +246,16 @@ class Account extends Eloquent
|
||||
return $interval->y == 0;
|
||||
}
|
||||
|
||||
public function isWhiteLabel()
|
||||
{
|
||||
if (Utils::isNinjaProd())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->pro_plan_paid == NINJA_DATE;
|
||||
}
|
||||
|
||||
public function getSubscription($eventId)
|
||||
{
|
||||
return Subscription::where('account_id', '=', $this->id)->where('event_id', '=', $eventId)->first();
|
||||
|
@ -19,6 +19,6 @@ class Invitation extends EntityModel
|
||||
|
||||
public function getLink()
|
||||
{
|
||||
return URL::to('view') . '/' . $this->invitation_key;
|
||||
return SITE_URL . '/view/' . $this->invitation_key;
|
||||
}
|
||||
}
|
@ -83,6 +83,8 @@ class ContactMailer extends Mailer {
|
||||
$message = "Softaculous install license: $license";
|
||||
} else if ($productId == PRODUCT_INVOICE_DESIGNS) {
|
||||
$message = "Invoice designs license: $license";
|
||||
} else if ($productId == PRODUCT_WHITE_LABEL) {
|
||||
$message = "White label license: $license";
|
||||
}
|
||||
|
||||
$data = [
|
||||
|
@ -253,8 +253,10 @@ define('DEMO_ACCOUNT_ID', 'DEMO_ACCOUNT_ID');
|
||||
define('NINJA_ACCOUNT_KEY', 'zg4ylmzDkdkPOT8yoKQw9LTWaoZJx79h');
|
||||
define('NINJA_GATEWAY_ID', GATEWAY_AUTHORIZE_NET);
|
||||
define('NINJA_GATEWAY_CONFIG', '{"apiLoginId":"626vWcD5","transactionKey":"4bn26TgL9r4Br4qJ","testMode":"","developerMode":""}');
|
||||
define('NINJA_URL', 'https://www.invoiceninja.com');
|
||||
define('NINJA_WEB_URL', 'https://www.invoiceninja.com');
|
||||
define('NINJA_APP_URL', 'https://www.invoiceninja.com');
|
||||
define('NINJA_VERSION', '1.5.1');
|
||||
define('NINJA_DATE', '2000-01-01');
|
||||
define('NINJA_FROM_EMAIL', 'maildelivery@invoiceninja.com');
|
||||
define('RELEASES_URL', 'https://github.com/hillelcoren/invoice-ninja/releases/');
|
||||
|
||||
@ -262,7 +264,9 @@ define('COUNT_FREE_DESIGNS', 4);
|
||||
define('PRO_PLAN_PRICE', 50);
|
||||
define('PRODUCT_ONE_CLICK_INSTALL', 1);
|
||||
define('PRODUCT_INVOICE_DESIGNS', 2);
|
||||
define('PRODUCT_WHITE_LABEL', 3);
|
||||
define('DESIGNS_AFFILIATE_KEY', 'T3RS74');
|
||||
define('WHITE_LABEL_AFFILIATE_KEY', '92D2J5');
|
||||
|
||||
define('USER_TYPE_SELF_HOST', 'SELF_HOST');
|
||||
define('USER_TYPE_CLOUD_HOST', 'CLOUD_HOST');
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
@if ($showNinjaFooter)
|
||||
<p/>
|
||||
{{ trans('texts.ninja_email_footer', ['site' => '<a href="' . NINJA_URL . '/?utm_source=invoice_email_footer">Invoice Ninja</a>']) }}
|
||||
{{ trans('texts.ninja_email_footer', ['site' => '<a href="' . NINJA_WEB_URL . '/?utm_source=invoice_email_footer">Invoice Ninja</a>']) }}
|
||||
@endif
|
||||
|
||||
</body>
|
||||
|
@ -12,5 +12,5 @@
|
||||
|
||||
@if ($showNinjaFooter)
|
||||
{{ trans('texts.ninja_email_footer', ['site' => 'Invoice Ninja']) }}
|
||||
{{ NINJA_URL }}
|
||||
{{ NINJA_WEB_URL }}
|
||||
@endif
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
@if ($showNinjaFooter)
|
||||
<p/>
|
||||
{{ trans('texts.ninja_email_footer', ['site' => '<a href="' . NINJA_URL . '/?utm_source=payment_email_footer">Invoice Ninja</a>']) }}
|
||||
{{ trans('texts.ninja_email_footer', ['site' => '<a href="' . NINJA_WEB_URL . '/?utm_source=payment_email_footer">Invoice Ninja</a>']) }}
|
||||
@endif
|
||||
|
||||
</body>
|
||||
|
@ -15,5 +15,5 @@
|
||||
|
||||
@if ($showNinjaFooter)
|
||||
{{ trans('texts.ninja_email_footer', ['site' => 'Invoice Ninja']) }}
|
||||
{{ NINJA_URL }}
|
||||
{{ NINJA_WEB_URL }}
|
||||
@endif
|
||||
|
@ -343,8 +343,35 @@ Want something changed? We're {{ link_to('https://github.com/hillelcoren/invoice
|
||||
@endif
|
||||
|
||||
{{-- Per our license, please do not remove or modify this link. --}}
|
||||
@if (!Utils::isNinja())
|
||||
<div class="container">{{ trans('texts.powered_by') }} <a href="https://www.invoiceninja.com/?utm_source=powered_by" target="_blank">InvoiceNinja.com</a></div>
|
||||
@if (Utils::isNinjaDev() || !Utils::isNinja())
|
||||
<div class="container">
|
||||
{{ trans('texts.powered_by') }} <a href="https://www.invoiceninja.com/?utm_source=powered_by" target="_blank">InvoiceNinja.com</a> -
|
||||
@if (Auth::user()->account->isWhiteLabel())
|
||||
{{ trans('texts.white_labeled') }}
|
||||
@else
|
||||
<a href="#" onclick="$('#whiteLabelModal').modal('show');">{{ trans('texts.white_label_link') }}</a>
|
||||
|
||||
<div class="modal fade" id="whiteLabelModal" tabindex="-1" role="dialog" aria-labelledby="whiteLabelModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title" id="myModalLabel">{{ trans('texts.white_label_header') }}</h4>
|
||||
</div>
|
||||
|
||||
<div style="background-color: #fff; padding:20px">
|
||||
<p>{{ trans('texts.white_label_text')}}</p>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer" id="signUpFooter" style="margin-top: 0px">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.close') }} </button>
|
||||
<button type="button" class="btn btn-primary" onclick="buyProduct('{{ WHITE_LABEL_AFFILIATE_KEY }}', '{{ PRODUCT_WHITE_LABEL }}')">{{ trans('texts.buy') }} </button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<p> </p>
|
||||
@ -467,6 +494,10 @@ Want something changed? We're {{ link_to('https://github.com/hillelcoren/invoice
|
||||
$('#signUpModal').modal('show');
|
||||
}
|
||||
|
||||
function buyProduct(affiliateKey, productId) {
|
||||
window.open('{{ Utils::isNinjaDev() ? '' : NINJA_APP_URL }}/license?affiliate_key=' + affiliateKey + '&product_id=' + productId + '&return_url=' + window.location);
|
||||
}
|
||||
|
||||
@if (Auth::check() && !Auth::user()->isPro())
|
||||
var proPlanFeature = false;
|
||||
function showProPlan(feature) {
|
||||
|
@ -37,7 +37,7 @@
|
||||
@if (Utils::isNinjaProd())
|
||||
<button type="button" class="btn btn-primary" onclick="showProPlan('invoice_designs')">{{ trans('texts.go_pro') }}</button>
|
||||
@else
|
||||
<button type="button" class="btn btn-primary" onclick="buyDesigns()">{{ trans('texts.buy') }}</button>
|
||||
<button type="button" class="btn btn-primary" onclick="buyProduct('{{ DESIGNS_AFFILIATE_KEY }}', '{{ PRODUCT_INVOICE_DESIGNS }}')">{{ trans('texts.buy') }}</button>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@ -120,8 +120,4 @@
|
||||
$('#moreDesignsModal').modal('show');
|
||||
}
|
||||
|
||||
function buyDesigns() {
|
||||
window.open('{{ Utils::isNinjaDev() ? '' : NINJA_URL }}/license?return_url=' + window.location + '&affiliate_key={{ DESIGNS_AFFILIATE_KEY }}&product_id={{ PRODUCT_INVOICE_DESIGNS }}');
|
||||
}
|
||||
|
||||
</script>
|
@ -42,7 +42,7 @@
|
||||
} catch(err) {}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* Set the defaults for DataTables initialisation */
|
||||
$.extend( true, $.fn.dataTable.defaults, {
|
||||
"bSortClasses": false,
|
||||
|
@ -106,8 +106,10 @@
|
||||
<div class="navbar" style="margin-bottom:0px">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
{{-- Per our license, please do not remove or modify this link. --}}
|
||||
<a class="navbar-brand" href="https://www.invoiceninja.com/"><img src="{{ asset('images/invoiceninja-logo.png') }}"></a>
|
||||
@if (!isset($hideLogo) || !$hideLogo)
|
||||
{{-- Per our license, please do not remove or modify this link. --}}
|
||||
<a class="navbar-brand" href="https://www.invoiceninja.com/"><img src="{{ asset('images/invoiceninja-logo.png') }}"></a>
|
||||
@endif
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="sr-only">{{ trans('public.toggle_navigation') }}</span>
|
||||
<span class="icon-bar"></span>
|
||||
@ -135,7 +137,10 @@
|
||||
<div class="navbar" style="margin-bottom:0px">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<a class="navbar-brand" href="https://www.invoiceninja.com/"><img src="{{ asset('images/invoiceninja-logo.png') }}"></a>
|
||||
{{-- Per our license, please do not remove or modify this link. --}}
|
||||
@if (!isset($hideLogo) || !$hideLogo)
|
||||
<a class="navbar-brand" href="https://www.invoiceninja.com/"><img src="{{ asset('images/invoiceninja-logo.png') }}"></a>
|
||||
@endif
|
||||
</div>
|
||||
@if (isset($showClientHeader) && $showClientHeader)
|
||||
<ul class="nav navbar-nav">
|
||||
@ -169,7 +174,9 @@
|
||||
@yield('content')
|
||||
|
||||
|
||||
<footer class="footer">
|
||||
<footer class="footer" style="min-height:400px">
|
||||
|
||||
@if ((!isset($hideHeader) || !$hideHeader) && (!isset($showClientHeader) || !$showClientHeader))
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
@ -206,7 +213,7 @@
|
||||
|
||||
<!--<iframe src="http://ghbtns.com/github-btn.html?user=hillelcoren&repo=invoice-ninja&type=watch" allowtransparency="true" frameborder="0" scrolling="0" width="62" height="20"></iframe>-->
|
||||
|
||||
<a href="{{ NINJA_URL }}"><img src="{{ asset('images/footer-logo.png') }}"></a>
|
||||
<a href="{{ NINJA_WEB_URL }}"><img src="{{ asset('images/footer-logo.png') }}"></a>
|
||||
<hr>
|
||||
<ul class="navbar-vertical">
|
||||
<li>{{ link_to('https://www.invoiceninja.com/features', trans('public.link_features') ) }}</li>
|
||||
@ -484,6 +491,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
</footer>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -1496,4 +1496,4 @@ function roundToTwo(num, toString) {
|
||||
|
||||
function truncate(str, length) {
|
||||
return (str && str.length > length) ? (str.substr(0, length-1) + '...') : str;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user