diff --git a/api.php b/api.php index a087bdb..600e784 100644 --- a/api.php +++ b/api.php @@ -3942,6 +3942,20 @@ switch ($action) { echo json_encode($groups); break; + case 'ticket_zammad_emails': + requireAuth(); + $userCompanyIds = $_SESSION['companies'] ?? []; + $emails = []; + foreach ($userCompanyIds as $cid) { + $rows = _dbFetchAll("SELECT DISTINCT zammad_to_email FROM tickets WHERE company_id = ? AND source = 'zammad' AND zammad_to_email IS NOT NULL AND zammad_to_email != ''", [$cid]); + foreach ($rows as $r) { + if (!in_array($r['zammad_to_email'], $emails)) $emails[] = $r['zammad_to_email']; + } + } + sort($emails); + echo json_encode($emails); + break; + case 'company_create': requireSuperAdmin(); if ($method !== 'POST') break; diff --git a/index.html b/index.html index 24eeebd..1c57c76 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@