Fixes issue 27364: Check All button does not work in Order/Invoice P&E grid
authorAugusto Mauch <augusto.mauch@openbravo.com>
Thu, 21 Aug 2014 16:54:26 +0200
changeset 24294 955bdd54d89a
parent 24293 5ad476a544f2
child 24295 077608c0d57c
Fixes issue 27364: Check All button does not work in Order/Invoice P&E grid

Now if the records does not fit in the first page, the distribute amount function will not be executed. Instead, a message will be shown to the user in the message bar.
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MESSAGE.xml
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_REF_LIST.xml
modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-addPayment.js
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MESSAGE.xml	Thu Aug 21 14:06:17 2014 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MESSAGE.xml	Thu Aug 21 16:54:26 2014 +0200
@@ -961,6 +961,18 @@
 <!--B6F8970C7470421FA5375E61D71A8E73-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
 <!--B6F8970C7470421FA5375E61D71A8E73--></AD_MESSAGE>
 
+<!--B80A5CA4E2554B3EB706486A763B1297--><AD_MESSAGE>
+<!--B80A5CA4E2554B3EB706486A763B1297-->  <AD_MESSAGE_ID><![CDATA[B80A5CA4E2554B3EB706486A763B1297]]></AD_MESSAGE_ID>
+<!--B80A5CA4E2554B3EB706486A763B1297-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--B80A5CA4E2554B3EB706486A763B1297-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--B80A5CA4E2554B3EB706486A763B1297-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--B80A5CA4E2554B3EB706486A763B1297-->  <VALUE><![CDATA[APRM_NoDistributeMsg]]></VALUE>
+<!--B80A5CA4E2554B3EB706486A763B1297-->  <MSGTEXT><![CDATA[The amount has not been distributed because there are too many (>75) records]]></MSGTEXT>
+<!--B80A5CA4E2554B3EB706486A763B1297-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--B80A5CA4E2554B3EB706486A763B1297-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--B80A5CA4E2554B3EB706486A763B1297-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--B80A5CA4E2554B3EB706486A763B1297--></AD_MESSAGE>
+
 <!--B9ECCDD15B1349B5B00DC6EE83AD869E--><AD_MESSAGE>
 <!--B9ECCDD15B1349B5B00DC6EE83AD869E-->  <AD_MESSAGE_ID><![CDATA[B9ECCDD15B1349B5B00DC6EE83AD869E]]></AD_MESSAGE_ID>
 <!--B9ECCDD15B1349B5B00DC6EE83AD869E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_REF_LIST.xml	Thu Aug 21 14:06:17 2014 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_REF_LIST.xml	Thu Aug 21 16:54:26 2014 +0200
@@ -312,6 +312,18 @@
 <!--C5D1596D065545B49156C1F9426C9E14-->  <SEQNO><![CDATA[30]]></SEQNO>
 <!--C5D1596D065545B49156C1F9426C9E14--></AD_REF_LIST>
 
+<!--D82326E588CB4BF685FAE03B5097B108--><AD_REF_LIST>
+<!--D82326E588CB4BF685FAE03B5097B108-->  <AD_REF_LIST_ID><![CDATA[D82326E588CB4BF685FAE03B5097B108]]></AD_REF_LIST_ID>
+<!--D82326E588CB4BF685FAE03B5097B108-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--D82326E588CB4BF685FAE03B5097B108-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--D82326E588CB4BF685FAE03B5097B108-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--D82326E588CB4BF685FAE03B5097B108-->  <VALUE><![CDATA[APRM_ShowNoDistributeMsg]]></VALUE>
+<!--D82326E588CB4BF685FAE03B5097B108-->  <NAME><![CDATA[Show No Distribute Amount Message]]></NAME>
+<!--D82326E588CB4BF685FAE03B5097B108-->  <DESCRIPTION><![CDATA[If not 'N', shows a message when the APRM distribution is not done due to having too many records]]></DESCRIPTION>
+<!--D82326E588CB4BF685FAE03B5097B108-->  <AD_REFERENCE_ID><![CDATA[A26BA480E2014707B47257024C3CBFF7]]></AD_REFERENCE_ID>
+<!--D82326E588CB4BF685FAE03B5097B108-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--D82326E588CB4BF685FAE03B5097B108--></AD_REF_LIST>
+
 <!--DDCDE32A9FC046E694D5074144DD6AFF--><AD_REF_LIST>
 <!--DDCDE32A9FC046E694D5074144DD6AFF-->  <AD_REF_LIST_ID><![CDATA[DDCDE32A9FC046E694D5074144DD6AFF]]></AD_REF_LIST_ID>
 <!--DDCDE32A9FC046E694D5074144DD6AFF-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-addPayment.js	Thu Aug 21 14:06:17 2014 +0000
+++ b/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-addPayment.js	Thu Aug 21 16:54:26 2014 +0200
@@ -284,8 +284,16 @@
       glitemamt = new BigDecimal(String(form.getItem('amount_gl_items').getValue() || 0)),
       orderInvoiceData = orderInvoice.data.localData,
       total = orderInvoice.data.totalRows,
-      writeoff, amt, outstandingAmount, i;
+      writeoff, amt, outstandingAmount, i, showMessageProperty, showMessage;
 
+  if (orderInvoice.data.localData.length < (orderInvoice.data.totalRows)) {
+    showMessageProperty = OB.PropertyStore.get('APRM_ShowNoDistributeMsg');
+    showMessage = (showMessageProperty !== 'N' && showMessageProperty !== '"N"');
+    if (showMessage) {
+      orderInvoice.contentView.messageBar.setMessage(isc.OBMessageBar.TYPE_INFO, '<div><div class="' + OB.Styles.MessageBar.leftMsgContainerStyle + '">' + OB.I18N.getLabel('APRM_NoDistributeMsg') + '</div><div class="' + OB.Styles.MessageBar.rightMsgContainerStyle + '"><a href="#" class="' + OB.Styles.MessageBar.rightMsgTextStyle + '" onclick="' + 'window[\'' + orderInvoice.contentView.messageBar.ID + '\'].hide(); OB.PropertyStore.set(\'APRM_ShowNoDistributeMsg\', \'N\');">' + OB.I18N.getLabel('OBUIAPP_NeverShowMessageAgain') + '</a></div></div>', ' ');
+    }
+    return;
+  }
   // subtract glitem amount
   amount = amount.subtract(glitemamt);
   // add credit amount