From 8317b0349f57607cdf56c60096f38c61a4eddd73 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Tue, 11 Nov 2014 10:29:43 +0200 Subject: [PATCH] Minor bug fixes --- app/controllers/AccountController.php | 5 ++++- app/ninja/mailers/ContactMailer.php | 14 +++++++------- app/ninja/repositories/AccountRepository.php | 2 ++ app/views/accounts/product.blade.php | 2 +- app/views/header.blade.php | 19 +++++++++++-------- 5 files changed, 25 insertions(+), 17 deletions(-) diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index 61ab8839953e..167191cc3b82 100755 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -912,7 +912,10 @@ class AccountController extends \BaseController { $user->registered = true; $user->amend(); - $this->userMailer->sendConfirmation($user); + if (Utils::isNinja()) + { + $this->userMailer->sendConfirmation($user); + } $activities = Activity::scope()->get(); foreach ($activities as $activity) diff --git a/app/ninja/mailers/ContactMailer.php b/app/ninja/mailers/ContactMailer.php index fd9da56aa45d..00eaaba836fd 100755 --- a/app/ninja/mailers/ContactMailer.php +++ b/app/ninja/mailers/ContactMailer.php @@ -18,6 +18,7 @@ class ContactMailer extends Mailer { $view = 'invoice'; $subject = trans("texts.{$entityType}_subject", ['invoice' => $invoice->invoice_number, 'account' => $invoice->account->getDisplayName()]); + $accountName = $invoice->account->getDisplayName(); foreach ($invoice->invitations as $invitation) { @@ -33,17 +34,15 @@ class ContactMailer extends Mailer { 'entityType' => $entityType, 'link' => $invitation->getLink(), 'clientName' => $invoice->client->getDisplayName(), - 'accountName' => $invoice->account->getDisplayName(), + 'accountName' => $accountName, 'contactName' => $invitation->contact->getDisplayName(), 'invoiceAmount' => Utils::formatMoney($invoice->amount, $invoice->client->currency_id), 'emailFooter' => $invoice->account->email_footer, 'showNinjaFooter' => !$invoice->account->isPro() ]; - $fromEmail = $invitation->user->email; - $fromName = $invitation->user->getDisplayName(); - - $this->sendTo($invitation->contact->email, $fromEmail, $fromName, $subject, $view, $data); + $fromEmail = $invitation->user->email; + $this->sendTo($invitation->contact->email, $fromEmail, $accountName, $subject, $view, $data); Activity::emailInvoice($invitation); } @@ -61,9 +60,10 @@ class ContactMailer extends Mailer { { $view = 'payment_confirmation'; $subject = trans('texts.payment_subject', ['invoice' => $payment->invoice->invoice_number]); + $accountName = $payment->account->getDisplayName(); $data = [ - 'accountName' => $payment->account->getDisplayName(), + 'accountName' => $accountName, 'clientName' => $payment->client->getDisplayName(), 'emailFooter' => $payment->account->email_footer, 'paymentAmount' => Utils::formatMoney($payment->amount, $payment->client->currency_id), @@ -71,7 +71,7 @@ class ContactMailer extends Mailer { ]; $user = $payment->invitation->user; - $this->sendTo($payment->contact->email, $user->email, $user->getDisplayName(), $subject, $view, $data); + $this->sendTo($payment->contact->email, $user->email, $accountName, $subject, $view, $data); } public function sendLicensePaymentConfirmation($name, $email, $amount, $license, $productId) diff --git a/app/ninja/repositories/AccountRepository.php b/app/ninja/repositories/AccountRepository.php index d8f992a00edb..13aa04f02111 100755 --- a/app/ninja/repositories/AccountRepository.php +++ b/app/ninja/repositories/AccountRepository.php @@ -12,6 +12,7 @@ use Invitation; use Invoice; use InvoiceItem; use AccountGateway; +use Utils; class AccountRepository { @@ -38,6 +39,7 @@ class AccountRepository $user->password = $random; $user->password_confirmation = $random; $user->username = $random; + $user->confirmed = !Utils::isNinja(); $account->users()->save($user, []); return $account; diff --git a/app/views/accounts/product.blade.php b/app/views/accounts/product.blade.php index daa4dc01c7b6..c6acabecf0e2 100644 --- a/app/views/accounts/product.blade.php +++ b/app/views/accounts/product.blade.php @@ -12,7 +12,7 @@ @if ($product) {{ Former::populate($product) }} - {{ Former::populateField('cost', number_format($product->cost, 2)) }} + {{ Former::populateField('cost', number_format($product->cost, 2, '.', '')) }} @endif {{ Former::text('product_key')->label('texts.product') }} diff --git a/app/views/header.blade.php b/app/views/header.blade.php index 03f22e47d4e1..4cf9a3ba22cd 100755 --- a/app/views/header.blade.php +++ b/app/views/header.blade.php @@ -255,7 +255,6 @@ Want something changed? We're {{ link_to('https://github.com/hillelcoren/invoice

- @@ -454,12 +454,10 @@ Want something changed? We're {{ link_to('https://github.com/hillelcoren/invoice localStorage.setItem('guest_key', ''); trackUrl('/signed_up'); NINJA.isRegistered = true; - /* $('#signUpButton').hide(); - $('#myAccountButton').html(result); - */ + $('#myAccountButton').html(result); } - $('#signUpSuccessDiv, #signUpFooter').show(); + $('#signUpSuccessDiv, #signUpFooter, #closeSignUpButton').show(); $('#working, #saveSignUpButton').hide(); } }); @@ -577,6 +575,11 @@ Want something changed? We're {{ link_to('https://github.com/hillelcoren/invoice }) @endif + @if (Auth::check() && !Utils::isNinja() && !Auth::user()->registered) + $('#closeSignUpButton').hide(); + showSignUp(); + @endif + @yield('onReady') });