}
}
+ $replacementInvoiceTemp = $replacementInvoice;
+ foreach ($replacementInvoiceTemp as $key => $row) {
+ $replacementInvoiceProductsRow = [];
+ if (!isset($replacementInvoice[$key]['items'])) {
+ $replacementInvoice[$key]['items'] = [];
+ }
+ if (array_key_exists($row['id'], $replacementInvoiceProducts)) {
+ $replacementInvoiceProductsRow = $replacementInvoiceProducts[$row['id']];
+ }
+ if (!empty($replacementInvoiceProductsRow)) {
+ $replacementInvoice[$key]['items'] = $replacementInvoiceProductsRow;
+ }
+ }
+
foreach ($replacementInvoice as $row) {
$cause = 'Документ пересортица при передаче смены в ERP ' . $row['number'];
$replacementInvoiceResult[] = [
} catch (Exception $e3) {
file_put_contents(self::OUT_DIR . '/log_created_replacement_invoice_error.txt', PHP_EOL . date("d.m.Y H:i:s", time()) . $e3->getMessage() . ' file: ' . $e3->getFile() . ' line: ' . $e3->getLine(), FILE_APPEND);
}
- return compact('replacementInvoice', 'replacementInvoicesIds', 'replacementInvoiceResult');
+ return compact('replacementInvoice', 'replacementInvoiceIds', 'replacementInvoiceResult');
}