fix double slack notification

This commit is contained in:
Marko 2024-03-22 14:21:13 +01:00
parent 0bc2024494
commit fb293a6b9a
No known key found for this signature in database

View File

@ -110,11 +110,14 @@ class SlackNotifySubscriber implements EventSubscriberInterface
if ($stock) {
$prio = 0;
foreach ($stock as $item) {
$w = $this->warehouseRepository->findOneBy(['id' => $item->getWarehouse()->getId()]);
//Nur wenn Bestand vorhanden
if ($item->getInstock() > 0) {
$w = $this->warehouseRepository->findOneBy(['id' => $item->getWarehouse()->getId()]);
if ($w->getPrio() > $prio) {
$warehouse = $w->getName();
$prio = $w->getPrio();
if ($w->getPrio() > $prio) {
$warehouse = $w->getName();
$prio = $w->getPrio();
}
}
}
}