Fix for email templates

This commit is contained in:
Hillel Coren 2017-03-20 13:18:58 +02:00
parent 59dd3d8982
commit 546e1b56dc
2 changed files with 6 additions and 7 deletions

View File

@ -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 = [

View File

@ -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.<br/>Surcharges aren\'t affected by discounts, line item supports partial payments.',
'gateway_fees_help' => 'Automatically add an online payment surcharge or line item.<br/>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.',