fix double slack notification
This commit is contained in:
@@ -63,14 +63,12 @@ class SlackNotifySubscriber implements EventSubscriberInterface
|
|||||||
foreach ($order->getData()[0]['positions'] as $item) {
|
foreach ($order->getData()[0]['positions'] as $item) {
|
||||||
if ($item['menge'] > 0) {
|
if ($item['menge'] > 0) {
|
||||||
|
|
||||||
$warehouses = $this->getWarehouseByGtin($item['gtin']);
|
$warehouse = $this->getWarehouseByGtin($item['gtin']);
|
||||||
|
|
||||||
if ($warehouses == false) {
|
if ($warehouse == false) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($warehouses as $warehouse) {
|
|
||||||
|
|
||||||
$slack = new Client($this->slackWebhookUrl, [
|
$slack = new Client($this->slackWebhookUrl, [
|
||||||
'username' => 'CDS-Notify',
|
'username' => 'CDS-Notify',
|
||||||
'channel' => '#online_verkäufe' . '_' . $warehouse,
|
'channel' => '#online_verkäufe' . '_' . $warehouse,
|
||||||
@@ -92,7 +90,6 @@ class SlackNotifySubscriber implements EventSubscriberInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $gtin
|
* @param string $gtin
|
||||||
@@ -103,7 +100,7 @@ class SlackNotifySubscriber implements EventSubscriberInterface
|
|||||||
if ($gtin == null) {
|
if ($gtin == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$warehouse = [];
|
$warehouse = "";
|
||||||
|
|
||||||
$product = $this->productRepository->findOneBy(['gtin' => $gtin]);
|
$product = $this->productRepository->findOneBy(['gtin' => $gtin]);
|
||||||
|
|
||||||
@@ -116,7 +113,7 @@ class SlackNotifySubscriber implements EventSubscriberInterface
|
|||||||
$w = $this->warehouseRepository->findOneBy(['id' => $item->getWarehouse()->getId()]);
|
$w = $this->warehouseRepository->findOneBy(['id' => $item->getWarehouse()->getId()]);
|
||||||
|
|
||||||
if ($w->getPrio() > $prio) {
|
if ($w->getPrio() > $prio) {
|
||||||
$warehouse[] = $w->getName();
|
$warehouse = $w->getName();
|
||||||
$prio = $w->getPrio();
|
$prio = $w->getPrio();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user