details:   https://code.openbravo.com/erp/devel/pi/rev/f6e2f6a4c29b
changeset: 26899:f6e2f6a4c29b
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Thu Jun 11 12:37:01 2015 +0200
summary:   Related to issue Related to issue 29766: Retail Operations Buffer: 
store all transactions in operations table before processing
Added comments, removed not needed flush, apparently there is a case that the 
executorservice queue is null, handle this

details:   https://code.openbravo.com/erp/devel/pi/rev/aba1a9d25e4d
changeset: 26900:aba1a9d25e4d
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Thu Jun 11 17:13:36 2015 +0200
summary:   Merged heads

diffstat:

 
modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-addPayment.js
 |   2 +-
 src/org/openbravo/service/importprocess/ImportEntryManager.java                
                |  12 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)

diffs (55 lines):

diff -r aab70f0c1a50 -r aba1a9d25e4d 
modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-addPayment.js
--- 
a/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-addPayment.js
    Wed Jun 10 22:46:44 2015 +0000
+++ 
b/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-addPayment.js
    Thu Jun 11 17:13:36 2015 +0200
@@ -1137,7 +1137,7 @@
     return clientSideValidationFail();
   }
 
-  if ((total.compareTo(creditTotalItem) < 0) && (overpaymentField.isVisible() 
&& overpaymentAction === 'CR')) {
+  if (creditTotalItem.compareTo(BigDecimal.prototype.ZERO) !== 0 && 
(total.compareTo(creditTotalItem) < 0) && (overpaymentField.isVisible() && 
overpaymentAction === 'CR')) {
     view.messageBar.setMessage(isc.OBMessageBar.TYPE_ERROR, null, 
OB.I18N.getLabel('APRM_MORECREDITAMOUNT'));
     return clientSideValidationFail();
   }
diff -r aab70f0c1a50 -r aba1a9d25e4d 
src/org/openbravo/service/importprocess/ImportEntryManager.java
--- a/src/org/openbravo/service/importprocess/ImportEntryManager.java   Wed Jun 
10 22:46:44 2015 +0000
+++ b/src/org/openbravo/service/importprocess/ImportEntryManager.java   Thu Jun 
11 17:13:36 2015 +0200
@@ -188,7 +188,7 @@
   }
 
   public long getNumberOfQueuedTasks() {
-    return executorService.getQueue().size();
+    return executorService.getQueue() == null ? 0 : 
executorService.getQueue().size();
   }
 
   public long getNumberOfActiveTasks() {
@@ -238,9 +238,6 @@
    * Note will commit the session/connection using {@link 
OBDal#commitAndClose()}
    */
   public void createImportEntry(String id, String typeOfData, String json) {
-    // make sure that everything is flushed to the db before checking import 
entry
-    // content
-    OBDal.getInstance().flush();
     OBContext.setAdminMode(true);
     try {
       // check if it is not there already or already archived
@@ -398,7 +395,9 @@
     final OBContext prevOBContext = OBContext.getOBContext();
     OBContext.setOBContext("0", "0", "0", "0");
     try {
-      // no need to do client/org checks on these actions, as in error, do the 
least possible
+      // do not do org/client check as the error can be related to org/client 
access
+      // so prevent this check to be done to even be able to save org/client 
access
+      // checks
       OBContext.setAdminMode(false);
       ImportEntry importEntry = OBDal.getInstance().get(ImportEntry.class, 
importEntryId);
       if (importEntry != null && 
!"Processed".equals(importEntry.getImportStatus())) {
@@ -475,7 +474,8 @@
           try {
 
             // too busy, don't process, but wait
-            if (manager.executorService.getQueue().size() > 
(manager.maxTaskQueueSize - 1)) {
+            if (manager.executorService.getQueue() != null
+                && manager.executorService.getQueue().size() > 
(manager.maxTaskQueueSize - 1)) {
               doWait();
               // woken, re-start from beginning of loop
               continue;

------------------------------------------------------------------------------
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to