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

Working on product fields

This commit is contained in:
Hillel Coren 2017-10-29 16:09:42 +02:00
parent 7ecd06921f
commit 044aa6ccaa
3 changed files with 18 additions and 21 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

@ -485,28 +485,26 @@ NINJA.taxWidth = function(invoice)
NINJA.productFields = function(invoice, isTasks) {
var account = invoice.account;
var fields = JSON.parse(account.invoice_fields);
var allFields = JSON.parse(account.invoice_fields);
if (fields) {
if (isTasks && fields.task_fields) {
fields = fields.task_fields;
} else if (! isTasks && fields.product_fields) {
fields = fields.product_fields;
if (allFields) {
if (isTasks && allFields.task_fields) {
return allFields.task_fields;
} else if (! isTasks && allFields.product_fields) {
return allFields.product_fields;
}
}
if (! fields) {
fields = [
isTasks ? 'product.service' : 'product.item',
'product.description',
'product.custom_value1',
'product.custom_value2',
isTasks ? 'product.rate' : 'product.unit_cost',
isTasks ? 'product.hours' : 'product.quantity',
'product.tax',
'product.line_total',
];
}
var fields = [
isTasks ? 'product.service' : 'product.item',
'product.description',
'product.custom_value1',
'product.custom_value2',
isTasks ? 'product.rate' : 'product.unit_cost',
isTasks ? 'product.hours' : 'product.quantity',
'product.tax',
'product.line_total',
];
return fields;
}
@ -524,7 +522,6 @@ NINJA.invoiceLines = function(invoice, isSecondTable) {
}
var fields = NINJA.productFields(invoice, isTasks);
consle.log(fields);
var hasDescription = fields.indexOf('product.description') >= 0;
for (var i=0; i<fields.length; i++) {