From 7a20345701dff978ed972833609c8e4840a79221 Mon Sep 17 00:00:00 2001 From: Jukka Lampikoski Date: Fri, 13 Mar 2026 01:30:11 +0200 Subject: [PATCH] =?UTF-8?q?Lis=C3=A4=C3=A4=20puhelinnumero=20yrityksen=20a?= =?UTF-8?q?setuksiin=20ja=20allekirjoituksiin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Puhelinnumero-kenttä yrityksen asetuksissa tallennetaan tietokantaan ja näkyy automaattisesti kaikissa oletusallekirjoituksissa viimeisenä rivinä (sekä SMTP- että Zammad-postilaatikoille). Co-Authored-By: Claude Opus 4.6 --- api.php | 6 ++++-- db.php | 7 ++++--- index.html | 8 ++++++-- script.js | 19 ++++++++++++------- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/api.php b/api.php index 600e784..db1f04b 100644 --- a/api.php +++ b/api.php @@ -1499,7 +1499,7 @@ switch ($action) { foreach ($allCompanies as $comp) { // Superadmin näkee kaikki yritykset if ($u['role'] === 'superadmin' || in_array($comp['id'], $userCompanies)) { - $entry = ['id' => $comp['id'], 'nimi' => $comp['nimi']]; + $entry = ['id' => $comp['id'], 'nimi' => $comp['nimi'], 'phone' => $comp['phone'] ?? '']; // Merkitse IP-estetyt yritykset (superadmin ohittaa) if ($u['role'] !== 'superadmin' && !isIpAllowed($ip, $comp['allowed_ips'] ?? '')) { $entry['ip_blocked'] = true; @@ -1559,7 +1559,7 @@ switch ($action) { foreach ($allCompanies as $comp) { // Superadmin näkee kaikki yritykset if ($isSuperAdmin || in_array($comp['id'], $userCompanyIds)) { - $entry = ['id' => $comp['id'], 'nimi' => $comp['nimi']]; + $entry = ['id' => $comp['id'], 'nimi' => $comp['nimi'], 'phone' => $comp['phone'] ?? '']; if (!$isSuperAdmin && !isIpAllowed($ip, $comp['allowed_ips'] ?? '')) { $entry['ip_blocked'] = true; } else { @@ -3922,6 +3922,7 @@ switch ($action) { 'smtp_from_email' => $mb['smtp_from_email'] ?? $mb['imap_user'] ?? '', 'company_id' => $comp['id'], 'company_nimi' => $comp['nimi'], + 'company_phone' => $comp['phone'] ?? '', ]; } } @@ -4029,6 +4030,7 @@ switch ($action) { } if (isset($input['primary_color'])) $c['primary_color'] = trim($input['primary_color']); if (isset($input['subtitle'])) $c['subtitle'] = trim($input['subtitle']); + if (isset($input['phone'])) $c['phone'] = trim($input['phone']); if (isset($input['enabled_modules']) && is_array($input['enabled_modules'])) { $c['enabled_modules'] = array_values($input['enabled_modules']); } diff --git a/db.php b/db.php index 88300e7..cfeb4fb 100644 --- a/db.php +++ b/db.php @@ -768,11 +768,11 @@ function dbSaveCompany(array $company): void { $enabledModules = $company['enabled_modules'] ?? []; $enabledModulesJson = is_array($enabledModules) ? json_encode($enabledModules) : ($enabledModules ?: ''); _dbExecute(" - INSERT INTO companies (id, nimi, luotu, aktiivinen, primary_color, subtitle, logo_file, api_key, cors_origins, enabled_modules, allowed_ips) - VALUES (:id, :nimi, :luotu, :aktiivinen, :primary_color, :subtitle, :logo_file, :api_key, :cors_origins, :enabled_modules, :allowed_ips) + INSERT INTO companies (id, nimi, luotu, aktiivinen, primary_color, subtitle, phone, logo_file, api_key, cors_origins, enabled_modules, allowed_ips) + VALUES (:id, :nimi, :luotu, :aktiivinen, :primary_color, :subtitle, :phone, :logo_file, :api_key, :cors_origins, :enabled_modules, :allowed_ips) ON DUPLICATE KEY UPDATE nimi = VALUES(nimi), aktiivinen = VALUES(aktiivinen), - primary_color = VALUES(primary_color), subtitle = VALUES(subtitle), + primary_color = VALUES(primary_color), subtitle = VALUES(subtitle), phone = VALUES(phone), logo_file = VALUES(logo_file), api_key = VALUES(api_key), cors_origins = VALUES(cors_origins), enabled_modules = VALUES(enabled_modules), allowed_ips = VALUES(allowed_ips) ", [ @@ -782,6 +782,7 @@ function dbSaveCompany(array $company): void { 'aktiivinen' => $company['aktiivinen'] ?? true, 'primary_color' => $company['primary_color'] ?? '#0f3460', 'subtitle' => $company['subtitle'] ?? '', + 'phone' => $company['phone'] ?? '', 'logo_file' => $company['logo_file'] ?? '', 'api_key' => $company['api_key'] ?? '', 'cors_origins' => $company['cors_origins'] ?? '', diff --git a/index.html b/index.html index 65085db..305cff9 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ Noxus HUB - + @@ -1615,6 +1615,10 @@ +
+ + +
@@ -2229,6 +2233,6 @@
- + diff --git a/script.js b/script.js index 59c3ac0..a29a12b 100644 --- a/script.js +++ b/script.js @@ -2392,15 +2392,17 @@ async function initTicketSettings() { return; } - // Oletusallekirjoitus: Käyttäjänimi + Yritys + sähköposti + // Oletusallekirjoitus: Käyttäjänimi + Yritys + sähköposti + puhelin (jos asetettu) const userName = currentUser?.nimi || currentUser?.username || ''; - function defaultSig(companyName, email) { - return userName + '\n' + companyName + '\n' + email; + function defaultSig(companyName, email, phone) { + let sig = userName + '\n' + companyName + '\n' + email; + if (phone) sig += '\n' + phone; + return sig; } // Allekirjoitukset per postilaatikko let sigHtml = mailboxes.map(mb => { - const sig = currentUserSignatures[mb.id] || defaultSig(mb.company_nimi, mb.smtp_from_email); + const sig = currentUserSignatures[mb.id] || defaultSig(mb.company_nimi, mb.smtp_from_email, mb.company_phone); return `