details:   https://code.openbravo.com/erp/devel/pi/rev/ff0929e96ca2
changeset: 27013:ff0929e96ca2
user:      Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
date:      Fri Jun 05 10:37:14 2015 +0200
summary:   Fixes issue 30108: BP not shown in Payment In/Out Header in F&B 
client

Set ismandatory = Y to "Business Partner" accounting dimension for "AP Payment" 
and "AR Receipt" documents in FIN_Payment table in Dimension Mapping window.
Set show in header = Y to "Business Partner" accounting dimension for "AP 
Payment" and "AR Receipt" documents in Client window - Dimension tab in F&B 
client.

details:   https://code.openbravo.com/erp/devel/pi/rev/f7c344c707ee
changeset: 27014:f7c344c707ee
user:      Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
date:      Mon Jun 22 20:24:40 2015 +0200
summary:   Related to issue 30108: Add a modulescript to update created clients

A new modulescript has been added in order to activate the "Show in Header" 
flag, to clients with "Central Maintenance" flag activated, for "AR Receipt" 
and "AP Payment" documents and "Business Partner" accounting dimension, in 
Client - Dimensions tab.

diffstat:

 referencedata/sampledata/F_B_International_Group/AD_CLIENT_ACCTDIMENSION.xml   
                         |   12 +-
 src-db/database/sourcedata/AD_DIMENSION_MAPPING.xml                            
                         |    4 +-
 
src-util/modulescript/build/classes/org/openbravo/modulescript/UpdatePaymentBPClientDimension.class
     |    0 
 
src-util/modulescript/build/classes/org/openbravo/modulescript/UpdatePaymentBPClientDimensionData.class
 |    0 
 
src-util/modulescript/src/org/openbravo/modulescript/UpdatePaymentBPClientDimension.java
                |   41 +++++
 
src-util/modulescript/src/org/openbravo/modulescript/UpdatePaymentBPClientDimension_data.xsql
           |   72 ++++++++++
 6 files changed, 121 insertions(+), 8 deletions(-)

diffs (180 lines):

diff -r b727e3caf4c2 -r f7c344c707ee 
referencedata/sampledata/F_B_International_Group/AD_CLIENT_ACCTDIMENSION.xml
--- 
a/referencedata/sampledata/F_B_International_Group/AD_CLIENT_ACCTDIMENSION.xml  
    Tue Jun 23 10:14:39 2015 +0200
+++ 
b/referencedata/sampledata/F_B_International_Group/AD_CLIENT_ACCTDIMENSION.xml  
    Mon Jun 22 20:24:40 2015 +0200
@@ -199,11 +199,11 @@
   <ISACTIVE><![CDATA[Y]]></ISACTIVE>
   <CREATED><![CDATA[2013-07-04 23:45:48.998]]></CREATED>
   <CREATEDBY><![CDATA[0]]></CREATEDBY>
-  <UPDATED><![CDATA[2013-07-04 23:45:48.998]]></UPDATED>
-  <UPDATEDBY><![CDATA[0]]></UPDATEDBY>
+  <UPDATED><![CDATA[2015-06-04 09:48:16.736]]></UPDATED>
+  <UPDATEDBY><![CDATA[100]]></UPDATEDBY>
   <DIMENSION><![CDATA[BP]]></DIMENSION>
   <DOCBASETYPE><![CDATA[ARR]]></DOCBASETYPE>
-  <SHOW_IN_HEADER><![CDATA[N]]></SHOW_IN_HEADER>
+  <SHOW_IN_HEADER><![CDATA[Y]]></SHOW_IN_HEADER>
   <SHOW_IN_LINES><![CDATA[Y]]></SHOW_IN_LINES>
   <SHOW_IN_BREAKDOWN><![CDATA[N]]></SHOW_IN_BREAKDOWN>
 </AD_CLIENT_ACCTDIMENSION>
@@ -487,11 +487,11 @@
   <ISACTIVE><![CDATA[Y]]></ISACTIVE>
   <CREATED><![CDATA[2013-07-04 23:45:48.997]]></CREATED>
   <CREATEDBY><![CDATA[0]]></CREATEDBY>
