mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 12:12:48 +01:00
Added basic stats for resellers
This commit is contained in:
parent
bdeb062657
commit
1ac12e1506
2
LICENSE
2
LICENSE
@ -1,5 +1,5 @@
|
||||
Attribution Assurance License
|
||||
Copyright (c) 2015 by Hillel Coren
|
||||
Copyright (c) 2016 by Hillel Coren
|
||||
http://www.hillelcoren.com
|
||||
|
||||
All Rights Reserved
|
||||
|
@ -272,4 +272,29 @@ class AppController extends BaseController
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
public function stats()
|
||||
{
|
||||
if (Input::get('password') != env('RESELLER_PASSWORD')) {
|
||||
sleep(3);
|
||||
return '';
|
||||
}
|
||||
|
||||
if (Utils::getResllerType() == RESELLER_LIMITED_USERS) {
|
||||
return User::count();
|
||||
} else {
|
||||
$payments = DB::table('accounts')
|
||||
->leftJoin('payments', 'payments.account_id', '=', 'accounts.id')
|
||||
->leftJoin('clients', 'clients.id', '=', 'payments.client_id')
|
||||
->where('accounts.account_key', '=', NINJA_ACCOUNT_KEY)
|
||||
->where('payments.is_deleted', '=', false)
|
||||
->get([
|
||||
'clients.public_id as client_id',
|
||||
'payments.public_id as payment_id',
|
||||
'payments.payment_date',
|
||||
'payments.amount'
|
||||
]);
|
||||
return json_encode($payments);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ class StartupCheck
|
||||
|
||||
// Ensure all request are over HTTPS in production
|
||||
if (Utils::requireHTTPS() && !Request::secure()) {
|
||||
return Redirect::secure(Request::path());
|
||||
//return Redirect::secure(Request::path());
|
||||
}
|
||||
|
||||
// If the database doens't yet exist we'll skip the rest
|
||||
|
@ -19,6 +19,7 @@ class VerifyCsrfToken extends BaseVerifier {
|
||||
'api/v1/hooks',
|
||||
'hook/email_opened',
|
||||
'hook/email_bounced',
|
||||
'reseller_stats',
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -83,6 +83,10 @@ if (Utils::isNinja()) {
|
||||
Route::get('/demo', 'AccountController@demo');
|
||||
}
|
||||
|
||||
if (Utils::isReseller()) {
|
||||
Route::post('/reseller_stats', 'AppController@stats');
|
||||
}
|
||||
|
||||
Route::group(['middleware' => 'auth'], function() {
|
||||
Route::get('dashboard', 'DashboardController@index');
|
||||
Route::get('view_archive/{entity_type}/{visible}', 'AccountController@setTrashVisible');
|
||||
@ -583,6 +587,9 @@ if (!defined('CONTACT_EMAIL')) {
|
||||
|
||||
define('BANK_LIBRARY_OFX', 1);
|
||||
|
||||
define('RESELLER_REVENUE_SHARE', 'A');
|
||||
define('RESELLER_LIMITED_USERS', 'B');
|
||||
|
||||
$creditCards = [
|
||||
1 => ['card' => 'images/credit_cards/Test-Visa-Icon.png', 'text' => 'Visa'],
|
||||
2 => ['card' => 'images/credit_cards/Test-MasterCard-Icon.png', 'text' => 'Master Card'],
|
||||
|
@ -58,6 +58,10 @@ class Utils
|
||||
|
||||
public static function isNinjaProd()
|
||||
{
|
||||
if (Utils::isReseller()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return isset($_ENV['NINJA_PROD']) && $_ENV['NINJA_PROD'] == 'true';
|
||||
}
|
||||
|
||||
@ -71,6 +75,16 @@ class Utils
|
||||
return Utils::isNinjaProd() || (isset($_ENV['REQUIRE_HTTPS']) && $_ENV['REQUIRE_HTTPS'] == 'true');
|
||||
}
|
||||
|
||||
public static function isReseller()
|
||||
{
|
||||
return Utils::getResllerType() ? true : false;
|
||||
}
|
||||
|
||||
public static function getResllerType()
|
||||
{
|
||||
return isset($_ENV['RESELLER_TYPE']) ? $_ENV['RESELLER_TYPE'] : false;
|
||||
}
|
||||
|
||||
public static function isOAuthEnabled()
|
||||
{
|
||||
$providers = [
|
||||
|
@ -24,6 +24,10 @@ class AccountRepository
|
||||
{
|
||||
public function create($firstName = '', $lastName = '', $email = '', $password = '')
|
||||
{
|
||||
if (Utils::getResllerType() == RESELLER_LIMITED_USERS && User::count() >= 1000) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$account = new Account();
|
||||
$account->ip = Request::getClientIp();
|
||||
$account->account_key = str_random(RANDOM_KEY_LENGTH);
|
||||
|
@ -13,7 +13,7 @@
|
||||
### Reseller Program
|
||||
There are two options:
|
||||
* 10% of revenue
|
||||
* $1,000 for a site limited to 1,000 accounts
|
||||
* $1,000 for a site limited to 1,000 users
|
||||
|
||||
### Installation Options
|
||||
* [Self-Host Zip](https://www.invoiceninja.com/knowledgebase/self-host/) - Free
|
||||
|
@ -264,12 +264,12 @@
|
||||
}, 3000);
|
||||
|
||||
$('#search').blur(function(){
|
||||
$('#search').css('width', '{{ Utils::isEnglish() ? 150 : 110 }}px');
|
||||
$('#search').css('width', '110px');
|
||||
$('ul.navbar-right').show();
|
||||
});
|
||||
|
||||
$('#search').focus(function(){
|
||||
$('#search').css('width', '{{ Utils::isEnglish() ? 264 : 216 }}px');
|
||||
$('#search').css('width', '224px');
|
||||
$('ul.navbar-right').hide();
|
||||
if (!window.hasOwnProperty('searchData')) {
|
||||
trackEvent('/activity', '/search');
|
||||
@ -480,7 +480,7 @@
|
||||
|
||||
<form class="navbar-form navbar-right" role="search">
|
||||
<div class="form-group">
|
||||
<input type="text" id="search" style="width: {{ Utils::isEnglish() ? 150 : 110 }}px;padding-top:0px;padding-bottom:0px"
|
||||
<input type="text" id="search" style="width: 110px;padding-top:0px;padding-bottom:0px"
|
||||
class="form-control" placeholder="{{ trans('texts.search') }}">
|
||||
</div>
|
||||
</form>
|
||||
|
@ -484,10 +484,8 @@ function InvoiceModel(data) {
|
||||
}
|
||||
|
||||
var taxRate = parseFloat(self.tax_rate());
|
||||
//if (taxRate > 0) {
|
||||
// total = NINJA.parseFloat(total) + roundToTwo((total * (taxRate/100)));
|
||||
//}
|
||||
total = NINJA.parseFloat(total) + roundToTwo((total * (taxRate/100)));
|
||||
total = NINJA.parseFloat(total) + roundToTwo(total * (taxRate/100));
|
||||
total = roundToTwo(total);
|
||||
|
||||
var taxes = self.totals.itemTaxes();
|
||||
for (var key in taxes) {
|
||||
|
@ -239,7 +239,6 @@
|
||||
->autocomplete('cc-exp-year')
|
||||
->data_stripe('exp-year')
|
||||
->placeholder(trans('texts.expiration_year'))
|
||||
->addOption('2015', '2015')
|
||||
->addOption('2016', '2016')
|
||||
->addOption('2017', '2017')
|
||||
->addOption('2018', '2018')
|
||||
@ -249,7 +248,8 @@
|
||||
->addOption('2022', '2022')
|
||||
->addOption('2023', '2023')
|
||||
->addOption('2024', '2024')
|
||||
->addOption('2025', '2025')->label('')
|
||||
->addOption('2025', '2025')
|
||||
->addOption('2026', '2026')->label('')
|
||||
!!}
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user