Bug fixes

This commit is contained in:
Hillel Coren 2015-03-02 16:17:33 +02:00
parent d605c26bd4
commit 6e03bc7510
5 changed files with 26 additions and 12 deletions

View File

@ -312,18 +312,18 @@ class Account extends Eloquent
return $template; return $template;
} }
$template = "<p>\$client,</p>\r\n" . $template = "\$client,<p/>\r\n\r\n" .
"<p>" . trans("texts.{$entityType}_message", ['amount' => '$amount']) . "</p>\r\n"; trans("texts.{$entityType}_message", ['amount' => '$amount']) . "<p/>\r\n\r\n";
if ($entityType != ENTITY_PAYMENT) { if ($entityType != ENTITY_PAYMENT) {
$template .= "<p><a href=\"\$link\">\$link</a></p>\r\n"; $template .= "<a href=\"\$link\">\$link</a><p/>\r\n\r\n";
} }
if ($message) { if ($message) {
$template .= "<p>$message</p>\r\n"; $template .= "$message<p/>\r\n\r\n";
} }
return $template . "<p>\$footer</p>"; return $template . "\$footer";
} }
public function getEmailFooter() public function getEmailFooter()

View File

@ -202,6 +202,11 @@ class Activity extends Eloquent
$activity->adjustment = $invoice->is_quote || $invoice->is_recurring ? 0 : $diff; $activity->adjustment = $invoice->is_quote || $invoice->is_recurring ? 0 : $diff;
$activity->json_backup = $backupInvoice->hidePrivateFields()->toJSON(); $activity->json_backup = $backupInvoice->hidePrivateFields()->toJSON();
$activity->save(); $activity->save();
if ($invoice->isPaid() && $invoice->balance > 0) {
$invoice->invoice_status_id = INVOICE_STATUS_PARTIAL;
$invoice->save();
}
} }
} }
} }

View File

@ -5,7 +5,7 @@
<style type="text/css"> <style type="text/css">
textarea { textarea {
min-height: 100px !important; min-height: 150px !important;
} }
</style> </style>

View File

@ -83,7 +83,7 @@
</div> </div>
@else @else
<div data-bind="visible: invoice_status_id() === 0"> <div data-bind="visible: invoice_status_id() === 0">
{{ Former::checkbox('recurring')->text(trans('texts.enable').' &nbsp;&nbsp; <a href="#" onclick="showLearnMore()"><i class="glyphicon glyphicon-question-sign"></i> '.trans('texts.learn_more').'</a>')->data_bind("checked: is_recurring") {{ Former::checkbox('recurring')->onclick('setEmailEnabled()')->text(trans('texts.enable').' &nbsp;&nbsp; <a href="#" onclick="showLearnMore()"><i class="glyphicon glyphicon-question-sign"></i> '.trans('texts.learn_more').'</a>')->data_bind("checked: is_recurring")
->inlineHelp($invoice && $invoice->last_sent_date ? 'Last invoice sent ' . Utils::dateToString($invoice->last_sent_date) : '') }} ->inlineHelp($invoice && $invoice->last_sent_date ? 'Last invoice sent ' . Utils::dateToString($invoice->last_sent_date) : '') }}
</div> </div>
@endif @endif
@ -1052,10 +1052,10 @@
self.frequency_id = ko.observable(''); self.frequency_id = ko.observable('');
//self.currency_id = ko.observable({{ $client && $client->currency_id ? $client->currency_id : Session::get(SESSION_CURRENCY) }}); //self.currency_id = ko.observable({{ $client && $client->currency_id ? $client->currency_id : Session::get(SESSION_CURRENCY) }});
self.terms = ko.observable(''); 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.set_default_terms = ko.observable(false);
self.invoice_footer = ko.observable(''); 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.set_default_footer = ko.observable(false);
self.public_notes = ko.observable(''); self.public_notes = ko.observable('');
self.po_number = ko.observable(''); self.po_number = ko.observable('');
@ -1413,7 +1413,7 @@
this.prettyRate = ko.computed({ this.prettyRate = ko.computed({
read: function () { read: function () {
return this.rate() ? parseFloat(this.rate()) : ''; return this.rate() ? this.rate() : '';
}, },
write: function (value) { write: function (value) {
this.rate(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 products = {{ $products }};
var clients = {{ $clients }}; var clients = {{ $clients }};

View File

@ -149,8 +149,8 @@ header h3 em {
<div class="col-md-7"> <div class="col-md-7">
<header> <header>
@if ($client) @if ($client)
<h2>{{ $client->getDisplayName() }}</h2> <h2>{{{ $client->getDisplayName() }}}</h2>
<h3>{{ trans('texts.invoice') . ' ' . $invoiceNumber }}<span>|&nbsp; {{ trans('texts.amount_due') }}: <em>{{ Utils::formatMoney($amount, $currencyId) }}</em></span></h3> <h3>{{{ trans('texts.invoice') . ' ' . $invoiceNumber }}}<span>|&nbsp; {{ trans('texts.amount_due') }}: <em>{{ Utils::formatMoney($amount, $currencyId) }}</em></span></h3>
@elseif ($paymentTitle) @elseif ($paymentTitle)
<h2>{{ $paymentTitle }}<br/><small>{{ $paymentSubtitle }}</small></h2> <h2>{{ $paymentTitle }}<br/><small>{{ $paymentSubtitle }}</small></h2>
@endif @endif