mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Confusing quote/invoice due amount in emails #1571
This commit is contained in:
parent
b463ccf79a
commit
3a57185e8b
@ -416,9 +416,13 @@ if (! defined('APP_NAME')) {
|
||||
define('GATEWAY_TYPE_CUSTOM', 6);
|
||||
define('GATEWAY_TYPE_TOKEN', 'token');
|
||||
|
||||
define('REMINDER1', 'reminder1');
|
||||
define('REMINDER2', 'reminder2');
|
||||
define('REMINDER3', 'reminder3');
|
||||
define('TEMPLATE_INVOICE', 'invoice');
|
||||
define('TEMPLATE_QUOTE', 'quote');
|
||||
define('TEMPLATE_PARTIAL', 'partial');
|
||||
define('TEMPLATE_PAYMENT', 'payment');
|
||||
define('TEMPLATE_REMINDER1', 'reminder1');
|
||||
define('TEMPLATE_REMINDER2', 'reminder2');
|
||||
define('TEMPLATE_REMINDER3', 'reminder3');
|
||||
|
||||
define('RESET_FREQUENCY_DAILY', 1);
|
||||
define('RESET_FREQUENCY_WEEKLY', 2);
|
||||
|
@ -20,6 +20,7 @@ use App\Models\PaymentTerm;
|
||||
use App\Models\Product;
|
||||
use App\Models\TaxRate;
|
||||
use App\Models\User;
|
||||
use App\Models\AccountEmailSettings;
|
||||
use App\Ninja\Mailers\ContactMailer;
|
||||
use App\Ninja\Mailers\UserMailer;
|
||||
use App\Ninja\Repositories\AccountRepository;
|
||||
@ -653,7 +654,7 @@ class AccountController extends BaseController
|
||||
$data['account'] = $account;
|
||||
$data['templates'] = [];
|
||||
$data['defaultTemplates'] = [];
|
||||
foreach ([ENTITY_INVOICE, ENTITY_QUOTE, ENTITY_PAYMENT, REMINDER1, REMINDER2, REMINDER3] as $type) {
|
||||
foreach (AccountEmailSettings::$templates as $type) {
|
||||
$data['templates'][$type] = [
|
||||
'subject' => $account->getEmailSubject($type),
|
||||
'template' => $account->getEmailTemplate($type),
|
||||
@ -800,7 +801,7 @@ class AccountController extends BaseController
|
||||
if (Auth::user()->account->hasFeature(FEATURE_EMAIL_TEMPLATES_REMINDERS)) {
|
||||
$account = Auth::user()->account;
|
||||
|
||||
foreach ([ENTITY_INVOICE, ENTITY_QUOTE, ENTITY_PAYMENT, REMINDER1, REMINDER2, REMINDER3] as $type) {
|
||||
foreach (AccountEmailSettings::$templates as $type) {
|
||||
$subjectField = "email_subject_{$type}";
|
||||
$subject = Input::get($subjectField, $account->getEmailSubject($type));
|
||||
$account->account_email_settings->$subjectField = ($subject == $account->getDefaultEmailSubject($type) ? null : $subject);
|
||||
@ -810,7 +811,7 @@ class AccountController extends BaseController
|
||||
$account->account_email_settings->$bodyField = ($body == $account->getDefaultEmailTemplate($type) ? null : $body);
|
||||
}
|
||||
|
||||
foreach ([REMINDER1, REMINDER2, REMINDER3] as $type) {
|
||||
foreach ([TEMPLATE_REMINDER1, TEMPLATE_REMINDER2, TEMPLATE_REMINDER3] as $type) {
|
||||
$enableField = "enable_{$type}";
|
||||
$account->$enableField = Input::get($enableField) ? true : false;
|
||||
$account->{"num_days_{$type}"} = Input::get("num_days_{$type}");
|
||||
|
@ -35,4 +35,14 @@ class AccountEmailSettings extends Eloquent
|
||||
'late_fee3_percent',
|
||||
];
|
||||
|
||||
public static $templates = [
|
||||
TEMPLATE_INVOICE,
|
||||
TEMPLATE_QUOTE,
|
||||
//TEMPLATE_PARTIAL,
|
||||
TEMPLATE_PAYMENT,
|
||||
TEMPLATE_REMINDER1,
|
||||
TEMPLATE_REMINDER2,
|
||||
TEMPLATE_REMINDER3,
|
||||
];
|
||||
|
||||
}
|
||||
|
@ -22,7 +22,12 @@ trait SendsEmails
|
||||
$entityType = 'reminder';
|
||||
}
|
||||
|
||||
return trans("texts.{$entityType}_subject", ['invoice' => '$invoice', 'account' => '$account', 'quote' => '$quote']);
|
||||
return trans("texts.{$entityType}_subject", [
|
||||
'invoice' => '$invoice',
|
||||
'account' => '$account',
|
||||
'quote' => '$quote',
|
||||
'number' => '$number',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -38,6 +38,14 @@ class InvoicePresenter extends EntityPresenter
|
||||
return $account->formatMoney($invoice->balance, $invoice->client);
|
||||
}
|
||||
|
||||
public function partial()
|
||||
{
|
||||
$invoice = $this->entity;
|
||||
$account = $invoice->account;
|
||||
|
||||
return $account->formatMoney($invoice->partial, $invoice->client);
|
||||
}
|
||||
|
||||
public function requestedAmount()
|
||||
{
|
||||
$invoice = $this->entity;
|
||||
|
@ -54,6 +54,8 @@ class TemplateService
|
||||
'$balance' => $invoice->present()->balance,
|
||||
'$invoice' => $invoice->invoice_number,
|
||||
'$quote' => $invoice->invoice_number,
|
||||
'$number' => $invoice->invoice_number,
|
||||
'$partial' => $invoice->present()->partial,
|
||||
'$link' => $invitation->getLink(),
|
||||
'$password' => $passwordHTML,
|
||||
'$viewLink' => $invitation->getLink().'$password',
|
||||
|
@ -238,7 +238,7 @@ $LANG = array(
|
||||
'confirmation_subject' => 'Invoice Ninja Account Confirmation',
|
||||
'confirmation_header' => 'Account Confirmation',
|
||||
'confirmation_message' => 'Please access the link below to confirm your account.',
|
||||
'invoice_subject' => 'New invoice :invoice from :account',
|
||||
'invoice_subject' => 'New invoice :number from :account',
|
||||
'invoice_message' => 'To view your invoice for :amount, click the link below.',
|
||||
'payment_subject' => 'Payment Received',
|
||||
'payment_message' => 'Thank you for your payment of :amount.',
|
||||
@ -337,7 +337,7 @@ $LANG = array(
|
||||
'deleted_quote' => 'Successfully deleted quote',
|
||||
'deleted_quotes' => 'Successfully deleted :count quotes',
|
||||
'converted_to_invoice' => 'Successfully converted quote to invoice',
|
||||
'quote_subject' => 'New quote :quote from :account',
|
||||
'quote_subject' => 'New quote :number from :account',
|
||||
'quote_message' => 'To view your quote for :amount, click the link below.',
|
||||
'quote_link_message' => 'To view your client quote click the link below:',
|
||||
'notification_quote_sent_subject' => 'Quote :invoice was sent to :client',
|
||||
|
@ -26,13 +26,13 @@
|
||||
|
||||
{!! Former::vertical_open()->addClass('warn-on-exit') !!}
|
||||
|
||||
@foreach ([ENTITY_INVOICE, ENTITY_QUOTE, ENTITY_PAYMENT, REMINDER1, REMINDER2, REMINDER3] as $type)
|
||||
@foreach (App\Models\AccountEmailSettings::$templates as $type)
|
||||
@foreach (['subject', 'template'] as $field)
|
||||
{{ Former::populateField("email_{$field}_{$type}", $templates[$type][$field]) }}
|
||||
@endforeach
|
||||
@endforeach
|
||||
|
||||
@foreach ([REMINDER1, REMINDER2, REMINDER3] as $type)
|
||||
@foreach ([TEMPLATE_REMINDER1, TEMPLATE_REMINDER2, TEMPLATE_REMINDER3] as $type)
|
||||
@foreach (['enable', 'num_days', 'direction', 'field'] as $field)
|
||||
{{ Former::populateField("{$field}_{$type}", $account->{"{$field}_{$type}"}) }}
|
||||
@endforeach
|
||||
@ -148,7 +148,7 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var entityTypes = ['invoice', 'quote', 'payment', 'reminder1', 'reminder2', 'reminder3'];
|
||||
var entityTypes = {!! json_encode(App\Models\AccountEmailSettings::$templates) !!};
|
||||
var stringTypes = ['subject', 'template'];
|
||||
var templates = {!! json_encode($defaultTemplates) !!};
|
||||
var account = {!! Auth::user()->account !!};
|
||||
|
@ -23,10 +23,12 @@
|
||||
'amount': invoice ? formatMoneyInvoice(parseFloat(invoice.partial) || parseFloat(invoice.balance_amount), invoice) : formatMoneyAccount(100, account),
|
||||
'balance': invoice ? formatMoneyInvoice(parseFloat(invoice.balance), invoice) : formatMoneyAccount(100, account),
|
||||
'total': invoice ? formatMoneyInvoice(parseFloat(invoice.amount), invoice) : formatMoneyAccount(100, account),
|
||||
'partial': invoice ? formatMoneyInvoice(parseFloat(invoice.partial), invoice) : formatMoneyAccount(10, account),
|
||||
'contact': invoice ? getContactDisplayName(invoice.client.contacts[0]) : 'Contact Name',
|
||||
'firstName': invoice ? invoice.client.contacts[0].first_name : 'First Name',
|
||||
'invoice': invoice ? invoice.invoice_number : '0001',
|
||||
'quote': invoice ? invoice.invoice_number : '0001',
|
||||
'number': invoice ? invoice.invoice_number : '0001',
|
||||
'password': passwordHtml,
|
||||
'documents': documentsHtml,
|
||||
'viewLink': '{{ link_to('#', url('/view/...')) }}$password',
|
||||
@ -95,6 +97,23 @@
|
||||
<li>${{ $field }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
<p>{{ trans('texts.invoice_variables') }}</p>
|
||||
<ul>
|
||||
@foreach([
|
||||
'number',
|
||||
'amount',
|
||||
'total',
|
||||
'balance',
|
||||
'partial',
|
||||
'invoiceDate',
|
||||
'dueDate',
|
||||
'documents',
|
||||
] as $field)
|
||||
<li>${{ $field }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<p>{{ trans('texts.client_variables') }}</p>
|
||||
<ul>
|
||||
@foreach([
|
||||
@ -107,23 +126,6 @@
|
||||
<li>${{ $field }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
<p>{{ trans('texts.invoice_variables') }}</p>
|
||||
<ul>
|
||||
@foreach([
|
||||
'invoice',
|
||||
'quote',
|
||||
'amount',
|
||||
'total',
|
||||
'balance',
|
||||
'invoiceDate',
|
||||
'dueDate',
|
||||
'documents',
|
||||
] as $field)
|
||||
<li>${{ $field }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<p>{{ trans('texts.navigation_variables') }}</p>
|
||||
<ul>
|
||||
@foreach([
|
||||
|
Loading…
x
Reference in New Issue
Block a user