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