details:   /erp/devel/pi/rev/4e8298aebfb3
changeset: 11797:4e8298aebfb3
user:      Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
date:      Thu Apr 28 16:12:22 2011 +0200
summary:   [cleanup] Removed deprecated elements from the configScript

details:   /erp/devel/pi/rev/2684cc21d9dd
changeset: 11798:2684cc21d9dd
user:      Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
date:      Thu Apr 28 18:06:36 2011 +0200
summary:   [cleanup] Removed AD_TREENODEPR table

details:   /erp/devel/pi/rev/b2b6acc6f87b
changeset: 11799:b2b6acc6f87b
user:      Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
date:      Thu Apr 28 18:08:25 2011 +0200
summary:   Merge from PI

details:   /erp/devel/pi/rev/26361fd2e787
changeset: 11800:26361fd2e787
user:      Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
date:      Thu Apr 28 18:09:50 2011 +0200
summary:   Merge back cleanup project (phase II)

diffstat:

 modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_FIELD.xml   
                                  |     3 -
 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_AddPayment.java
                |    30 +-
 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java
            |    35 +
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
             |     9 +-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
                 |     3 +
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
                 |    70 +-
 
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
 |    38 +-
 modules/org.openbravo.v3/src-db/database/configScript.xml                      
                                  |    12 -
 referencedata/sampledata/F_B_International_Group.xml                           
                                  |  9387 ++++-----
 referencedata/sampledata/QA_Testing.xml                                        
                                  |   697 +-
 src-db/database/model/tables/AD_TREENODEPR.xml                                 
                                  |    74 -
 src-db/database/model/triggers/AD_TREE_TRG.xml                                 
                                  |    21 +-
 src-db/database/model/triggers/M_PRODUCT_TRG.xml                               
                                  |    24 +-
 src-db/database/model/triggers/M_PRODUCT_TRG2.xml                              
                                  |    35 -
 src-db/database/sourcedata/AD_COLUMN.xml                                       
                                  |   399 -
 src-db/database/sourcedata/AD_DATASET_TABLE.xml                                
                                  |    28 -
 src-db/database/sourcedata/AD_TABLE.xml                                        
                                  |    21 -
 src-db/database/sourcedata/referencedData/AD_TREENODEPR.xml                    
                                  |    13 -
 src-db/src/com/openbravo/db/OpenbravoDataFilter.java                           
                                  |     1 -
 src-db/src/com/openbravo/db/OpenbravoMetadataFilter.java                       
                                  |     1 -
 src-test/org/openbravo/test/dal/DalQueryTest.java                              
                                  |     4 +-
 src-test/org/openbravo/test/dal/DalStoredProcedureTest.java                    
                                  |    13 +-
 src/org/openbravo/erpCommon/utility/WindowTreeUtility.java                     
                                  |     9 +-
 src/org/openbravo/erpCommon/utility/WindowTree_data.xsql                       
                                  |    30 -
 24 files changed, 5011 insertions(+), 5946 deletions(-)

diffs (truncated from 31836 to 300 lines):

diff -r a2f40b181582 -r 26361fd2e787 
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_FIELD.xml
--- 
a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_FIELD.xml  
    Thu Apr 28 13:00:23 2011 +0200
+++ 
b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_FIELD.xml  
    Thu Apr 28 18:09:50 2011 +0200
@@ -4112,7 +4112,6 @@
 <!--830698140BBF4AC3E040007F01000289-->  
<ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
 <!--830698140BBF4AC3E040007F01000289--></AD_FIELD>
 
-<!--830698140BC54AC3E040007F01000289-->  
<ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
 <!--830698140BCD4AC3E040007F01000289--><AD_FIELD>
 <!--830698140BCD4AC3E040007F01000289-->  
<AD_FIELD_ID><![CDATA[830698140BCD4AC3E040007F01000289]]></AD_FIELD_ID>
 <!--830698140BCD4AC3E040007F01000289-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -4163,8 +4162,6 @@
 <!--830698140BCE4AC3E040007F01000289-->  
<ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
 <!--830698140BCE4AC3E040007F01000289--></AD_FIELD>
 
-<!--830698140BD04AC3E040007F01000289-->  
<ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
-<!--830698140BD54AC3E040007F01000289-->  
<ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
 <!--830698140BDD4AC3E040007F01000289--><AD_FIELD>
 <!--830698140BDD4AC3E040007F01000289-->  
<AD_FIELD_ID><![CDATA[830698140BDD4AC3E040007F01000289]]></AD_FIELD_ID>
 <!--830698140BDD4AC3E040007F01000289-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
