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:
parent
8ea29ea0ad
commit
7058cd77e2
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user