Refactor Slack notification logic in departments_o.php and exampleRoute.php

- Update `send_webhook_message` to include custom department webhook.
- Add `sendSlackInternalStatisticNotification` to handle additional statistics notifications.
This commit is contained in:
Jeppe Bundgaard
2026-01-26 13:15:38 +01:00
parent 88d3e20de6
commit 16f041600c
2 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -786,6 +786,6 @@ class departments_o extends db
}
// Send the message to the internal Slack webhook
$slack = new slack();
$slack->send_message($tmp);
$slack->send_webhook_message($tmp, (new departments_o())->select(10)->slack_webhook->value());
}
}
+2 -1
View File
@@ -39,8 +39,9 @@ class exampleRoute
// The time should be from 00:00:00 of the start date to 23:59:59 of the end date
$date_end = date('Y-m-d 23:59:59', strtotime("-1 days")); // Yesterday (Sunday) at 23:59:59
$date_start = date('Y-m-d 00:00:00', strtotime("-$days days")); // $days ago at 00:00:00
$department->sendPeriodStatisticsToSlack($date_start, $date_end);
$department->sendPeriodStatisticsToSlack($date_start, $date_end); // Sends message to "daglig-ledelse".
}
$department->sendSlackInternalStatisticNotification($date_start, $date_end, $departments);
}
}
$response->success(['message' => 'Hello World!']);