# HG changeset patch
# User Rafa Alonso <rafael.alonso@openbravo.com>
# Date 1431606371 -7200
#      Thu May 14 14:26:11 2015 +0200
# Node ID 3ff0757dfa3e86bde2628953b1842ccd903b9587
# Parent  d511af7f1b75ceec14ddbc47dd92bd6f1b5a6731
Fixes issue 29831: Log important log messages even if the preferences are still unknown

if the preferences' information is not available, all the log levels were being sent to the server. As more log is added, we want to prevent irrelevant messages to reach the log client when there is no information about what was set up in the backend

diff -r d511af7f1b75 -r 3ff0757dfa3e web/org.openbravo.mobile.core/source/utils/ob-utilities.js
--- a/web/org.openbravo.mobile.core/source/utils/ob-utilities.js	Wed May 13 13:13:39 2015 +0200
+++ b/web/org.openbravo.mobile.core/source/utils/ob-utilities.js	Thu May 14 14:26:11 2015 +0200
@@ -432,7 +432,11 @@
   OB.UTIL.checkPermissionLog = function (level, type) {
     try {
       if ((OB.MobileApp && OB.MobileApp.model && OB.MobileApp.model.get('permissions') !== null) === false) {
-        return true;
+        // save important log messages even if the preference is unknown
+        if (level === 'Warn' || level === 'Error' || level === 'Critical') {
+          return true;
+        }
+        return false;
       }
 
       if (type === "save") {