diff -r a2f40b181582 -r 26361fd2e787 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_AddPayment.java
--- 
a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_AddPayment.java
 Thu Apr 28 13:00:23 2011 +0200
+++ 
b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_AddPayment.java
 Thu Apr 28 18:09:50 2011 +0200
@@ -589,29 +589,17 @@
    */
   public static void updatePaymentScheduleAmounts(FIN_PaymentSchedule 
paymentSchedule,
       BigDecimal amount, BigDecimal writeOffAmount) {
-    BigDecimal totalPaid = amount;
-    BigDecimal outstanding = paymentSchedule.getOutstandingAmount();
+    paymentSchedule.setPaidAmount(paymentSchedule.getPaidAmount().add(amount));
+    
paymentSchedule.setOutstandingAmount(paymentSchedule.getOutstandingAmount().subtract(amount));
     if (writeOffAmount != null && writeOffAmount.compareTo(BigDecimal.ZERO) != 
0) {
-      totalPaid = amount.add(writeOffAmount);
+      
paymentSchedule.setPaidAmount(paymentSchedule.getPaidAmount().add(writeOffAmount));
+      
paymentSchedule.setOutstandingAmount(paymentSchedule.getOutstandingAmount().subtract(
+          writeOffAmount));
     }
-    // (totalPaid > 0 && totalPaid <= outstanding) || (totalPaid < 0 && 
totalPaid >= outstanding)
-    if ((totalPaid.compareTo(BigDecimal.ZERO) == 1 && 
totalPaid.compareTo(outstanding) <= 0)
-        || (totalPaid.compareTo(BigDecimal.ZERO) == -1 && 
totalPaid.compareTo(outstanding) >= 0)) {
-      
paymentSchedule.setPaidAmount(paymentSchedule.getPaidAmount().add(amount));
-      
paymentSchedule.setOutstandingAmount(paymentSchedule.getOutstandingAmount().subtract(amount));
-      if (writeOffAmount != null && writeOffAmount.compareTo(BigDecimal.ZERO) 
!= 0) {
-        
paymentSchedule.setPaidAmount(paymentSchedule.getPaidAmount().add(writeOffAmount));
-        
paymentSchedule.setOutstandingAmount(paymentSchedule.getOutstandingAmount().subtract(
-            writeOffAmount));
-      }
-      OBDal.getInstance().save(paymentSchedule);
-      if (paymentSchedule.getInvoice() != null) {
-        updateInvoicePaymentMonitor(paymentSchedule.getInvoice(), 
paymentSchedule.getDueDate(),
-            amount, writeOffAmount);
-      }
-    } else {
-      throw new 
OBException(String.format(FIN_Utility.messageBD("APRM_AmountOutOfRange"), 
totalPaid
-          .toString(), paymentSchedule.getOutstandingAmount().toString()));
+    OBDal.getInstance().save(paymentSchedule);
+    if (paymentSchedule.getInvoice() != null) {
+      updateInvoicePaymentMonitor(paymentSchedule.getInvoice(), 
paymentSchedule.getDueDate(),
+          amount, writeOffAmount);
     }
   }
 
diff -r a2f40b181582 -r 26361fd2e787 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java
--- 
a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java
     Thu Apr 28 13:00:23 2011 +0200
+++ 
b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java
     Thu Apr 28 18:09:50 2011 +0200
@@ -29,6 +29,7 @@
 import org.openbravo.advpaymentmngt.dao.TransactionsDao;
 import org.openbravo.advpaymentmngt.exception.NoExecutionProcessFoundException;
 import org.openbravo.advpaymentmngt.utility.FIN_Utility;
+import org.openbravo.base.exception.OBException;
 import org.openbravo.base.secureApp.VariablesSecureApp;
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBCriteria;
@@ -114,6 +115,8 @@
               if (paymentScheduleDetail.getInvoicePaymentSchedule() != null) {
                 
invoiceDocNos.add(paymentScheduleDetail.getInvoicePaymentSchedule().getInvoice()
                     .getDocumentNo());
+                
validateAmount(paymentScheduleDetail.getInvoicePaymentSchedule(), paymentDetail
+                    .getAmount(), paymentDetail.getWriteoffAmount());
                 
FIN_AddPayment.updatePaymentScheduleAmounts(paymentScheduleDetail
                     .getInvoicePaymentSchedule(), paymentDetail.getAmount(), 
paymentDetail
                     .getWriteoffAmount());
@@ -123,6 +126,8 @@
               if (paymentScheduleDetail.getOrderPaymentSchedule() != null) {
                 
orderDocNos.add(paymentScheduleDetail.getOrderPaymentSchedule().getOrder()
                     .getDocumentNo());
+                
validateAmount(paymentScheduleDetail.getOrderPaymentSchedule(), paymentDetail
+                    .getAmount(), paymentDetail.getWriteoffAmount());
                 
FIN_AddPayment.updatePaymentScheduleAmounts(paymentScheduleDetail
                     .getOrderPaymentSchedule(), paymentDetail.getAmount(), 
paymentDetail
                     .getWriteoffAmount());
@@ -430,4 +435,34 @@
       }
     }
   }
