From f515d57669c5f49428ed1cd242da36b9a6b94230 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 25 May 2014 16:40:09 +0300 Subject: [PATCH] Bug fixes --- app/controllers/PaymentController.php | 19 ++++++++++++------- app/models/Account.php | 2 +- app/ninja/mailers/ContactMailer.php | 6 ++++-- app/views/emails/invoice_html.blade.php | 4 +++- app/views/emails/invoice_text.blade.php | 4 +++- .../payment_confirmation_html.blade.php | 6 ++++-- .../payment_confirmation_text.blade.php | 4 +++- app/views/header.blade.php | 2 +- app/views/invoices/view.blade.php | 2 +- app/views/public/header.blade.php | 2 ++ app/views/public/splash.blade.php | 15 ++++++++++----- 11 files changed, 44 insertions(+), 22 deletions(-) diff --git a/app/controllers/PaymentController.php b/app/controllers/PaymentController.php index ee1ad83578..75408c65ca 100755 --- a/app/controllers/PaymentController.php +++ b/app/controllers/PaymentController.php @@ -409,6 +409,18 @@ class PaymentController extends \BaseController { $invoice = $invitation->invoice; $accountGateway = $invoice->client->account->account_gateways[0]; + + if ($invoice->account->account_key == NINJA_ACCOUNT_KEY) + { + $account = Account::find($invoice->client->public_id); + $account->pro_plan_paid = date_create()->format('Y-m-d'); + $account->save(); + } + + if ($invoice->is_quote) + { + $invoice = $this->invoiceRepo->cloneInvoice($invoice, $invoice->id); + } $payment = Payment::createNew($invitation); $payment->invitation_id = $invitation->id; @@ -427,13 +439,6 @@ class PaymentController extends \BaseController $payment->save(); - if ($invoice->account->account_key == NINJA_ACCOUNT_KEY) - { - $account = Account::find($invoice->client->public_id); - $account->pro_plan_paid = date_create()->format('Y-m-d'); - $account->save(); - } - return $payment; } diff --git a/app/models/Account.php b/app/models/Account.php index ca8df787b7..7c85a1b23b 100755 --- a/app/models/Account.php +++ b/app/models/Account.php @@ -220,7 +220,7 @@ class Account extends Eloquent public function isPro() { - if (Utils::isNinjaDev()) + if (!Utils::isNinjaProd()) { return true; } diff --git a/app/ninja/mailers/ContactMailer.php b/app/ninja/mailers/ContactMailer.php index 35ae0d6902..b6bcaecc5e 100755 --- a/app/ninja/mailers/ContactMailer.php +++ b/app/ninja/mailers/ContactMailer.php @@ -36,7 +36,8 @@ class ContactMailer extends Mailer { 'accountName' => $invoice->account->getDisplayName(), 'contactName' => $invitation->contact->getDisplayName(), 'invoiceAmount' => Utils::formatMoney($invoice->amount, $invoice->client->currency_id), - 'emailFooter' => $invoice->account->email_footer + 'emailFooter' => $invoice->account->email_footer, + 'showNinjaFooter' => !$invoice->account->isPro() || !Utils::isNinjaProd() ]; $fromEmail = $invitation->user->email; @@ -65,7 +66,8 @@ class ContactMailer extends Mailer { 'accountName' => $payment->account->getDisplayName(), 'clientName' => $payment->client->getDisplayName(), 'emailFooter' => $payment->account->email_footer, - 'paymentAmount' => Utils::formatMoney($payment->amount, $payment->client->currency_id) + 'paymentAmount' => Utils::formatMoney($payment->amount, $payment->client->currency_id), + 'showNinjaFooter' => !$invoice->account->isPro() || !Utils::isNinjaProd() ]; $user = $payment->invitation->user; diff --git a/app/views/emails/invoice_html.blade.php b/app/views/emails/invoice_html.blade.php index 573017544f..f6334228e3 100755 --- a/app/views/emails/invoice_html.blade.php +++ b/app/views/emails/invoice_html.blade.php @@ -17,8 +17,10 @@ {{ $accountName }} @endif + @if ($showNinjaFooter)

- {{ trans('texts.ninja_email_footer', ['site' => 'Invoice Ninja']) }} + {{ trans('texts.ninja_email_footer', ['site' => 'Invoice Ninja']) }} + @endif \ No newline at end of file diff --git a/app/views/emails/invoice_text.blade.php b/app/views/emails/invoice_text.blade.php index 8dbd72d0ab..954cfcf925 100755 --- a/app/views/emails/invoice_text.blade.php +++ b/app/views/emails/invoice_text.blade.php @@ -10,5 +10,7 @@ {{ $accountName }} @endif +@if ($showNinjaFooter) {{ trans('texts.ninja_email_footer', ['site' => 'Invoice Ninja']) }} -https://www.invoiceninja.com \ No newline at end of file +https://www.invoiceninja.com +@endif \ No newline at end of file diff --git a/app/views/emails/payment_confirmation_html.blade.php b/app/views/emails/payment_confirmation_html.blade.php index 8c68e08bef..cdefeb3ec8 100644 --- a/app/views/emails/payment_confirmation_html.blade.php +++ b/app/views/emails/payment_confirmation_html.blade.php @@ -16,8 +16,10 @@ {{ $accountName }} @endif + @if ($showNinjaFooter)

- {{ trans('texts.ninja_email_footer', ['site' => 'Invoice Ninja']) }} - + {{ trans('texts.ninja_email_footer', ['site' => 'Invoice Ninja']) }} + @endif + \ No newline at end of file diff --git a/app/views/emails/payment_confirmation_text.blade.php b/app/views/emails/payment_confirmation_text.blade.php index e9062c3f5c..9b6b738481 100644 --- a/app/views/emails/payment_confirmation_text.blade.php +++ b/app/views/emails/payment_confirmation_text.blade.php @@ -9,5 +9,7 @@ {{ $accountName }} @endif +@if ($showNinjaFooter) {{ trans('texts.ninja_email_footer', ['site' => 'Invoice Ninja']) }} -https://www.invoiceninja.com \ No newline at end of file +https://www.invoiceninja.com +@endif \ No newline at end of file diff --git a/app/views/header.blade.php b/app/views/header.blade.php index 022205a53d..1cbb2ef892 100755 --- a/app/views/header.blade.php +++ b/app/views/header.blade.php @@ -391,7 +391,7 @@ Want something changed? We're {{ link_to('https://github.com/hillelcoren/invoice @endif @if (!Utils::isNinjaProd() && !Utils::isNinjaDev()) -

{{ trans('texts.powered_by') }} InvoiceNinja.com
+
{{ trans('texts.powered_by') }} InvoiceNinja.com
@endif

 

diff --git a/app/views/invoices/view.blade.php b/app/views/invoices/view.blade.php index e9ac326d25..ff2813abee 100755 --- a/app/views/invoices/view.blade.php +++ b/app/views/invoices/view.blade.php @@ -23,7 +23,7 @@

 

- @if ($invoice->client->account->isGatewayConfigured() && !$invoice->isPaid() && !$invoice->is_quote && !$invoice->is_recurring) + @if ($invoice->client->account->isGatewayConfigured() && !$invoice->isPaid() && !$invoice->is_recurring)
{{ Button::normal(trans('texts.download_pdf'), array('onclick' => 'onDownloadClick()', 'class' => 'btn-lg')) }} {{ Button::success_link(URL::to('payment/' . $invitation->invitation_key), trans('texts.pay_now'), array('class' => 'btn-lg pull-right')) }} diff --git a/app/views/public/header.blade.php b/app/views/public/header.blade.php index 3af6942304..a405eca304 100644 --- a/app/views/public/header.blade.php +++ b/app/views/public/header.blade.php @@ -237,6 +237,7 @@
diff --git a/app/views/public/splash.blade.php b/app/views/public/splash.blade.php index 559b544fa7..791a4a7c76 100755 --- a/app/views/public/splash.blade.php +++ b/app/views/public/splash.blade.php @@ -19,7 +19,7 @@

It's just that easy. Stop spending time on complicated and expensive invoicing.
No fuss, just get started and get paid.

+ "xcolor:#2299c0">get paid.

@@ -48,7 +48,8 @@

Free, Always

-

Invoicing with no monthly fee, because you have enough bills already! Free, now and forever! Quality invoicing to build your business and get paid.

+ +

Send unlimited invoices to 500 clients per month and never pay a dime. You are welcome to unlock still more awesome features with our Pro Plan, but our free app is a top-notch product that will do everything you need it to do, without any subscription or fees.

@@ -56,7 +57,8 @@

Open-Source

-

Cloud-based, super secure, and user-developed. Open source platforms are a better way to do business (and save the world). Need we say more?

+ +

No mysterious corporate silos here! Just full source code transparency and a devotion to working with anyone interested to build a better electronic invoicing platform. We even offer a handy zip download for a self-hosted version of Invoice Ninja.

@@ -64,7 +66,8 @@

Live .PDF View

-

Create beautiful email-ready .PDF invoices created instantly as you type. Our ‘Save & send’ feature saves you time and impresses clients.

+ +

See how your edited invoice will look as a print-friendly pdf while you make the changes. Our pdf generator works in real time while you do, on the same screen. You can even preview four beautiful preset designs. Just create, save, send, and you’re done!

@@ -72,7 +75,9 @@

Online Payments

-

PayPal? Authorize.Net? Stripe? We support many payment technologies and if you need help or advice we’ll lend a hand (we’re pretty friendly).

+

Invoices sent with our app integrate seamlessly with the gateway credit card processor of your choice, to make it super easy for your clients to send you money with just a few clicks. We play nicely with Authorize.Net, Stripe, PayPal and loads more - 23 in all!

+ +