mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Added support for a demo account
This commit is contained in:
parent
1b71aa6fcb
commit
76e9f107e7
@ -64,6 +64,22 @@ class AccountController extends \BaseController {
|
||||
return Redirect::to('/');
|
||||
}
|
||||
*/
|
||||
|
||||
public function demo()
|
||||
{
|
||||
$demoAccountId = Utils::getDemoAccountId();
|
||||
|
||||
if (!$demoAccountId) {
|
||||
return Redirect::to('/');
|
||||
}
|
||||
|
||||
$account = Account::find($demoAccountId);
|
||||
$user = $account->users()->first();
|
||||
|
||||
Auth::login($user, true);
|
||||
|
||||
return Redirect::to('invoices/create');
|
||||
}
|
||||
|
||||
public function getStarted()
|
||||
{
|
||||
|
@ -357,7 +357,7 @@ class InvoiceController extends \BaseController {
|
||||
}
|
||||
else if ($action == 'email')
|
||||
{
|
||||
if (Auth::user()->confirmed)
|
||||
if (Auth::user()->confirmed && !Auth::user()->isDemo())
|
||||
{
|
||||
$message = trans("texts.emailed_{$entityType}");
|
||||
$this->mailer->sendInvoice($invoice);
|
||||
|
@ -31,7 +31,7 @@ class Utils
|
||||
{
|
||||
return isset($_ENV['NINJA_DEV']) && $_ENV['NINJA_DEV'];
|
||||
}
|
||||
|
||||
|
||||
public static function isPro()
|
||||
{
|
||||
return Auth::check() && Auth::user()->isPro();
|
||||
@ -46,6 +46,16 @@ class Utils
|
||||
}
|
||||
}
|
||||
|
||||
public static function getDemoAccountId()
|
||||
{
|
||||
return isset($_ENV[DEMO_ACCOUNT_ID]) ? $_ENV[DEMO_ACCOUNT_ID] : false;
|
||||
}
|
||||
|
||||
public static function isDemo()
|
||||
{
|
||||
return Auth::check() && Auth::user()->isDemo();
|
||||
}
|
||||
|
||||
public static function getNewsFeedResponse($userType = false)
|
||||
{
|
||||
if (!$userType) {
|
||||
|
@ -80,6 +80,11 @@ class User extends ConfideUser implements UserInterface, RemindableInterface
|
||||
return $this->account->isPro();
|
||||
}
|
||||
|
||||
public function isDemo()
|
||||
{
|
||||
return $this->account->id == Utils::getDemoAccountId();
|
||||
}
|
||||
|
||||
public function getDisplayName()
|
||||
{
|
||||
if ($this->getFullName())
|
||||
|
@ -207,7 +207,7 @@ class InvoiceRepository
|
||||
$invoice->client_id = $data['client_id'];
|
||||
$invoice->discount = Utils::parseFloat($data['discount']);
|
||||
$invoice->invoice_number = trim($data['invoice_number']);
|
||||
$invoice->is_recurring = $data['is_recurring'] ? true : false;
|
||||
$invoice->is_recurring = $data['is_recurring'] && !Utils::isDemo() ? true : false;
|
||||
$invoice->invoice_date = Utils::toSqlDate($data['invoice_date']);
|
||||
|
||||
if ($invoice->is_recurring)
|
||||
|
@ -67,6 +67,7 @@ Route::get('logout', 'UserController@logout');
|
||||
|
||||
if (Utils::isNinja()) {
|
||||
Route::get('/news_feed/{user_type}/{version}/', 'HomeController@newsFeed');
|
||||
Route::get('/demo', 'AccountController@demo');
|
||||
}
|
||||
|
||||
Route::group(array('before' => 'auth'), function()
|
||||
@ -239,6 +240,7 @@ define('EVENT_CREATE_QUOTE', 3);
|
||||
define('EVENT_CREATE_PAYMENT', 4);
|
||||
|
||||
define('REQUESTED_PRO_PLAN', 'REQUESTED_PRO_PLAN');
|
||||
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":""}');
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Invoice Ninja | {{ isset($title) ? $title : ' Free Open-Source Online Invoicing' }}</title>
|
||||
<title>Invoice Ninja | {{ isset($title) ? $title : ' Free Open-Source Online Invoice Software' }}</title>
|
||||
<meta name="description" content="{{ isset($description) ? $description : 'Invoice Ninja is a free, open-source solution for invoicing and billing customers. With Invoice Ninja, you can easily build and send beautiful invoices from any device that has access to the web. Your clients can print your invoices, download them as pdf files, and even pay you online from within the system.' }}"></meta>
|
||||
|
||||
<!-- Source: https://github.com/hillelcoren/invoice-ninja -->
|
||||
|
@ -162,6 +162,15 @@
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@if (Utils::getDemoAccountId())
|
||||
<div class="question">
|
||||
<a class="expander" href="#">Can I see what the application looks like with sample data?</a>
|
||||
<div class="content">
|
||||
<p>Sure, <a href="https://www.invoiceninja.com/demo">click here</a> to try out our demo account.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<div class="question">
|
||||
<a class="expander" href="#">I hear that there's a version of Invoice Ninja
|
||||
that I can install myself on my own servers? Where can I learn more about this?
|
||||
|
Loading…
x
Reference in New Issue
Block a user