Browse code

Fix error if there are no news to send

Benjamin Roth authored on11/12/2023 12:25:11
Showing1 changed files
... ...
@@ -64,11 +64,10 @@ class SendNewsNotificationJob
64 64
                 // Do we have new news items
65 65
                 $News = $this->db->executeQuery("SELECT id, alias, headline, `date`, teaser FROM tl_news WHERE pid = ? AND nc_sent != '1' AND date <='$time' AND (start='' OR start<='$time') AND (stop='' OR stop>'" . ($time + 60) . "') AND published='1' ORDER BY `date` DESC, `time` DESC",[$Archive->id]);
66 66
 
67
+                $arrNewsIds = array();
67 68
                 // Load groups and notification models if we have news to share
68 69
                 if ($News->rowCount() && ($Notification = Notification::findByPk($Archive->nc_notification)) !== null && ($Groups = MemberGroupModel::findMultipleByIds($arrGroupIds)) !== null)
69 70
                 {
70
-                    $arrNewsIds = array();
71
-
72 71
                     while ($Groups->next())
73 72
                     {
74 73
                         // Skip disabled groups