This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch release18.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit ea54ceba47cceaec95b720995c269f2d5827125c
Author: Jacques Le Roux <jacques.le.r...@les7arts.com>
AuthorDate: Thu May 2 09:55:52 2024 +0200

    Fixed: Prevents to uselessly clutter the logs up with 
SetTimeZoneFromBrowser errors (OFBIZ-13061)
    
    Fixes this error found in trunk demo log.
    SetTimeZoneFromBrowser.groovy]: (Cannot get property 'userLoginId' on null 
object)
    It happens, at least with webpos/control/SetTimeZoneFromBrowser
    It's just to prevents cluttering the logs.
    
    Conflicts handled by hand
---
 framework/common/groovyScripts/SetTimeZoneFromBrowser.groovy | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/framework/common/groovyScripts/SetTimeZoneFromBrowser.groovy 
b/framework/common/groovyScripts/SetTimeZoneFromBrowser.groovy
index 00296dd56a..43cb7c7868 100644
--- a/framework/common/groovyScripts/SetTimeZoneFromBrowser.groovy
+++ b/framework/common/groovyScripts/SetTimeZoneFromBrowser.groovy
@@ -19,13 +19,15 @@
 
 import org.apache.ofbiz.service.ServiceUtil
 
-public Map SetTimeZoneFromBrowser() {
-    userLogin = from("UserLogin").where("userLoginId", 
parameters.userLogin.userLoginId).queryFirst();
+Map setTimeZoneFromBrowser() {
+    if (parameters?.userLogin?.userLoginId) {
+        userLogin = from('UserLogin').where('userLoginId', 
parameters.userLogin.userLoginId).queryFirst()
     if (userLogin) {
         if (!userLogin.lastTimeZone || "null".equals(userLogin.lastTimeZone)) {
             userLogin.lastTimeZone = parameters.localeName
             userLogin.store()
             return ServiceUtil.returnSuccess()
+            }
         }
     }
     // Do nothing if no userLogin to prevents to uselessly clutter the logs up 
with very common SetTimeZoneFromBrowser errors

Reply via email to