Related to issue 17880. Related to issue 17819. Added recordTime property. Also, added getTimePassedInterval() method to support it.
authorAntonio Moreno <antonio.moreno@openbravo.com>
Fri, 29 Jul 2011 11:26:09 +0200
changeset 13345 c4af7f9e6aaa
parent 13344 c77612cebdbe
child 13346 11de85d32280
Related to issue 17880. Related to issue 17819. Added recordTime property. Also, added getTimePassedInterval() method to support it.
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js
modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js	Fri Jul 29 10:56:10 2011 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js	Fri Jul 29 11:26:09 2011 +0200
@@ -830,7 +830,12 @@
       n;
   
   // time difference in days
-  var diffDays = Math.floor((msNow - msCreated) / (1000 * 60 * 60 * 24));
+  return OB.Utilities.getTimePassedInterval(msNow - msCreated);
+};
+
+OB.Utilities.getTimePassedInterval = function(
+  /* amount of time in miliseconds */ timeInMiliseconds) {
+  var diffDays = Math.floor((timeInMiliseconds) / (1000 * 60 * 60 * 24));
   if (diffDays >= 30) {
     n = Math.floor(diffDays / 30);
     return OB.Utilities.formatTimePassedMessage(n,
@@ -846,7 +851,7 @@
   }
 
   // time difference in hours
-  var diffHours = Math.floor((msNow - msCreated) / (1000 * 60 * 60));
+  var diffHours = Math.floor((timeInMiliseconds) / (1000 * 60 * 60));
   if (diffHours >= 1) {
     n = diffHours;
     return OB.Utilities.formatTimePassedMessage(n,
@@ -854,7 +859,7 @@
   }
 
   // time difference in minutes
-  n = Math.floor((msNow - msCreated) / (1000 * 60));
+  n = Math.floor((timeInMiliseconds) / (1000 * 60));
   return OB.Utilities.formatTimePassedMessage(n,
       'OBUIAPP_minutes_ago');
   };
--- a/modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java	Fri Jul 29 10:56:10 2011 +0200
+++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java	Fri Jul 29 11:26:09 2011 +0200
@@ -179,6 +179,7 @@
         }
       }
 
+      jsonObject.put("recordTime", new Date().getTime());
       return jsonObject;
     } catch (JSONException e) {
       throw new IllegalStateException(e);