diff --git a/cronjobs/notifications.php b/cronjobs/notifications.php index cd8c020a..a6b8b101 100755 --- a/cronjobs/notifications.php +++ b/cronjobs/notifications.php @@ -38,7 +38,7 @@ if (empty($aWorkers)) { } // We notified, lets check which recovered -$aNotifications = $notification->getAllActive(); +$aNotifications = $notification->getAllActive('idle_worker'); if (!empty($aNotifications)) { foreach ($aNotifications as $aNotification) { $aData = json_decode($aNotification['data'], true); diff --git a/public/include/classes/notification.class.php b/public/include/classes/notification.class.php index d324d4a7..b38bac2e 100644 --- a/public/include/classes/notification.class.php +++ b/public/include/classes/notification.class.php @@ -50,10 +50,10 @@ class Notification extends Mail { /** * Get all active notifications **/ - public function getAllActive() { + public function getAllActive($strType) { $this->debug->append("STA " . __METHOD__, 4); - $stmt =$this->mysqli->prepare("SELECT id, data FROM $this->table WHERE active = 1 LIMIT 1"); - if ($stmt && $stmt->execute() && $result = $stmt->get_result()) + $stmt =$this->mysqli->prepare("SELECT id, data FROM $this->table WHERE active = 1 AND type = ?"); + if ($stmt && $stmt->bind_param('s', $strType) && $stmt->execute() && $result = $stmt->get_result()) return $result->fetch_all(MYSQLI_ASSOC); // Catchall return false;