mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-13 22:54:25 +01:00
Merge pull request #1665 from hagendornIT/#1664-Hide-custom-invoice-item-title
Hide custom invoice items if no value was specified
This commit is contained in:
commit
badd6fb7e7
@ -410,10 +410,10 @@ NINJA.invoiceColumns = function(invoice)
|
||||
|
||||
columns.push("*")
|
||||
|
||||
if (invoice.features.invoice_settings && account.custom_invoice_item_label1) {
|
||||
if (invoice.has_custom_item_value1) {
|
||||
columns.push("10%");
|
||||
}
|
||||
if (invoice.features.invoice_settings && account.custom_invoice_item_label2) {
|
||||
if (invoice.has_custom_item_value2) {
|
||||
columns.push("10%");
|
||||
}
|
||||
|
||||
@ -476,10 +476,10 @@ NINJA.invoiceLines = function(invoice, isSecondTable) {
|
||||
|
||||
grid[0].push({text: invoiceLabels.description, style: styles.concat('descriptionTableHeader')});
|
||||
|
||||
if (invoice.features.invoice_settings && account.custom_invoice_item_label1) {
|
||||
if (invoice.has_custom_item_value1) {
|
||||
grid[0].push({text: account.custom_invoice_item_label1, style: styles.concat('custom1TableHeader')});
|
||||
}
|
||||
if (invoice.features.invoice_settings && account.custom_invoice_item_label2) {
|
||||
if (invoice.has_custom_item_value2) {
|
||||
grid[0].push({text: account.custom_invoice_item_label2, style: styles.concat('custom2TableHeader')});
|
||||
}
|
||||
|
||||
@ -560,10 +560,10 @@ NINJA.invoiceLines = function(invoice, isSecondTable) {
|
||||
row.push({style:["productKey", rowStyle], text:productKey || ' '}); // product key can be blank when selecting from a datalist
|
||||
}
|
||||
row.push({style:["notes", rowStyle], stack:[{text:notes || ' '}]});
|
||||
if (invoice.features.invoice_settings && account.custom_invoice_item_label1) {
|
||||
if (invoice.has_custom_item_value1) {
|
||||
row.push({style:["customValue1", rowStyle], text:custom_value1 || ' '});
|
||||
}
|
||||
if (invoice.features.invoice_settings && account.custom_invoice_item_label2) {
|
||||
if (invoice.has_custom_item_value2) {
|
||||
row.push({style:["customValue2", rowStyle], text:custom_value2 || ' '});
|
||||
}
|
||||
if (!hideQuantity) {
|
||||
|
@ -671,6 +671,8 @@ function calculateAmounts(invoice) {
|
||||
var hasTaxes = false;
|
||||
var taxes = {};
|
||||
invoice.has_product_key = false;
|
||||
invoice.has_custom_item_value1 = false;
|
||||
invoice.has_custom_item_value2 = false;
|
||||
|
||||
// Bold designs currently breaks w/o the product column
|
||||
if (invoice.invoice_design_id == 2) {
|
||||
@ -715,6 +717,16 @@ function calculateAmounts(invoice) {
|
||||
invoice.has_product_key = true;
|
||||
}
|
||||
|
||||
if (invoice.features.invoice_settings) {
|
||||
if (item.custom_value1) {
|
||||
invoice.has_custom_item_value1 = true;
|
||||
}
|
||||
|
||||
if (item.custom_value2) {
|
||||
invoice.has_custom_item_value2 = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (parseFloat(item.tax_rate1) != 0) {
|
||||
taxRate1 = parseFloat(item.tax_rate1);
|
||||
taxName1 = item.tax_name1;
|
||||
|
Loading…
Reference in New Issue
Block a user