From c0409b86fda206ed87dabfe28652734b94f60a26 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 23 Dec 2015 16:21:48 +0200 Subject: [PATCH] Added custom labels to email variables --- app/Http/Controllers/PaymentController.php | 10 ++++++---- app/Ninja/Mailers/ContactMailer.php | 4 ++++ .../accounts/templates_and_reminders.blade.php | 16 ++++++++++++++++ resources/views/invoices/edit.blade.php | 1 - 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/PaymentController.php b/app/Http/Controllers/PaymentController.php index 87bb1fc596..c344f111f7 100644 --- a/app/Http/Controllers/PaymentController.php +++ b/app/Http/Controllers/PaymentController.php @@ -381,7 +381,7 @@ class PaymentController extends BaseController if ($validator->fails()) { return Redirect::to('payment/'.$invitationKey) ->withErrors($validator) - ->withInput(); + ->withInput(Request::except('cvv')); } if ($accountGateway->update_address) { @@ -422,7 +422,8 @@ class PaymentController extends BaseController $details['customerReference'] = $token; } else { $this->error('Token-No-Ref', $this->paymentService->lastError, $accountGateway); - return Redirect::to('payment/'.$invitationKey)->withInput(); + return Redirect::to('payment/'.$invitationKey) + ->withInput(Request::except('cvv')); } } } @@ -443,7 +444,8 @@ class PaymentController extends BaseController $this->error('No-Ref', $response->getMessage(), $accountGateway); if ($onSite) { - return Redirect::to('payment/'.$invitationKey)->withInput(); + return Redirect::to('payment/'.$invitationKey) + ->withInput(Request::except('cvv')); } else { return Redirect::to('view/'.$invitationKey); } @@ -472,7 +474,7 @@ class PaymentController extends BaseController } catch (\Exception $e) { $this->error('Uncaught', false, $accountGateway, $e); if ($onSite) { - return Redirect::to('payment/'.$invitationKey)->withInput(); + return Redirect::to('payment/'.$invitationKey)->withInput(Request::except('cvv')); } else { return Redirect::to('view/'.$invitationKey); } diff --git a/app/Ninja/Mailers/ContactMailer.php b/app/Ninja/Mailers/ContactMailer.php index 7efc52bfb8..b5ba4a1002 100644 --- a/app/Ninja/Mailers/ContactMailer.php +++ b/app/Ninja/Mailers/ContactMailer.php @@ -240,6 +240,10 @@ class ContactMailer extends Mailer '$viewButton' => HTML::emailViewButton($invitation->getLink(), $invoice->getEntityType()), '$paymentLink' => $invitation->getLink('payment'), '$paymentButton' => HTML::emailPaymentButton($invitation->getLink('payment')), + '$customClient1' => $account->custom_client_label1, + '$customClient2' => $account->custom_client_label2, + '$customInvoice1' => $account->custom_invoice_text_label1, + '$customInvoice2' => $account->custom_invoice_text_label2, ]; // Add variables for available payment types diff --git a/resources/views/accounts/templates_and_reminders.blade.php b/resources/views/accounts/templates_and_reminders.blade.php index d4b69eb0d7..01a7b0099b 100644 --- a/resources/views/accounts/templates_and_reminders.blade.php +++ b/resources/views/accounts/templates_and_reminders.blade.php @@ -99,6 +99,18 @@ @foreach (\App\Ninja\Mailers\ContactMailer::$variableFields as $field)
  • ${{ $field }}
  • @endforeach + @if ($account->custom_client_label1) +
  • $customClient1
  • + @endif + @if ($account->custom_client_label2) +
  • $customClient2
  • + @endif + @if ($account->custom_invoice_text_label1) +
  • $customInvoice1
  • + @endif + @if ($account->custom_invoice_text_label2) +
  • $customInvoice1
  • + @endif @if (count($account->account_gateways) > 1) @foreach (\App\Models\Gateway::$paymentTypes as $type) @if ($account->getGatewayByType($type)) @@ -198,6 +210,10 @@ '{!! HTML::flatButton('pay_now', '#36c157') !!}', ]; + // Add blanks for custom values + keys.push('customClient1', 'customClient2', 'customInvoice1', 'customInvoice2'); + vals.push('custom value', 'custom value', 'custom value', 'custom value'); + // Add any available payment method links @foreach (\App\Models\Gateway::$paymentTypes as $type) {!! "keys.push('" . \App\Models\Gateway::getPaymentTypeName($type).'Link' . "');" !!} diff --git a/resources/views/invoices/edit.blade.php b/resources/views/invoices/edit.blade.php index de51575b4e..725b8c0247 100644 --- a/resources/views/invoices/edit.blade.php +++ b/resources/views/invoices/edit.blade.php @@ -188,7 +188,6 @@