mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 20:52:56 +01:00
Fixes for custom product fields
This commit is contained in:
parent
9e071f58d7
commit
682c12440d
@ -364,7 +364,9 @@ class Utils
|
|||||||
if ($field == 'checkbox') {
|
if ($field == 'checkbox') {
|
||||||
$data[] = $field;
|
$data[] = $field;
|
||||||
} elseif ($field) {
|
} elseif ($field) {
|
||||||
if ($module) {
|
if (substr($field, 0, 1) == '-') {
|
||||||
|
$data[] = substr($field, 1);
|
||||||
|
} elseif ($module) {
|
||||||
$data[] = mtrans($module, $field);
|
$data[] = mtrans($module, $field);
|
||||||
} else {
|
} else {
|
||||||
$data[] = trans("texts.$field");
|
$data[] = trans("texts.$field");
|
||||||
|
@ -14,6 +14,8 @@ class ProductDatatable extends EntityDatatable
|
|||||||
|
|
||||||
public function columns()
|
public function columns()
|
||||||
{
|
{
|
||||||
|
$account = Auth::user()->account;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
'product_key',
|
'product_key',
|
||||||
@ -38,8 +40,22 @@ class ProductDatatable extends EntityDatatable
|
|||||||
function ($model) {
|
function ($model) {
|
||||||
return $model->tax_rate ? ($model->tax_name . ' ' . $model->tax_rate . '%') : '';
|
return $model->tax_rate ? ($model->tax_name . ' ' . $model->tax_rate . '%') : '';
|
||||||
},
|
},
|
||||||
Auth::user()->account->invoice_item_taxes,
|
$account->invoice_item_taxes,
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'-' . Utils::getCustomLabel($account->custom_invoice_item_label1),
|
||||||
|
function ($model) {
|
||||||
|
return $model->custom_value1;
|
||||||
|
},
|
||||||
|
$account->custom_invoice_item_label1
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'-' . Utils::getCustomLabel($account->custom_invoice_item_label2),
|
||||||
|
function ($model) {
|
||||||
|
return $model->custom_value2;
|
||||||
|
},
|
||||||
|
$account->custom_invoice_item_label2
|
||||||
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,10 +32,11 @@ class ProductReport extends AbstractReport
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($account->custom_invoice_item_label1) {
|
if ($account->custom_invoice_item_label1) {
|
||||||
$columns[$account->custom_invoice_item_label1] = ['columnSelector-false', 'custom'];
|
$columns[Utils::getCustomLabel($account->custom_invoice_item_label1)] = ['columnSelector-false', 'custom'];
|
||||||
}
|
}
|
||||||
if ($account->custom_invoice_item_labe2) {
|
|
||||||
$columns[$account->custom_invoice_item_labe2] = ['columnSelector-false', 'custom'];
|
if ($account->custom_invoice_item_label2) {
|
||||||
|
$columns[Utils::getCustomLabel($account->custom_invoice_item_label2)] = ['columnSelector-false', 'custom'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $columns;
|
return $columns;
|
||||||
@ -82,7 +83,8 @@ class ProductReport extends AbstractReport
|
|||||||
if ($account->custom_invoice_item_label1) {
|
if ($account->custom_invoice_item_label1) {
|
||||||
$row[] = $item->custom_value1;
|
$row[] = $item->custom_value1;
|
||||||
}
|
}
|
||||||
if ($account->custom_invoice_item_labe2) {
|
|
||||||
|
if ($account->custom_invoice_item_label2) {
|
||||||
$row[] = $item->custom_value2;
|
$row[] = $item->custom_value2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,9 @@ class ProductRepository extends BaseRepository
|
|||||||
'products.tax_name1 as tax_name',
|
'products.tax_name1 as tax_name',
|
||||||
'products.tax_rate1 as tax_rate',
|
'products.tax_rate1 as tax_rate',
|
||||||
'products.deleted_at',
|
'products.deleted_at',
|
||||||
'products.is_deleted'
|
'products.is_deleted',
|
||||||
|
'products.custom_value1',
|
||||||
|
'products.custom_value2'
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($filter) {
|
if ($filter) {
|
||||||
|
Loading…
Reference in New Issue
Block a user