mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Support multiple products with API/Zapier
This commit is contained in:
parent
8ea29ea0ad
commit
7058cd77e2
@ -278,6 +278,16 @@ class InvoiceApiController extends BaseAPIController
|
|||||||
unset($data['invoice_items'][0]['tax_rate2']);
|
unset($data['invoice_items'][0]['tax_rate2']);
|
||||||
} else {
|
} else {
|
||||||
foreach ($data['invoice_items'] as $index => $item) {
|
foreach ($data['invoice_items'] as $index => $item) {
|
||||||
|
// check for multiple products
|
||||||
|
if ($productKey = array_get($item, 'product_key')) {
|
||||||
|
$parts = explode(',', $productKey);
|
||||||
|
if (count($parts) > 1 && Product::findProductByKey($parts[0])) {
|
||||||
|
foreach ($parts as $index => $productKey) {
|
||||||
|
$data['invoice_items'][$index] = self::prepareItem(['product_key' => $productKey]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
$data['invoice_items'][$index] = self::prepareItem($item);
|
$data['invoice_items'][$index] = self::prepareItem($item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user