details:   /erp/devel/pi/rev/555503acd4a6
changeset: 11910:555503acd4a6
user:      Gorka Ion Damián <gorkaion.damian <at> openbravo.com>
date:      Tue May 03 22:59:22 2011 +0200
summary:   Added new files for SE_FinancialAccount_BSAccounts callout

diffstat:

 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/APRMActionHandler.java
       |  67 ++++++++++
 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/APRMApplicationProvider.java
 |  45 ++++++
 
modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-utilities.js
      |  39 +++++
 3 files changed, 151 insertions(+), 0 deletions(-)

diffs (163 lines):

diff -r 0a30bd9668fb -r 555503acd4a6 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/APRMActionHandler.java
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ 
b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/APRMActionHandler.java
      Tue May 03 22:59:22 2011 +0200
@@ -0,0 +1,67 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html 
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2011 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.advpaymentmngt;
+
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+import org.openbravo.client.kernel.BaseActionHandler;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.model.financialmgmt.payment.FIN_FinancialAccount;
+import org.openbravo.model.financialmgmt.payment.FinAccPaymentMethod;
+
+public class APRMActionHandler extends BaseActionHandler {
+  private static final Logger log = Logger.getLogger(APRMActionHandler.class);
+  private static final String BANK_TRANSITORY_CALLOUT_RESPONSE = 
"bankTransitoryCalloutResponse";
+
+  @Override
+  protected JSONObject execute(Map<String, Object> parameters, String content) 
{
+    JSONObject object = new JSONObject();
+    JSONObject o;
+    try {
+      o = new JSONObject(content);
+      final String strEventType = o.getString("eventType");
+      if (BANK_TRANSITORY_CALLOUT_RESPONSE.equals(strEventType)) {
+        final String strFinancialAccount = o.getString("financialAccountId");
+        updatePaymentMethodConfiguration(strFinancialAccount);
+      } else {
+        log.error("Unsupported event type: " + strEventType);
+      }
+    } catch (JSONException e) {
+      log.error("Error executing action: " + e.getMessage(), e);
+    }
+
+    return object;
+  }
+
+  void updatePaymentMethodConfiguration(String strfinFinancialAccountId) {
+    FIN_FinancialAccount account = 
OBDal.getInstance().get(FIN_FinancialAccount.class,
+        strfinFinancialAccountId);
+
+    // Configure clearing account for all payment methods upon clearing event
+    for (FinAccPaymentMethod paymentMethod : 
account.getFinancialMgmtFinAccPaymentMethodList()) {
+      paymentMethod.setOUTUponClearingUse("CLE");
+      paymentMethod.setINUponClearingUse("CLE");
+      OBDal.getInstance().save(paymentMethod);
+    }
+    OBDal.getInstance().flush();
+  }
+}
diff -r 0a30bd9668fb -r 555503acd4a6 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/APRMApplicationProvider.java
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ 
b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/APRMApplicationProvider.java
        Tue May 03 22:59:22 2011 +0200
@@ -0,0 +1,45 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html 
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2011 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.advpaymentmngt;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.context.ApplicationScoped;
+
+import org.openbravo.client.kernel.BaseComponentProvider;
+import org.openbravo.client.kernel.Component;
+
+@ApplicationScoped
+public class APRMApplicationProvider extends BaseComponentProvider {
+
+  @Override
+  public Component getComponent(String componentId, Map<String, Object> 
parameters) {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public List<ComponentResource> getGlobalComponentResources() {
+    final List<ComponentResource> globalResources = new 
ArrayList<ComponentResource>();
+    globalResources.add(createStaticResource(
+        "web/org.openbravo.advpaymentmngt/js/ob-aprm-utilities.js", true));
+    return globalResources;
+  }
+}
diff -r 0a30bd9668fb -r 555503acd4a6 
modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-utilities.js
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ 
b/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-utilities.js
     Tue May 03 22:59:22 2011 +0200
@@ -0,0 +1,39 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2011 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+OB.APRM = {};
+OB.APRM.bankTransitoryAccountCalloutResponse = function(me, confirmMessage, 
financialAccountId) {
+  isc.confirm(confirmMessage, function(value){
+    if (value) {
+      var bankTransitoryAccount = me.getField('fINTransitoryAcct')._value,
+          bankTransitoryAccountDesc = 
me.getField('fINTransitoryAcct').valueMap[bankTransitoryAccount];
+
+      me.getField('clearedPaymentAccount').valueMap[bankTransitoryAccount] = 
bankTransitoryAccountDesc;
+      me.getField('clearedPaymentAccount').setValue(bankTransitoryAccount);
+      me.getField('clearedPaymentAccountOUT').valueMap[bankTransitoryAccount] 
= bankTransitoryAccountDesc;
+      me.getField('clearedPaymentAccountOUT').setValue(bankTransitoryAccount);
+      
+      post = {'eventType': 'bankTransitoryCalloutResponse',
+              'financialAccountId': financialAccountId};
+
+      
OB.RemoteCallManager.call('org.openbravo.advpaymentmngt.APRMActionHandler', 
post, {}, {});
+
+    }
+  });
+};

------------------------------------------------------------------------------
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