diff --git a/app/Models/Account.php b/app/Models/Account.php index 368ecac825ab..b2d5a7d22dce 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -1023,7 +1023,7 @@ class Account extends Eloquent return true; } - public function showCustomField($field, $entity) + public function showCustomField($field, $entity = false) { if ($this->isPro()) { return $this->$field ? true : false; diff --git a/public/built.js b/public/built.js index 5e28b8fb3f18..9d1e0d3a3ee2 100644 --- a/public/built.js +++ b/public/built.js @@ -31259,10 +31259,10 @@ NINJA.invoiceColumns = function(invoice) columns.push("*") - if (account.custom_invoice_item_label1) { + if (invoice.is_pro && account.custom_invoice_item_label1) { columns.push("10%"); } - if (account.custom_invoice_item_label2) { + if (invoice.is_pro && account.custom_invoice_item_label2) { columns.push("10%"); } @@ -31314,10 +31314,10 @@ NINJA.invoiceLines = function(invoice) { grid[0].push({text: invoiceLabels.description, style: ['tableHeader', 'descriptionTableHeader']}); - if (account.custom_invoice_item_label1) { + if (invoice.is_pro && account.custom_invoice_item_label1) { grid[0].push({text: account.custom_invoice_item_label1, style: ['tableHeader', 'custom1TableHeader']}); } - if (account.custom_invoice_item_label2) { + if (invoice.is_pro && account.custom_invoice_item_label2) { grid[0].push({text: account.custom_invoice_item_label2, style: ['tableHeader', 'custom2TableHeader']}); } @@ -31372,10 +31372,10 @@ NINJA.invoiceLines = function(invoice) { 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 (account.custom_invoice_item_label1) { + if (invoice.is_pro && account.custom_invoice_item_label1) { row.push({style:["customValue1", rowStyle], text:item.custom_value1 || ' '}); } - if (account.custom_invoice_item_label2) { + if (invoice.is_pro && account.custom_invoice_item_label2) { row.push({style:["customValue2", rowStyle], text:item.custom_value2 || ' '}); } row.push({style:["cost", rowStyle], text:cost}); diff --git a/public/js/pdf.pdfmake.js b/public/js/pdf.pdfmake.js index 3a9f40280c74..d6e7906ca6d6 100644 --- a/public/js/pdf.pdfmake.js +++ b/public/js/pdf.pdfmake.js @@ -267,10 +267,10 @@ NINJA.invoiceColumns = function(invoice) columns.push("*") - if (account.custom_invoice_item_label1) { + if (invoice.is_pro && account.custom_invoice_item_label1) { columns.push("10%"); } - if (account.custom_invoice_item_label2) { + if (invoice.is_pro && account.custom_invoice_item_label2) { columns.push("10%"); } @@ -322,10 +322,10 @@ NINJA.invoiceLines = function(invoice) { grid[0].push({text: invoiceLabels.description, style: ['tableHeader', 'descriptionTableHeader']}); - if (account.custom_invoice_item_label1) { + if (invoice.is_pro && account.custom_invoice_item_label1) { grid[0].push({text: account.custom_invoice_item_label1, style: ['tableHeader', 'custom1TableHeader']}); } - if (account.custom_invoice_item_label2) { + if (invoice.is_pro && account.custom_invoice_item_label2) { grid[0].push({text: account.custom_invoice_item_label2, style: ['tableHeader', 'custom2TableHeader']}); } @@ -380,10 +380,10 @@ NINJA.invoiceLines = function(invoice) { 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 (account.custom_invoice_item_label1) { + if (invoice.is_pro && account.custom_invoice_item_label1) { row.push({style:["customValue1", rowStyle], text:item.custom_value1 || ' '}); } - if (account.custom_invoice_item_label2) { + if (invoice.is_pro && account.custom_invoice_item_label2) { row.push({style:["customValue2", rowStyle], text:item.custom_value2 || ' '}); } row.push({style:["cost", rowStyle], text:cost}); diff --git a/resources/views/invoices/edit.blade.php b/resources/views/invoices/edit.blade.php index ded91d7e0c90..5fa93dd3c8e3 100644 --- a/resources/views/invoices/edit.blade.php +++ b/resources/views/invoices/edit.blade.php @@ -191,10 +191,10 @@ {{ $invoiceLabels['item'] }} {{ $invoiceLabels['description'] }} - @if ($account->custom_invoice_item_label1) + @if ($account->showCustomField('custom_invoice_item_label1')) {{ $account->custom_invoice_item_label1 }} @endif - @if ($account->custom_invoice_item_label2) + @if ($account->showCustomField('custom_invoice_item_label2')) {{ $account->custom_invoice_item_label2 }} @endif {{ $invoiceLabels['unit_cost'] }} @@ -219,12 +219,12 @@ - @if ($account->custom_invoice_item_label1) + @if ($account->showCustomField('custom_invoice_item_label1')) @endif - @if ($account->custom_invoice_item_label2) + @if ($account->showCustomField('custom_invoice_item_label2')) @@ -257,7 +257,7 @@ - +