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

Fix to save invoice_item_type_id value

This commit is contained in:
Hillel Coren 2017-03-26 10:54:04 +03:00
parent 0d80ebdbbf
commit 5f9ffee8ea
4 changed files with 8 additions and 0 deletions

View File

@ -670,6 +670,11 @@ class InvoiceRepository extends BaseRepository
$item['tax_rate1'] = $item['tax_rate'];
}
// provide backwards compatability
if (! isset($item['invoice_item_type_id']) && in_array($invoiceItem->notes, [trans('texts.online_payment_surcharge'), trans('texts.online_payment_discount')])) {
$invoiceItem->invoice_item_type_id = $invoice->balance > 0 ? INVOICE_ITEM_TYPE_PENDING_GATEWAY_FEE : INVOICE_ITEM_TYPE_PAID_GATEWAY_FEE;
}
$invoiceItem->fill($item);
$invoice->invoice_items()->save($invoiceItem);

View File

@ -20,6 +20,7 @@ class InvoiceItemTransformer extends EntityTransformer
'tax_rate1' => (float) $item->tax_rate1,
'tax_name2' => $item->tax_name2 ? $item->tax_name2 : '',
'tax_rate2' => (float) $item->tax_rate2,
'invoice_item_type_id' => (int) $this->invoice_item_type_id,
]);
}
}

View File

@ -281,6 +281,7 @@
rows="1" cols="60" style="resize: vertical;height:42px" class="form-control word-wrap"></textarea>
<input type="text" data-bind="value: task_public_id, attr: {name: 'invoice_items[' + $index() + '][task_public_id]'}" style="display: none"/>
<input type="text" data-bind="value: expense_public_id, attr: {name: 'invoice_items[' + $index() + '][expense_public_id]'}" style="display: none"/>
<input type="text" data-bind="value: invoice_item_type_id, attr: {name: 'invoice_items[' + $index() + '][invoice_item_type_id]'}" style="display: none"/>
</td>
@if ($account->showCustomField('custom_invoice_item_label1'))
<td>

View File

@ -718,6 +718,7 @@ function ItemModel(data) {
self.tax_rate2IsInclusive = ko.observable(0);
self.task_public_id = ko.observable('');
self.expense_public_id = ko.observable('');
self.invoice_item_type_id = ko.observable({{ INVOICE_ITEM_TYPE_STANDARD }});
self.actionsVisible = ko.observable(false);
this.tax1 = ko.computed({