1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 12:12:48 +01:00

Fix for 'null' in client name

This commit is contained in:
Hillel Coren 2017-12-31 17:01:16 +02:00
parent b40deb13bb
commit 937e438591
9 changed files with 11 additions and 11 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1051,7 +1051,7 @@ NINJA.renderField = function(invoice, field, twoColumn) {
}
var account = invoice.account;
var contact = client.contacts[0];
var clientName = client.name || (contact.first_name || contact.last_name ? (contact.first_name + ' ' + contact.last_name) : contact.email);
var clientName = client.name || (contact.first_name || contact.last_name ? ((contact.first_name || '') + ' ' + (contact.last_name || '')) : contact.email);
var label = false;
var value = false;
@ -1059,7 +1059,7 @@ NINJA.renderField = function(invoice, field, twoColumn) {
if (field == 'client.client_name') {
value = clientName || ' ';
} else if (field == 'client.contact_name') {
value = (contact.first_name || contact.last_name) ? contact.first_name + ' ' + contact.last_name : false;
value = (contact.first_name || contact.last_name) ? (contact.first_name || '') + ' ' + (contact.last_name || '') : false;
} else if (field == 'client.id_number') {
value = client.id_number;
if (invoiceLabels.id_number_orig) {

View File

@ -413,7 +413,7 @@
if (self.contacts().length == 0) return '';
var contact = self.contacts()[0];
if (contact.first_name() || contact.last_name()) {
return contact.first_name() + ' ' + contact.last_name();
return (contact.first_name() || '') + ' ' + (contact.last_name() || '');
} else {
return contact.email();
}

View File

@ -156,7 +156,7 @@
<input type="hidden" value="0" data-bind="attr: {name: 'client[contacts][' + $index() + '][send_invoice]'}">
<input type="checkbox" value="1" data-bind="visible: email() || first_name() || last_name(), checked: send_invoice, attr: {id: $index() + '_check', name: 'client[contacts][' + $index() + '][send_invoice]'}">
<span data-bind="visible: first_name || last_name">
<span data-bind="text: first_name() + ' ' + last_name()"></span>
<span data-bind="text: (first_name() || '') + ' ' + (last_name() || '')"></span>
<br/>
</span>
<span data-bind="visible: email">

View File

@ -702,7 +702,7 @@ function ClientModel(data) {
if (self.contacts().length == 0) return;
var contact = self.contacts()[0];
if (contact.first_name() || contact.last_name()) {
return contact.first_name() + ' ' + contact.last_name();
return (contact.first_name() || '') + ' ' + (contact.last_name() || '');
} else {
return contact.email();
}
@ -712,7 +712,7 @@ function ClientModel(data) {
if (self.contacts().length == 0) return '';
var contact = self.contacts()[0];
if (contact.first_name() || contact.last_name()) {
return contact.first_name() + ' ' + contact.last_name();
return (contact.first_name() || '') + ' ' + (contact.last_name() || '');
} else {
return contact.email();
}

View File

@ -613,7 +613,7 @@
self.displayName = ko.computed(function() {
if (self.first_name() || self.last_name()) {
return self.first_name() + ' ' + self.last_name();
return (self.first_name() || '') + ' ' + (self.last_name() || '');
} else {
return self.email();
}

View File

@ -1168,7 +1168,7 @@
if (self.contacts().length == 0) return;
var contact = self.contacts()[0];
if (contact.first_name() || contact.last_name()) {
return contact.first_name() + ' ' + contact.last_name();
return (contact.first_name() || '') + ' ' + (contact.last_name() || '');
} else {
return contact.email();
}

View File

@ -164,7 +164,7 @@
if (self.vendor_contacts().length == 0) return '';
var contact = self.vendor_contacts()[0];
if (contact.first_name() || contact.last_name()) {
return contact.first_name() + ' ' + contact.last_name();
return (contact.first_name() || '') + ' ' + (contact.last_name() || '');
} else {
return contact.email();
}