Upload via GUI (360 Dateien)
This commit is contained in:
@@ -119,13 +119,19 @@ function notify_team_assignment(PDO $pdo, array $ticket, int $teamId, ?int $acto
|
||||
$team = $stmt->fetch();
|
||||
if (!$team || !$team['is_active'] || $team['no_alerts']) return 0;
|
||||
|
||||
$members = $pdo->prepare('SELECT s.id, s.email FROM team_members tm JOIN staff s ON s.id = tm.staff_id WHERE tm.team_id = ? AND s.is_active = 1');
|
||||
$members = $pdo->prepare('SELECT s.id FROM team_members tm JOIN staff s ON s.id = tm.staff_id WHERE tm.team_id = ? AND s.is_active = 1');
|
||||
$members->execute([$teamId]);
|
||||
// Mitglieder im Urlaub: stattdessen ihre Vertretung
|
||||
$memberRows = [];
|
||||
foreach (vacation_expand_ids($pdo, $members->fetchAll(PDO::FETCH_COLUMN)) as $mid) {
|
||||
$em = staff_emails_by_ids($pdo, [$mid]);
|
||||
if ($em) $memberRows[] = ['id' => $mid, 'email' => $em[0]];
|
||||
}
|
||||
$sent = 0;
|
||||
$subject = 'Ticket #' . $ticket['ticket_number'] . ' wurde Team „' . $team['name'] . '“ zugewiesen';
|
||||
$body = '<p>Das Ticket <strong>#' . e($ticket['ticket_number']) . '</strong> („' . e($ticket['subject']) . '“) wurde dem Team <strong>'
|
||||
. e($team['name']) . '</strong> zugewiesen.</p>';
|
||||
foreach ($members->fetchAll() as $m) {
|
||||
foreach ($memberRows as $m) {
|
||||
if ($actorId !== null && (int) $m['id'] === $actorId) continue;
|
||||
if (send_mail($m['email'], $subject, $body)) $sent++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user