fixed creating csv
This commit is contained in:
@@ -144,7 +144,21 @@ class WarehouseEShopOrderController extends TTCrud {
|
||||
$rows = [];
|
||||
|
||||
foreach ($orders as $order) {
|
||||
$orderItems = $ordersItems[$order['id']];
|
||||
$realOrderItems = null;
|
||||
foreach ($ordersItems as $orderId => $items) {
|
||||
if ($orderId == $order['id']) {
|
||||
$realOrderItems = $items;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// if it is still null, die with order id:
|
||||
if ($realOrderItems === null) {
|
||||
self::returnJson(['success' => false, 'message' => 'Bestellung mit ID ' . $order['id'] . ' hat keine Artikel. Bitte überprüfen.']);
|
||||
die();
|
||||
}
|
||||
|
||||
$orderItems = $realOrderItems;
|
||||
|
||||
$orderItemsStr = join('; ', array_map(function ($item) {
|
||||
$articleTitle = $item['articleTitle'] ?? $item['articlePacketTitle'];
|
||||
$quantity = $item['quantity'];
|
||||
@@ -177,7 +191,10 @@ class WarehouseEShopOrderController extends TTCrud {
|
||||
return Helper::arrayToCsv($rows);
|
||||
}
|
||||
|
||||
die(json_encode($rows));
|
||||
|
||||
self::returnJson($rows);
|
||||
return;
|
||||
}
|
||||
|
||||
protected function getAllOrderItemsPerOrder(): array {
|
||||
|
||||
@@ -98,7 +98,7 @@ Vue.component('warehouse-e-shop-order', {
|
||||
const response = await axios.post(`${window['TT_CONFIG']['BASE_PATH']}/WarehouseEShopOrder/CSVExportNewOrdersMarkAccepted`);
|
||||
|
||||
if (response.data.message) {
|
||||
window.notify('success', response.data.message);
|
||||
window.notify(response.data.success === true ? 'success' : 'error', response.data.message);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user