+
+  /**
+   * Checks if the amount to pay/receive fits with the outstanding amount in 
the invoice or order.
+   * 
+   * @param paymentSchedule
+   *          Payment plan of the order or invoice where the outstanding 
amount is specified.
+   * @param amount
+   *          Amount to by paid or received.
+   * @param writeOffAmount
+   *          Write off amount.
+   * @return True if the amount is valid.
+   * @throws OBException
+   *           Exception explaining why the amount is not valid.
+   */
+  private boolean validateAmount(FIN_PaymentSchedule paymentSchedule, 
BigDecimal amount,
+      BigDecimal writeOffAmount) throws OBException {
+    BigDecimal totalPaid = amount;
+    BigDecimal outstanding = paymentSchedule.getOutstandingAmount();
+    if (writeOffAmount != null && writeOffAmount.compareTo(BigDecimal.ZERO) != 
0) {
+      totalPaid = amount.add(writeOffAmount);
+    }
+    // (totalPaid > 0 && totalPaid <= outstanding) || (totalPaid < 0 && 
totalPaid >= outstanding)
+    if ((totalPaid.compareTo(BigDecimal.ZERO) == 1 && 
totalPaid.compareTo(outstanding) <= 0)
+        || (totalPaid.compareTo(BigDecimal.ZERO) == -1 && 
totalPaid.compareTo(outstanding) >= 0)) {
+      return true;
+    } else {
+      throw new 
OBException(String.format(FIN_Utility.messageBD("APRM_AmountOutOfRange"), 
totalPaid
+          .toString(), paymentSchedule.getOutstandingAmount().toString()));
+    }
+  }
 }
diff -r a2f40b181582 -r 26361fd2e787 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
      Thu Apr 28 13:00:23 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
      Thu Apr 28 18:09:50 2011 +0200
@@ -1575,10 +1575,11 @@
       classicMode = true;
     }
     var value, field, record, form, component, propertyObj, type;
-    // different modes:
-    // 1) showing grid with one record selected
-    // 2) showing form with aux inputs
-    if (this.isEditingGrid) {
+
+    // a special case, the editform has been build but it is not present yet 
in the
+    // form, so isEditingGrid is true but the edit form is not there yet, in 
that 
+    // case use the viewGrid as component and the selected record
+    if (this.isEditingGrid && this.viewGrid.getEditForm()) {
       rowNum = this.viewGrid.getEditRow();
       if (rowNum || rowNum === 0) {
         record = isc.addProperties({}, this.viewGrid.getRecord(rowNum), 
this.viewGrid.getEditValues(rowNum));
diff -r a2f40b181582 -r 26361fd2e787 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
  Thu Apr 28 13:00:23 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
  Thu Apr 28 18:09:50 2011 +0200
@@ -611,6 +611,9 @@
             this.getFocusItem().focusInItem();
           }
         }
+      } else {
+        this.redraw();
+        this.view.viewGrid.refreshEditRow();
       }
     }
   },
diff -r a2f40b181582 -r 26361fd2e787 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
  Thu Apr 28 13:00:23 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
  Thu Apr 28 18:09:50 2011 +0200
@@ -1051,8 +1051,13 @@
   // for one select/deselect action
   selectionUpdated: function(record, recordList){
   
-    // close any editors we may have
-    this.closeAnyOpenEditor();
+    // close any editors, but only if it is different from the one we are 
editing
+    if (this.isEditingGrid) {
+      var editRecord = this.getRecord(this.getEditRow());
+      if (editRecord !== record) {
+        this.closeAnyOpenEditor();
+      }
+    }
     this.stopHover();
     this.updateSelectedCountDisplay();
     this.view.recordSelected();
@@ -1315,7 +1320,9 @@
     this.scrollToRow(rowNum);
     this.updateRowCountDisplay();
     this.view.toolBar.updateButtonState(true);
-    this.redraw();
+    
+    // do it with a delay to give the system time to set the record information
+    this.markForRedraw();
   },
   
   editFailed: function(rowNum, colNum, newValues, oldValues, 
editCompletionEvent, dsResponse, dsRequest){
@@ -1347,6 +1354,7 @@
   },
   
   editComplete: function(rowNum, colNum, newValues, oldValues, 
editCompletionEvent, dsResponse){
+
     var record = this.getRecord(rowNum), editRow, editSession, autoSaveAction;
     
     // a new id has been computed use that now    
@@ -1620,21 +1628,31 @@
     this.endEditing();
   },
   
