# HG changeset patch
# User Rafa Alonso <rafael.alonso@openbravo.com>
# Date 1426871054 -3600
#      Fri Mar 20 18:04:14 2015 +0100
# Node ID 659a181012e38226c00f71dcc87dd699bd2e7331
# Parent  0d46bce541e5b5ba98f7d45bf12a68779f91b8eb
Fixes issue 29364: LogClient will only flush to the server if the application is idle

diff -r 0d46bce541e5 -r 659a181012e3 web/org.openbravo.mobile.core/source/utils/logClientSyncUtils.js
--- a/web/org.openbravo.mobile.core/source/utils/logClientSyncUtils.js	Thu Mar 19 07:45:03 2015 +0100
+++ b/web/org.openbravo.mobile.core/source/utils/logClientSyncUtils.js	Fri Mar 20 18:04:14 2015 +0100
@@ -14,6 +14,12 @@
   OB.UTIL = window.OB.UTIL || {};
 
   OB.UTIL.processLogClientAll = function () {
+    // if the application is busy, delay flushing the log to the server
+    if (OB.MobileApp.model.get('isLoggingIn') || !OB.UTIL.SynchronizationHelper.isSynchronized()){
+      OB.debug("LogClient flushing delayed");
+      return;
+    }
+
     // Processes log client
     var me = this,
         criteria = {};
