1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Support multiple products with API/Zapier

This commit is contained in:
Hillel Coren 2018-01-04 18:22:09 +02:00
parent 8ea29ea0ad
commit 7058cd77e2

View File

@ -278,6 +278,16 @@ class InvoiceApiController extends BaseAPIController
unset($data['invoice_items'][0]['tax_rate2']);
} else {
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);
}
}