-  // is called when clicking a header
   hideInlineEditor: function(focusInBody, suppressCMHide) {
+
     var rowNum = this.getEditRow(), record = this.getRecord(rowNum);
-    
-    // clear the errors so that they don't show up at the next row
-    if (this.getEditForm()) {
-      this.getEditForm().clearErrors();
+    if (rowNum === 0 || rowNum) {
+      if (!this.rowHasErrors(rowNum)) {
+        record[this.recordBaseStyleProperty] = null;
+      }
+      
+      // clear the errors so that they don't show up at the next row
+      if (this.getEditForm()) {
+        this.getEditForm().clearErrors();
+      }
+  
+      if (record && record.editColumnLayout) {
+        isc.Log.logDebug('hideInlineEditor has record and editColumnLayout', 
'OB');
+        record.editColumnLayout.showEditOpen();
+      } else if (this.currentEditColumnLayout) {
+        this.currentEditColumnLayout.showEditOpen();
+      } else {
+        isc.Log.logDebug('hideInlineEditor has NO record and 
editColumnLayout', 'OB');
+      }
+      this.view.isEditingGrid = false;
+      this.refreshRow(rowNum);
     }
     
-    this.view.messageBar.hide();
-    if (record && record.editColumnLayout) {
-      record.editColumnLayout.showEditOpen();
-    } else if (this.getEditForm().getValues().editColumnLayout) {
-      this.getEditForm().getValues().editColumnLayout.showEditOpen();
-    }
     // always hide the clickmask, as it needs to be re-applied
     return this.Super('hideInlineEditor', [focusInBody, false]);
   },
@@ -1699,24 +1717,6 @@
     return ret;
   },
   
-  rowEditorExit: function(editCompletionEvent, record, newValues, rowNum){
-    isc.Log.logDebug('rowEditorExit ' + this.getEditRow(), 'OB');
-    if (!this.rowHasErrors(rowNum)) {
-      record[this.recordBaseStyleProperty] = null;
-    }
-    
-    if (record && record.editColumnLayout) {
-      isc.Log.logDebug('hideInlineEditor has record and editColumnLayout', 
'OB');
-      record.editColumnLayout.showEditOpen();
-    } else if (this.currentEditColumnLayout) {
-      this.currentEditColumnLayout.showEditOpen();
-    } else {
-      isc.Log.logDebug('hideInlineEditor has NO record and editColumnLayout', 
'OB');
-    }
-    this.view.isEditingGrid = false;
-    this.refreshRow(rowNum);
-  },
-  
   closeAnyOpenEditor: function(){
     delete this.wasEditing;
     // close any editors we may have
@@ -2164,6 +2164,9 @@
   },
   
   hideMember: function(memberNo) {
+    if (!this.members[memberNo]) {
+      return;
+    }
     // already hidden
     if (this.members[memberNo] && this.members[memberNo].visibility === 
isc.Canvas.HIDDEN) {
       return;
@@ -2172,6 +2175,9 @@
   },
 
   showMember: function(memberNo) {
+    if (!this.members[memberNo]) {
+      return;
+    }
     // already visible
     if (this.members[memberNo] && this.members[memberNo].visibility === 
isc.Canvas.INHERIT || this.members[memberNo].visibility === isc.Canvas.VISIBLE) 
{
       return;
diff -r a2f40b181582 -r 26361fd2e787 
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
--- 
a/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
  Thu Apr 28 13:00:23 2011 +0200
+++ 
b/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
  Thu Apr 28 18:09:50 2011 +0200
@@ -56,6 +56,18 @@
   // disable tab to icons
   canTabToIcons: false,
   
+  // when a value is set the selectValue is called with a delay, during that 
delay
+  // the focus may have moved to another field, the selectValue will however 
again 
+  // put the focus in this field this results in infinite looping of calls
+  // https://issues.openbravo.com/view.php?id=16908
+  _selectValue : isc.FormItem.getPrototype().selectValue,
+  selectValue: function() {
+    if (!this.hasFocus) {
+      return;
+    }

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to