diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php
index 7781f99db44f..c39b1cfb6930 100644
--- a/app/Http/Controllers/AccountController.php
+++ b/app/Http/Controllers/AccountController.php
@@ -1386,18 +1386,17 @@ class AccountController extends BaseController
public function previewEmail(TemplateService $templateService)
{
$template = Input::get('template');
- $invoice = Invoice::scope()
- ->invoices()
- ->withTrashed()
- ->first();
+ $invitation = \App\Models\Invitation::scope()
+ ->with('invoice.client.contacts')
+ ->first();
- if (! $invoice) {
+ if (! $invitation) {
return trans('texts.create_invoice_for_sample');
}
/** @var \App\Models\Account $account */
$account = Auth::user()->account;
- $invitation = $invoice->invitations->first();
+ $invoice = $invitation->invoice;
// replace the variables with sample data
$data = [
diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php
index b03f46a951d0..29804b7db446 100644
--- a/resources/lang/en/texts.php
+++ b/resources/lang/en/texts.php
@@ -2416,7 +2416,7 @@ $LANG = array(
'online_payment_surcharge' => 'Online Payment Surcharge',
'gateway_fees' => 'Gateway Fees',
'fees_disabled' => 'Fees are disabled',
- 'gateway_fees_help' => 'Automatically add an online payment surcharge or line item.
Surcharges aren\'t affected by discounts, line item supports partial payments.',
+ 'gateway_fees_help' => 'Automatically add an online payment surcharge or line item.
Surcharges aren\'t affected by discounts, line items support partial payments.',
'gateway' => 'Gateway',
'gateway_fee_change_warning' => 'If there are unpaid invoices with fees they need to be removed to prevent duplicate fees from being charged.',
'fees_surcharge_help' => 'Customize surcharge :link.',