Upload via GUI (360 Dateien)
This commit is contained in:
@@ -311,13 +311,16 @@ function fcm_notify_staff(array $staffIds, array $data, ?int $departmentId = nul
|
||||
if (!$staffIds || !fcm_configured()) return;
|
||||
fcm_after_response(function () use ($staffIds, $data, $departmentId, $extraFilter) {
|
||||
$pdo = get_db();
|
||||
// Mitarbeiter im Urlaub: stattdessen bekommt ihre Vertretung die Meldung
|
||||
$staffIds = vacation_expand_ids($pdo, $staffIds);
|
||||
if (!$staffIds) return;
|
||||
// Rechte: Nur wer Zugriff auf die Abteilung des Tickets hat (und für diese Art von Push berechtigt ist), bekommt etwas
|
||||
if ($departmentId !== null) {
|
||||
$staffIds = fcm_staff_allowed($pdo, $staffIds, $departmentId, fcm_event_permission((string) ($data['type'] ?? '')), $extraFilter);
|
||||
if (!$staffIds) return;
|
||||
}
|
||||
$in = implode(',', array_fill(0, count($staffIds), '?'));
|
||||
$stmt = $pdo->prepare("SELECT d.id, d.token, d.staff_id FROM push_devices d JOIN staff s ON s.id = d.staff_id WHERE s.is_active = 1 AND d.staff_id IN ($in)");
|
||||
$stmt = $pdo->prepare("SELECT d.id, d.token, d.staff_id FROM push_devices d JOIN staff s ON s.id = d.staff_id WHERE s.is_active = 1 AND s.is_on_vacation = 0 AND d.staff_id IN ($in)");
|
||||
$stmt->execute($staffIds);
|
||||
// Einstellungen je Mitarbeiter: abgewählte Ereignisse und stille Zeiten überspringen
|
||||
$devices = array_values(array_filter($stmt->fetchAll(), fn($d) => fcm_wants(fcm_prefs($pdo, (int) $d['staff_id']), (string) ($data['type'] ?? ''))));
|
||||
|
||||
Reference in New Issue
Block a user