diff --git a/app/models/Account.php b/app/models/Account.php index 267cb76b9f..caaa03c126 100755 --- a/app/models/Account.php +++ b/app/models/Account.php @@ -312,18 +312,18 @@ class Account extends Eloquent return $template; } - $template = "

\$client,

\r\n" . - "

" . trans("texts.{$entityType}_message", ['amount' => '$amount']) . "

\r\n"; + $template = "\$client,

\r\n\r\n" . + trans("texts.{$entityType}_message", ['amount' => '$amount']) . "

\r\n\r\n"; if ($entityType != ENTITY_PAYMENT) { - $template .= "

\$link

\r\n"; + $template .= "\$link

\r\n\r\n"; } if ($message) { - $template .= "

$message

\r\n"; + $template .= "$message

\r\n\r\n"; } - return $template . "

\$footer

"; + return $template . "\$footer"; } public function getEmailFooter() diff --git a/app/models/Activity.php b/app/models/Activity.php index c900ee1db4..9e9cb16710 100755 --- a/app/models/Activity.php +++ b/app/models/Activity.php @@ -202,6 +202,11 @@ class Activity extends Eloquent $activity->adjustment = $invoice->is_quote || $invoice->is_recurring ? 0 : $diff; $activity->json_backup = $backupInvoice->hidePrivateFields()->toJSON(); $activity->save(); + + if ($invoice->isPaid() && $invoice->balance > 0) { + $invoice->invoice_status_id = INVOICE_STATUS_PARTIAL; + $invoice->save(); + } } } } diff --git a/app/views/accounts/email_templates.blade.php b/app/views/accounts/email_templates.blade.php index f50265e325..f22abef503 100644 --- a/app/views/accounts/email_templates.blade.php +++ b/app/views/accounts/email_templates.blade.php @@ -5,7 +5,7 @@ diff --git a/app/views/invoices/edit.blade.php b/app/views/invoices/edit.blade.php index 1c5a0fc36a..1847b394de 100755 --- a/app/views/invoices/edit.blade.php +++ b/app/views/invoices/edit.blade.php @@ -83,7 +83,7 @@ @else
- {{ Former::checkbox('recurring')->text(trans('texts.enable').'    '.trans('texts.learn_more').'')->data_bind("checked: is_recurring") + {{ Former::checkbox('recurring')->onclick('setEmailEnabled()')->text(trans('texts.enable').'    '.trans('texts.learn_more').'')->data_bind("checked: is_recurring") ->inlineHelp($invoice && $invoice->last_sent_date ? 'Last invoice sent ' . Utils::dateToString($invoice->last_sent_date) : '') }}
@endif @@ -1052,10 +1052,10 @@ self.frequency_id = ko.observable(''); //self.currency_id = ko.observable({{ $client && $client->currency_id ? $client->currency_id : Session::get(SESSION_CURRENCY) }}); self.terms = ko.observable(''); - self.default_terms = ko.observable({{ $account->invoice_terms ? 'true' : 'false' }} ? wordWrapText('{{ str_replace(["\r\n","\r","\n"], '\n', addslashes($account->invoice_terms)) }}', 300) : "{{ trans('texts.invoice_terms') }}"); + self.default_terms = ko.observable({{ $account->invoice_terms ? 'true' : 'false' }} ? wordWrapText('{{ str_replace(["\r\n","\r","\n"], '\n', addslashes($account->invoice_terms)) }}', 300) : ''); self.set_default_terms = ko.observable(false); self.invoice_footer = ko.observable(''); - self.default_footer = ko.observable({{ $account->invoice_footer ? 'true' : 'false' }} ? wordWrapText('{{ str_replace(["\r\n","\r","\n"], '\n', addslashes($account->invoice_footer)) }}', 600) : "{{ trans('texts.invoice_footer') }}"); + self.default_footer = ko.observable({{ $account->invoice_footer ? 'true' : 'false' }} ? wordWrapText('{{ str_replace(["\r\n","\r","\n"], '\n', addslashes($account->invoice_footer)) }}', 600) : ''); self.set_default_footer = ko.observable(false); self.public_notes = ko.observable(''); self.po_number = ko.observable(''); @@ -1413,7 +1413,7 @@ this.prettyRate = ko.computed({ read: function () { - return this.rate() ? parseFloat(this.rate()) : ''; + return this.rate() ? this.rate() : ''; }, write: function (value) { this.rate(value); @@ -1587,6 +1587,15 @@ } } + function setEmailEnabled() + { + if ($('#recurring').prop('checked')) { + $('#email_button').attr('disabled', true); + } else { + $('#email_button').removeAttr('disabled'); + } + } + var products = {{ $products }}; var clients = {{ $clients }}; diff --git a/app/views/payments/payment.blade.php b/app/views/payments/payment.blade.php index 845399c73e..e1019c19d3 100755 --- a/app/views/payments/payment.blade.php +++ b/app/views/payments/payment.blade.php @@ -149,8 +149,8 @@ header h3 em {
@if ($client) -

{{ $client->getDisplayName() }}

-

{{ trans('texts.invoice') . ' ' . $invoiceNumber }}|  {{ trans('texts.amount_due') }}: {{ Utils::formatMoney($amount, $currencyId) }}

+

{{{ $client->getDisplayName() }}}

+

{{{ trans('texts.invoice') . ' ' . $invoiceNumber }}}|  {{ trans('texts.amount_due') }}: {{ Utils::formatMoney($amount, $currencyId) }}

@elseif ($paymentTitle)

{{ $paymentTitle }}
{{ $paymentSubtitle }}

@endif