-  <UPDATED><![CDATA[2013-07-04 23:45:48.997]]></UPDATED>
-  <UPDATEDBY><![CDATA[0]]></UPDATEDBY>
+  <UPDATED><![CDATA[2015-06-04 18:20:40.767]]></UPDATED>
+  <UPDATEDBY><![CDATA[100]]></UPDATEDBY>
   <DIMENSION><![CDATA[BP]]></DIMENSION>
   <DOCBASETYPE><![CDATA[APP]]></DOCBASETYPE>
-  <SHOW_IN_HEADER><![CDATA[N]]></SHOW_IN_HEADER>
+  <SHOW_IN_HEADER><![CDATA[Y]]></SHOW_IN_HEADER>
   <SHOW_IN_LINES><![CDATA[Y]]></SHOW_IN_LINES>
   <SHOW_IN_BREAKDOWN><![CDATA[N]]></SHOW_IN_BREAKDOWN>
 </AD_CLIENT_ACCTDIMENSION>
diff -r b727e3caf4c2 -r f7c344c707ee 
src-db/database/sourcedata/AD_DIMENSION_MAPPING.xml
--- a/src-db/database/sourcedata/AD_DIMENSION_MAPPING.xml       Tue Jun 23 
10:14:39 2015 +0200
+++ b/src-db/database/sourcedata/AD_DIMENSION_MAPPING.xml       Mon Jun 22 
20:24:40 2015 +0200
@@ -3493,7 +3493,7 @@
 <!--AC74E74370754AA3A9EF8424E256CBD1-->  
<DOCBASETYPE><![CDATA[APP]]></DOCBASETYPE>
 <!--AC74E74370754AA3A9EF8424E256CBD1-->  
<AD_TABLE_ID><![CDATA[D1A97202E832470285C9B1EB026D54E2]]></AD_TABLE_ID>
 <!--AC74E74370754AA3A9EF8424E256CBD1-->  
<AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
-<!--AC74E74370754AA3A9EF8424E256CBD1-->  
<ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--AC74E74370754AA3A9EF8424E256CBD1-->  
<ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
 <!--AC74E74370754AA3A9EF8424E256CBD1-->  
<DOCUMENTLEVEL><![CDATA[H]]></DOCUMENTLEVEL>
 <!--AC74E74370754AA3A9EF8424E256CBD1--></AD_DIMENSION_MAPPING>
 
@@ -4650,7 +4650,7 @@
 <!--EFB91B3A715E45B6A358B9E33D7C08D0-->  
<DOCBASETYPE><![CDATA[ARR]]></DOCBASETYPE>
 <!--EFB91B3A715E45B6A358B9E33D7C08D0-->  
<AD_TABLE_ID><![CDATA[D1A97202E832470285C9B1EB026D54E2]]></AD_TABLE_ID>
 <!--EFB91B3A715E45B6A358B9E33D7C08D0-->  
<AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
-<!--EFB91B3A715E45B6A358B9E33D7C08D0-->  
<ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--EFB91B3A715E45B6A358B9E33D7C08D0-->  
<ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
 <!--EFB91B3A715E45B6A358B9E33D7C08D0-->  
<DOCUMENTLEVEL><![CDATA[H]]></DOCUMENTLEVEL>
 <!--EFB91B3A715E45B6A358B9E33D7C08D0--></AD_DIMENSION_MAPPING>
 
diff -r b727e3caf4c2 -r f7c344c707ee 
src-util/modulescript/build/classes/org/openbravo/modulescript/UpdatePaymentBPClientDimension.class
Binary file 
src-util/modulescript/build/classes/org/openbravo/modulescript/UpdatePaymentBPClientDimension.class
 has changed
diff -r b727e3caf4c2 -r f7c344c707ee 
src-util/modulescript/build/classes/org/openbravo/modulescript/UpdatePaymentBPClientDimensionData.class
Binary file 
src-util/modulescript/build/classes/org/openbravo/modulescript/UpdatePaymentBPClientDimensionData.class
 has changed
