Merge pull request #507 from adamgoose/patch-1

Allow zero-costs
This commit is contained in:
Hillel Coren 2015-11-06 08:52:07 +02:00
commit c79ee49c1d

View File

@ -214,13 +214,13 @@ class InvoiceApiController extends Controller
} }
// if only the product key is set we'll load the cost and notes // if only the product key is set we'll load the cost and notes
if ($item['product_key'] && (!$item['cost'] || !$item['notes'])) { if ($item['product_key'] && (is_null($item['cost']) || is_null($item['notes']))) {
$product = Product::findProductByKey($item['product_key']); $product = Product::findProductByKey($item['product_key']);
if ($product) { if ($product) {
if (!$item['cost']) { if (is_null($item['cost'])) {
$item['cost'] = $product->cost; $item['cost'] = $product->cost;
} }
if (!$item['notes']) { if (is_null($item['notes'])) {
$item['notes'] = $product->notes; $item['notes'] = $product->notes;
} }
} }