Fix parsing product cost

This commit is contained in:
Hillel Coren 2018-02-14 19:58:48 +02:00
parent 060d0cab8d
commit 116bc07e9a
2 changed files with 5 additions and 9 deletions

View File

@ -372,14 +372,10 @@ class InvoiceController extends BaseController
$action = Input::get('action');
$entityType = Input::get('entityType');
if (config('ninja.lock_sent_invoices')) {
$invoice = $request->entity();
} else {
$invoice = $this->invoiceService->save($data, $request->entity());
$entityType = $invoice->getEntityType();
$message = trans("texts.updated_{$entityType}");
Session::flash('message', $message);
}
if ($action == 'clone_invoice') {
return url(sprintf('invoices/%s/clone', $invoice->public_id));

View File

@ -742,7 +742,7 @@ class InvoiceRepository extends BaseRepository
if ($product && (Auth::user()->can('edit', $product))) {
$product->notes = ($task || $expense) ? '' : $item['notes'];
if (! $account->convert_products) {
$product->cost = $expense ? 0 : $item['cost'];
$product->cost = $expense ? 0 : Utils::parseFloat($item['cost']);
}
$product->tax_name1 = isset($item['tax_name1']) ? $item['tax_name1'] : null;
$product->tax_rate1 = isset($item['tax_rate1']) ? $item['tax_rate1'] : 0;