diff -r b727e3caf4c2 -r f7c344c707ee 
src-util/modulescript/src/org/openbravo/modulescript/UpdatePaymentBPClientDimension.java
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ 
b/src-util/modulescript/src/org/openbravo/modulescript/UpdatePaymentBPClientDimension.java
  Mon Jun 22 20:24:40 2015 +0200
@@ -0,0 +1,41 @@
+/*
+ *************************************************************************
+ * 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) 2015 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ *************************************************************************
+ */
+package org.openbravo.modulescript;
+
+import java.sql.PreparedStatement;
+import org.apache.log4j.Logger;
+
+import org.openbravo.database.ConnectionProvider;
+import org.openbravo.modulescript.ModuleScript;
+
+public class UpdatePaymentBPClientDimension extends ModuleScript {
+  private static final Logger log4j = 
Logger.getLogger(UpdatePaymentBPClientDimension.class);
+  public void execute() {
+    try {
+      ConnectionProvider cp = getConnectionProvider();
+      boolean isExecuted = UpdatePaymentBPClientDimensionData.isExecuted(cp);
+      if (!isExecuted) {
+        UpdatePaymentBPClientDimensionData.update(cp);
+        UpdatePaymentBPClientDimensionData.createPreference(cp);
+      }
+    } catch (Exception e) {
+      handleError(e);
+    }
+  }
+}
\ No newline at end of file
diff -r b727e3caf4c2 -r f7c344c707ee 
src-util/modulescript/src/org/openbravo/modulescript/UpdatePaymentBPClientDimension_data.xsql
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ 
b/src-util/modulescript/src/org/openbravo/modulescript/UpdatePaymentBPClientDimension_data.xsql
     Mon Jun 22 20:24:40 2015 +0200
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ *************************************************************************
+ * 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) 2015 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+-->
+<SqlClass name="UpdatePaymentBPClientDimensionData" 
package="org.openbravo.modulescript">
+   <SqlClassComment></SqlClassComment>  
+   <SqlMethod name="dummy" type="preparedStatement" return="multiple">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql>
+      <![CDATA[
+      SELECT '' AS show_in_header FROM DUAL
+      ]]>
+    </Sql>
+    <Field name="rownum" value="count"/>
+  </SqlMethod> 
+  <SqlMethod name="update" type="preparedStatement" return="rowCount">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql>
+      <![CDATA[
+        UPDATE AD_Client_AcctDimension
+        SET show_in_header = 'Y'
+        WHERE (docbasetype = 'ARR'
+        OR docbasetype = 'APP')
+        AND dimension = 'BP'
+        AND show_in_header = 'N'
+        AND ad_client_id IN (
+            SELECT ad_client_id
+            FROM ad_client
+            WHERE acctdim_centrally_maintained = 'Y'
+        )
+      ]]>
+    </Sql>
+  </SqlMethod>
+  <SqlMethod name="isExecuted" type="preparedStatement" return="boolean">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql>
+      <![CDATA[
+        SELECT count(*) as exist
+        FROM DUAL
+        WHERE EXISTS (SELECT 1 FROM ad_preference
+                      WHERE attribute = 'PaymentBPClientDimensionUpdated')
+      ]]>
+    </Sql>
+  </SqlMethod>
+   <SqlMethod name="createPreference" type="preparedStatement" 
return="rowcount">
+      <SqlMethodComment></SqlMethodComment>
+       <Sql> 
+       <![CDATA[ 
+           INSERT INTO ad_preference (
+           ad_preference_id, ad_client_id, ad_org_id, isactive,
+           createdby, created, updatedby, updated,attribute
+           ) VALUES (
+           get_uuid(), '0', '0', 'Y', '0', NOW(), '0', 
NOW(),'PaymentBPClientDimensionUpdated')
+         ]]>
+        </Sql>
+   </SqlMethod>
+</SqlClass>

------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to