From c202441bc349e5cafabd91da082617b0ab191f77 Mon Sep 17 00:00:00 2001 From: Koen Reefman Date: Tue, 2 Dec 2025 16:09:39 +0000 Subject: [PATCH] FCLT#91497 Timezone-verschil automatisch aanpassen svn path=/Website/branches/v2025.4/; revision=71119 --- APPL/FAC/Facilitor.asp | 32 ++++++++++++++++++++++++++++++ APPL/FAC/fac_header.inc | 11 ---------- APPL/PRS/prs_edit_perslid_save.asp | 28 ++++++++++++++++++-------- APPL/Shared/timezoneselector.inc | 2 +- 4 files changed, 53 insertions(+), 20 deletions(-) diff --git a/APPL/FAC/Facilitor.asp b/APPL/FAC/Facilitor.asp index 6f533be051..0adc10197e 100644 --- a/APPL/FAC/Facilitor.asp +++ b/APPL/FAC/Facilitor.asp @@ -112,6 +112,38 @@ if (Session("interface") == "touch") { %> if (<%=(!device.test(device.isSupported) && S("checkBrowser") == 1 ? "true" : "false")%> || !(Modernizr.promises && Modernizr.strictmode && Modernizr.arrow)) { FcltMgr.alert(L("lcl_invalid_browser")); } + +<% var xfunc = user.func_enabled2("PRS", { prs_key: user_key, isOptional: true }); + var prsWriteAny = + xfunc.canWrite("WEB_PRSMAN") || + xfunc.canWrite("WEB_PRSUSE") || + xfunc.canWrite("WEB_PROFIL"); + if (prsWriteAny) { %> + var userTimezone = "<%=safe.jsstring(user.timezone())%>"; + var clientTimezone = Intl?.DateTimeFormat()?.resolvedOptions()?.timeZone; + if (userTimezone && clientTimezone && userTimezone != clientTimezone) { + $(function () { + FcltMgr.confirm(`Your system timezone is ${safe.html(clientTimezone)}, but your Facilitor profile is set to ${userTimezone}.\nDo you want me to update it and set your current timezone to ${safe.html(clientTimezone)}?`, function () { + var data = { + prs_tz: clientTimezone + }; + <% protectRequest.dataToken("data"); %> + $.post( + "<%=rooturl%>/APPL/PRS/prs_edit_perslid_save.asp?prs_key=<%=user_key%>", + data, + function (json) { + if (json.success) { + FcltMgr.reload(); + } else { + FcltToast(`Could not recognize timezone '${safe.html(clientTimezone)}'`, 1); + } + }, + "json" + ); + }); + }); + } +<% } %> }); <% diff --git a/APPL/FAC/fac_header.inc b/APPL/FAC/fac_header.inc index c043a84007..fccccbbf0c 100644 --- a/APPL/FAC/fac_header.inc +++ b/APPL/FAC/fac_header.inc @@ -325,17 +325,6 @@ function generateHeader() <% if (Application("otap_environment") == "O") { %> <% } %> -
- <% } diff --git a/APPL/PRS/prs_edit_perslid_save.asp b/APPL/PRS/prs_edit_perslid_save.asp index 05e62f0394..abb2c3dab3 100644 --- a/APPL/PRS/prs_edit_perslid_save.asp +++ b/APPL/PRS/prs_edit_perslid_save.asp @@ -25,16 +25,31 @@ user.auth_required_or_abort(prsauthparams.writeman || prsauthparams.writeuse || var prs_user = new Perslid(prs_key); user.auth_required_or_abort(!prs_user.has("WEB_FACFAC") || user.has("WEB_FACFAC")); // WEB_FACFAC alleen als je het zelf ook hebt +var result = {}; + var prs_tz = getFParam("prs_tz", ""); if (prs_tz != "") { var sql = "SELECT '' FROM V$TIMEZONE_NAMES" - + " WHERE tzname = " + safe.quoted_sql(prs_tz); // Case-sensitive + + " WHERE tzname = " + safe.quoted_sql(prs_tz) // Case-sensitive + + " AND tzname NOT LIKE '%GMT%'" // Conform timezoneselector.inc + + " AND (" + + " tzname LIKE 'Europe/%' OR" + + " tzname LIKE 'America/%' OR" + + " tzname LIKE 'Asia/%' OR" + + " tzname LIKE 'Australia/%' OR" + + " tzname LIKE 'Africa/%' OR" + + " tzname LIKE 'Pacific/%'" + + " )"; var oRs = Oracle.Execute(sql); - if (oRs.EoF) - shared.internal_error("timezone (" + safe.html(prs_tz) + ") not found."); + if (oRs.EoF) { + result.success = false; + Response.Write(JSON.stringify(result)); + ASPPAGE_END(); + Response.End; + } oRs.Close(); } @@ -251,10 +266,7 @@ if (!custfunc.prs_postsave(prs_key, pResult)) abort_with_warning(pResult.errmsg); } - -result = { success: true - , prs_key: prs_key - }; +result.success = true; Response.Write(JSON.stringify(result)); +ASPPAGE_END(); %> -<% ASPPAGE_END(); %> diff --git a/APPL/Shared/timezoneselector.inc b/APPL/Shared/timezoneselector.inc index 82aa45b38c..c205fbba18 100644 --- a/APPL/Shared/timezoneselector.inc +++ b/APPL/Shared/timezoneselector.inc @@ -31,7 +31,7 @@ function FCLTtimezoneselector(fieldName, params) + " tzname LIKE 'Asia/%' OR" + " tzname LIKE 'Australia/%' OR" + " tzname LIKE 'Africa/%' OR" - + " tzname LIKE 'Pacific/%'" + + " tzname LIKE 'Pacific/%'" // En deze dan; [Antarctica, Atlantic, Arctic, Brazil, Canada, Chile, Indian, Mexico, US] ? + " )" + " GROUP BY tzname, TZ_OFFSET(tzname)" + " ORDER BY TO_NUMBER(SUBSTR(TZ_OFFSET(tzname), 1, 3)"