From 680b67bf7b1255278802232d821354a40d80c5dc Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 17 Nov 2014 00:23:11 +0200 Subject: [PATCH] Streamlined pro upgrade process --- app/controllers/AccountController.php | 8 +++++--- app/controllers/UserController.php | 14 ++++++-------- app/ninja/repositories/AccountRepository.php | 6 +++--- app/routes.php | 2 +- app/views/header.blade.php | 6 +++--- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index 167191cc3b82..46b788f4fbf3 100755 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -117,14 +117,16 @@ class AccountController extends \BaseController { public function enableProPlan() { - $invoice = $this->accountRepo->enableProPlan(); + $invitation = $this->accountRepo->enableProPlan(); + /* if ($invoice) { $this->contactMailer->sendInvoice($invoice); } - - return RESULT_SUCCESS; + */ + + return $invitation->invitation_key; } public function setTrashVisible($entityType, $visible) diff --git a/app/controllers/UserController.php b/app/controllers/UserController.php index bfe710c12a90..55190f1304be 100755 --- a/app/controllers/UserController.php +++ b/app/controllers/UserController.php @@ -330,15 +330,13 @@ class UserController extends BaseController { if (Session::has(REQUESTED_PRO_PLAN)) { Session::forget(REQUESTED_PRO_PLAN); - - if ($invoice = $this->accountRepo->enableProPlan()) - { - $this->contactMailer->sendInvoice($invoice); - $notice_msg = trans('texts.pro_plan_success'); - } + $invitation = $this->accountRepo->enableProPlan(); + return Redirect::to($invitation->getLink()); + } + else + { + return Redirect::action('UserController@login')->with( 'message', $notice_msg ); } - - return Redirect::action('UserController@login')->with( 'message', $notice_msg ); } } else diff --git a/app/ninja/repositories/AccountRepository.php b/app/ninja/repositories/AccountRepository.php index 13aa04f02111..2a333a34e531 100755 --- a/app/ninja/repositories/AccountRepository.php +++ b/app/ninja/repositories/AccountRepository.php @@ -109,9 +109,9 @@ class AccountRepository $publicId = $lastInvoice ? ($lastInvoice->public_id + 1) : 1; $ninjaClient = $this->getNinjaClient($ninjaAccount); - $invoice = $this->createNinjaInvoice($publicId, $ninjaAccount, $ninjaClient); + $invitation = $this->createNinjaInvoice($publicId, $ninjaAccount, $ninjaClient); - return $invoice; + return $invitation; } private function createNinjaInvoice($publicId, $account, $client) @@ -146,7 +146,7 @@ class AccountRepository $invitation->invitation_key = str_random(RANDOM_KEY_LENGTH); $invitation->save(); - return $invoice; + return $invitation; } public function getNinjaAccount() diff --git a/app/routes.php b/app/routes.php index 13cc1c72c357..e58b1606f6f4 100755 --- a/app/routes.php +++ b/app/routes.php @@ -255,7 +255,7 @@ define('NINJA_GATEWAY_ID', GATEWAY_AUTHORIZE_NET); define('NINJA_GATEWAY_CONFIG', '{"apiLoginId":"626vWcD5","transactionKey":"4bn26TgL9r4Br4qJ","testMode":"","developerMode":""}'); define('NINJA_WEB_URL', 'https://www.invoiceninja.com'); define('NINJA_APP_URL', 'https://www.invoiceninja.com'); -define('NINJA_VERSION', '1.5.1'); +define('NINJA_VERSION', '1.5.2'); define('NINJA_DATE', '2000-01-01'); define('NINJA_FROM_EMAIL', 'maildelivery@invoiceninja.com'); define('RELEASES_URL', 'https://github.com/hillelcoren/invoice-ninja/releases/'); diff --git a/app/views/header.blade.php b/app/views/header.blade.php index 0173e7733e53..f8dfeb0fe90a 100755 --- a/app/views/header.blade.php +++ b/app/views/header.blade.php @@ -343,7 +343,7 @@ 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::isNinjaDev() || !Utils::isNinja()) +@if (!Utils::isNinja())
{{ trans('texts.powered_by') }} InvoiceNinja.com | @if (Auth::user()->account->isWhiteLabel()) @@ -516,8 +516,8 @@ Want something changed? We're {{ link_to('https://github.com/hillelcoren/invoice type: 'POST', url: '{{ URL::to('account/go_pro') }}', success: function(result) { - $('#proPlanSuccess, #proPlanFooter').show(); - $('#proPlanWorking, #proPlanButton').hide(); + NINJA.formIsChanged = false; + window.location = '{{ Utils::isNinjaDev() ? '' : NINJA_APP_URL }}/view/' + result; } }); } else {