mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Allow zero-costs
Currently, the `parepareItem` method checks to see if the cost and notes evaluate to false. If so, it checks from the product list. However, we need the ability to set cost to zero explicitly through the API. This allows a user to pass null, which will use the default. Otherwise, passing 0 will persist.
This commit is contained in:
parent
0953fbe7cd
commit
303de7a0b6
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user