Fixed bug 20350: Included new AccountingTabs build validation
authorVíctor Martínez Romanos <victor.martinez@openbravo.com>
Wed, 09 May 2012 09:42:55 +0200
changeset 16549 7bd897420af5
parent 16548 aa69cbc6c4c7
child 16550 60b35ed88b24
Fixed bug 20350: Included new AccountingTabs build validation
It validates client data and introduce alerts in case any of the
new database contraints introduced in #13691 affect client data.

The Cbpvendoracct build validation has been removed because it has no
sense anymore since #13691
src-util/buildvalidation/build/classes/org/openbravo/buildvalidation/AccountingTabs.class
src-util/buildvalidation/build/classes/org/openbravo/buildvalidation/AccountingTabsData.class
src-util/buildvalidation/build/classes/org/openbravo/buildvalidation/Cbpvendoracct.class
src-util/buildvalidation/build/classes/org/openbravo/buildvalidation/CbpvendoracctData.class
src-util/buildvalidation/src/org/openbravo/buildvalidation/AccountingTabs.java
src-util/buildvalidation/src/org/openbravo/buildvalidation/AccountingTabs_data.xsql
src-util/buildvalidation/src/org/openbravo/buildvalidation/Cbpvendoracct.java
src-util/buildvalidation/src/org/openbravo/buildvalidation/Cbpvendoracct_data.xsql
Binary file src-util/buildvalidation/build/classes/org/openbravo/buildvalidation/AccountingTabs.class has changed
Binary file src-util/buildvalidation/build/classes/org/openbravo/buildvalidation/AccountingTabsData.class has changed
Binary file src-util/buildvalidation/build/classes/org/openbravo/buildvalidation/Cbpvendoracct.class has changed
Binary file src-util/buildvalidation/build/classes/org/openbravo/buildvalidation/CbpvendoracctData.class has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-util/buildvalidation/src/org/openbravo/buildvalidation/AccountingTabs.java	Wed May 09 09:42:55 2012 +0200
@@ -0,0 +1,117 @@
+/*
+ *************************************************************************
+ * 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) 2012 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.buildvalidation;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.openbravo.database.ConnectionProvider;
+
+/**
+ * This validation is related to this issue: https://issues.openbravo.com/view.php?id=13691
+ * C_BP_CUSTOMER_ACCT.C_BP_CUSTOMER_ACCT_BPARTNER_UN constraint, removed status column
+ * C_BP_VENDOR_ACCT.C_BP_VENDOR_ACCT_ACCTSCHEMA_UN constraint, removed status column
+ * C_BP_GROUP_ACCT.C_BP_GROUP_ACCT_SCHEM_GROUP_UN constraint added
+ */
+public class AccountingTabs extends BuildValidation {
+  private static final String alertGroupName = "Business Partner Category Duplicated Accounts";
+  private static final String alertCustomerName = "Customer Business Partner Duplicated Accounts";
+  private static final String alertVendorName = "Vendor Business Partner Duplicated Accounts";
+    
+  @Override
+  public List<String> execute() {
+    ConnectionProvider cp = getConnectionProvider();
+    ArrayList<String> errors = new ArrayList<String>();
+    try {
+      final int wrongGroupAcct = Integer.parseInt(AccountingTabsData.countWrongBPGroupAcct(cp));
+      final int wrongCustomerAcct = Integer.parseInt(AccountingTabsData.countWrongCustomerAcct(cp));
+      final int wrongVendorAcct = Integer.parseInt(AccountingTabsData.countWrongVendorAcct(cp));
+
+      if (wrongGroupAcct > 0 || wrongCustomerAcct > 0 || wrongVendorAcct > 0 ) {
+	  errors.add("You can not apply this MP because your instance fails in the pre-validation phase: ");
+
+	  if (wrongGroupAcct > 0) {
+        errors
+              .add("It is not allowed to have more than one entry in Business Partner Category ->  Accounting tab for the same accounting schema. Until 3.0MP11 it was allowed although it was wrong since the behaviour was unpredictable: any of the duplicated accounts could be used for the accounting of that business partner category. To fix this problem in your instance, you can know the duplicated entries by reviewing Alerts in your system (Alert Rule: "+ alertGroupName + "). Once you find the duplicated entries you should remove the wrong ones. After fixing all these entries you should be able to apply this MP.");
+
+	    if (AccountingTabsData.existsAlertRule(cp, alertGroupName).equals("0")) {
+	      final String alertRuleId = AccountingTabsData.getUUID(cp);
+	      AccountingTabsData.insertAlertRule(cp, alertRuleId, alertGroupName, "323", "select max(C_BP_Group_Acct_ID) as referencekey_id,  ad_column_identifier('C_BP_Group_Acct',max(C_BP_Group_Acct_ID),'en_US') as record_id, 0 as ad_role_id, null as ad_user_id, 'Duplicated accounting Configuration entry. Please ensure just one entry exists per accounting schema for this business partner category' as description, 'Y' as isActive, max(ad_org_id) as ad_org_id, max(ad_client_id) as ad_client_id, now() as created, 0 as createdBy,  now() as updated, 0 as updatedBy  from C_BP_Group_Acct p group by c_acctschema_id, c_bp_group_id having count(*)>1");	      
+          processAlert(alertRuleId, cp);
+	    }
+	  }
+
+	  if (wrongCustomerAcct > 0) {
+	    errors
+              .add("It is not allowed to have more than one entry in Business Partner -> Customer -> Customer Accounting tab for the same accounting schema. Until 3.0MP11 it was allowed although it was wrong since the behaviour was unpredictable: any of the duplicated accounts could be used for the accounting of that business partner. To fix this problem in your instance, you can know the duplicated entries by reviewing Alerts in your system (Alert Rule: "+ alertCustomerName + "). Once you find the duplicated entries you should remove the wrong ones. After fixing all these entries you should be able to apply this MP.");
+	      
+	    if (AccountingTabsData.existsAlertRule(cp, alertCustomerName).equals("0")) {
+	      final String alertRuleId = AccountingTabsData.getUUID(cp);
+	      AccountingTabsData.insertAlertRule(cp, alertRuleId, alertCustomerName, "212", "select max(C_BP_CUSTOMER_ACCT_ID) as referencekey_id, ad_column_identifier('C_BP_CUSTOMER_ACCT',max(C_BP_CUSTOMER_ACCT_ID),'en_US') as record_id, 0 as ad_role_id, null as ad_user_id, 'Duplicated accounting Configuration entry. Please ensure just one entry exists per accounting schema for this business partner (customer)' as description, 'Y' as isActive, max(ad_org_id) as ad_org_id, max(ad_client_id) as ad_client_id, now() as created, 0 as createdBy,  now() as updated, 0 as updatedBy  from C_BP_CUSTOMER_ACCT p group by c_acctschema_id, c_bpartner_id having count(*)>1");
+          processAlert(alertRuleId, cp);
+	    }
+	  }
+
+	  if (wrongVendorAcct > 0) {
+	    errors
+              .add("It is not allowed to have more than one entry in Business Partner -> Vendor -> Vendor Accounting tab for the same accounting schema. Until 3.0MP11 it was allowed although it was wrong since the behaviour was unpredictable: any of the duplicated accounts could be used for the accounting of that business partner. To fix this problem in your instance, you can know the duplicated entries by reviewing Alerts in your system (Alert Rule: "+ alertVendorName + "). Once you find the duplicated entries you should remove the wrong ones. After fixing all these entries you should be able to apply this MP.");
+	      
+	    if (AccountingTabsData.existsAlertRule(cp, alertVendorName).equals("0")) {
+	      final String alertRuleId = AccountingTabsData.getUUID(cp);
+	      AccountingTabsData.insertAlertRule(cp, alertRuleId, alertVendorName, "213", "select max(C_BP_VENDOR_ACCT_ID) as referencekey_id, ad_column_identifier('C_BP_VENDOR_ACCT',max(C_BP_VENDOR_ACCT_ID),'en_US') as record_id, 0 as ad_role_id, null as ad_user_id, 'Duplicated accounting Configuration entry. Please ensure just one entry exists per accounting schema for this business partner (vendor)' as description, 'Y' as isActive, max(ad_org_id) as ad_org_id, max(ad_client_id) as ad_client_id, now() as created, 0 as createdBy,  now() as updated, 0 as updatedBy  from C_BP_VENDOR_ACCT p group by c_acctschema_id, c_bpartner_id having count(*)>1");
+          processAlert(alertRuleId, cp);
+	    }
+	  }
+      }
+    } catch (Exception e) {
+      return handleError(e);
+    }
+    return errors;
+  }
+
+  /**
+   * @param alertRule
+   * @param conn
+   * @throws Exception
+   */
+  private void processAlert(String adAlertruleId, ConnectionProvider cp) throws Exception {
+    AccountingTabsData[] alertRule = AccountingTabsData.select(cp, adAlertruleId);
+    AccountingTabsData[] alert = null;
+    if (!alertRule[0].sql.equals("")) {
+      try {
+        alert = AccountingTabsData.selectAlert(cp, alertRule[0].sql);
+      } catch (Exception ex) {
+        return;
+      }
+    }
+    // Insert
+    if (alert != null && alert.length != 0) {
+      StringBuilder msg = new StringBuilder();
+
+      for (int i = 0; i < alert.length; i++) {
+        if (AccountingTabsData.existsReference(cp, adAlertruleId, alert[i].referencekeyId).equals(
+            "0")) {
+          AccountingTabsData.insertAlert(cp, alert[i].description, alertRule[0].adAlertruleId,
+              alert[i].recordId, alert[i].referencekeyId);
+        }
+      }
+    }
+  }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-util/buildvalidation/src/org/openbravo/buildvalidation/AccountingTabs_data.xsql	Wed May 09 09:42:55 2012 +0200
@@ -0,0 +1,151 @@
+<?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) 2012 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+-->
+
+
+<SqlClass name="AccountingTabsData" package="org.openbravo.buildvalidation">
+   <SqlMethod name="select" type="preparedStatement" return="multiple">
+      <SqlMethodComment></SqlMethodComment>
+      <Sql><![CDATA[
+        SELECT  AD_CLIENT_ID,
+                AD_ORG_ID,
+                CREATED,
+                CREATEDBY,
+                UPDATED,
+                UPDATEDBY,
+                ISACTIVE, 
+                '' as RECORD_ID,
+                '' as DESCRIPTION,
+                '' as REFERENCEKEY_ID, 
+                '' as AD_ROLE_ID,
+		        '' as RECORDS,
+		        '' as UUID, 
+                AD_ALERTRULE_ID,
+                SQL,
+                NAME
+          FROM AD_ALERTRULE
+	  WHERE AD_ALERTRULE_ID = ?
+    ]]></Sql>
+      <Parameter name="alertRule"/>
+   </SqlMethod>
+
+   <SqlMethod name="countWrongBPGroupAcct" type="preparedStatement" return="string">
+      <SqlMethodComment></SqlMethodComment>
+      <Sql><![CDATA[
+             select count(s.srows) as RECORDS
+             from ( select 1 as srows 
+                    FROM C_BP_GROUP_ACCT
+                    group by C_ACCTSCHEMA_ID, c_bp_group_id
+                    having count(*) > 1
+                  ) s
+      ]]></Sql>
+   </SqlMethod>
+   <SqlMethod name="countWrongCustomerAcct" type="preparedStatement" return="string">
+      <SqlMethodComment></SqlMethodComment>
+      <Sql><![CDATA[
+             select count(s.srows) as RECORDS
+             from ( select 1 as srows 
+                    from C_BP_CUSTOMER_ACCT
+                    group by C_ACCTSCHEMA_ID, c_bpartner_id
+                    having count(*) > 1
+                  ) s
+      ]]></Sql>
+   </SqlMethod>
+   <SqlMethod name="countWrongVendorAcct" type="preparedStatement" return="string">
+      <SqlMethodComment></SqlMethodComment>
+      <Sql><![CDATA[
+             select count(s.srows) as RECORDS
+             from ( select 1 as srows 
+                    from C_BP_VENDOR_ACCT
+                    group by C_ACCTSCHEMA_ID, c_bpartner_id
+                    having count(*) > 1
+                  ) s
+      ]]></Sql>
+   </SqlMethod>
+   <SqlMethod name="existsAlertRule" type="preparedStatement" return="string">
+      <SqlMethodComment></SqlMethodComment>
+      <Sql><![CDATA[
+          SELECT COUNT(*) AS EXISTING
+          FROM AD_ALERTRULE
+          WHERE NAME = ?
+          AND ISACTIVE = 'Y'
+      ]]></Sql>
+      <Parameter name="alertRuleName"/>
+   </SqlMethod>
+   <SqlMethod name="getUUID" type="preparedStatement" return="string">
+      <SqlMethodComment></SqlMethodComment>
+      <Sql><![CDATA[
+          SELECT get_uuid() as UUID
+            FROM dual
+      ]]></Sql>
+   </SqlMethod>
+
+   <SqlMethod name="insertAlertRule" type="preparedStatement" return="rowcount">
+      <SqlMethodComment></SqlMethodComment>
+      <Sql><![CDATA[
+         INSERT INTO AD_ALERTRULE (
+    AD_ALERTRULE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE,CREATED, CREATEDBY, UPDATED, UPDATEDBY,
+    NAME, AD_TAB_ID, FILTERCLAUSE, SQL, TYPE
+  )
+  VALUES (?, '0', '0', 'Y', now(), '100', now(), '100', 
+          ?, ?, '', ?, 'D')
+          ]]>
+      </Sql>
+      <Parameter name="alertRuleId"/>
+      <Parameter name="alertRuleName"/>
+      <Parameter name="tabId"/>
+      <Parameter name="sql"/>
+  </SqlMethod>
+   <SqlMethod name="existsReference" type="preparedStatement" return="string">
+      <SqlMethodComment></SqlMethodComment>
+      <Sql><![CDATA[
+          SELECT COUNT(*) AS EXISTING
+            FROM AD_ALERT
+           WHERE AD_ALERTRULE_ID = ?
+             AND REFERENCEKEY_ID = ?
+             AND STATUS != 'SOLVED'
+      ]]></Sql>
+      <Parameter name="alertRule"/>
+      <Parameter name="ref"/>      
+   </SqlMethod>
+   <SqlMethod name="insertAlert" type="preparedStatement"
+   	return="rowcount">
+   	<SqlMethodComment></SqlMethodComment>
+   	<Sql>
+   		<![CDATA[
+       INSERT INTO AD_Alert (AD_Alert_ID, AD_Client_ID, AD_Org_ID, IsActive, 
+                      Created, CreatedBy, Updated, UpdatedBy, Description, AD_AlertRule_ID, Record_Id, Referencekey_ID,
+                      status)
+      		VALUES (get_uuid(), '0', '0', 'Y', NOW(), '0', NOW(), '0', ?, ?, ?, ?, 'NEW')
+      ]]>
+   	</Sql>
+   	<Parameter name="description" />
+   	<Parameter name="adAlertRuleId" />
+   	<Parameter name="recordId" />
+   	<Parameter name="referencekey_id" />
+   </SqlMethod>   
+   <SqlMethod name="selectAlert" type="preparedStatement" return="multiple">
+      <SqlMethodComment></SqlMethodComment>
+      <Sql><![CDATA[
+          SELECT AAA.* 
+            FROM (SELECT '' AS DESCRIPTION, '' AS RECORD_ID, '' AS REFERENCEKEY_ID FROM DUAL) AAA 
+      ]]></Sql>
+      <Parameter name="sql" type="replace" optional="true" after="FROM (" text="SELECT '' AS DESCRIPTION, '' AS RECORD_ID, '' AS REFERENCEKEY_ID FROM DUAL"/>
+   </SqlMethod>
+</SqlClass>
--- a/src-util/buildvalidation/src/org/openbravo/buildvalidation/Cbpvendoracct.java	Tue May 15 18:21:40 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
- *************************************************************************
- * 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) 2010 Openbravo SLU
- * All Rights Reserved.
- * Contributor(s):  ______________________________________.
- ************************************************************************
- */
-package org.openbravo.buildvalidation;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.openbravo.database.ConnectionProvider;
-
-/**
- * This validation is related to this issue: https://issues.openbravo.com/view.php?id=12824 The
- * unique constraint C_BP_VENDOR_ACCT_ACCTSCHEMA_UN was made more restrictive, and it will fail if
- * the data is not correct and is not fixed before updating.
- */
-public class Cbpvendoracct extends BuildValidation {
-
-  @Override
-  public List<String> execute() {
-    ConnectionProvider cp = getConnectionProvider();
-    ArrayList<String> errors = new ArrayList<String>();
-    try {
-      int a = Integer.parseInt(CbpvendoracctData.countNoDistinct(cp));
-      int b = Integer.parseInt(CbpvendoracctData.countDistinct(cp));
-      if (a != b) {
-        errors
-            .add("You can not apply this MP because your instance fails in a pre-validation: from Openbravo 2.50 MP18 it is not allowed to have more than one entry in business partner ->  vendor ->  accounting tab with the same accounting schema and status. Untill MP18 it was allowed although it was wrong since the behaviour was unpredictable: any of the duplicated accounts could be used for the accounting of that business partner. To fix this problem in your instance, you can know the duplicated entries by reviewing Alerts in your system (Alert Rule: Vendor Duplicate Accounts). Once you find the duplicated entries you should remove the wrong ones. Once it is fixed you should be able to apply this MP.");
-        String alertRuleId = CbpvendoracctData.getUUID(cp);
-        if (CbpvendoracctData.existsAlertRule(cp).equals("0")) {
-          CbpvendoracctData.insertAlertRule(cp, alertRuleId);
-          processAlert(alertRuleId, cp);
-        }
-      }
-    } catch (Exception e) {
-      return handleError(e);
-    }
-    return errors;
-  }
-
-  /**
-   * @param alertRule
-   * @param conn
-   * @throws Exception
-   */
-  private void processAlert(String adAlertruleId, ConnectionProvider cp) throws Exception {
-    CbpvendoracctData[] alertRule = CbpvendoracctData.select(cp, adAlertruleId);
-    CbpvendoracctData[] alert = null;
-    if (!alertRule[0].sql.equals("")) {
-      try {
-        alert = CbpvendoracctData.selectAlert(cp, alertRule[0].sql);
-      } catch (Exception ex) {
-        return;
-      }
-    }
-    // Insert
-    if (alert != null && alert.length != 0) {
-      StringBuilder msg = new StringBuilder();
-      ;
-
-      for (int i = 0; i < alert.length; i++) {
-        if (CbpvendoracctData.existsReference(cp, adAlertruleId, alert[i].referencekeyId).equals(
-            "0")) {
-          CbpvendoracctData.insertAlert(cp, alert[i].description, alertRule[0].adAlertruleId,
-              alert[i].recordId, alert[i].referencekeyId);
-        }
-      }
-    }
-  }
-
-}
--- a/src-util/buildvalidation/src/org/openbravo/buildvalidation/Cbpvendoracct_data.xsql	Tue May 15 18:21:40 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-<?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) 2010-2011 Openbravo SLU
- * All Rights Reserved.
- * Contributor(s):  ______________________________________.
- ************************************************************************
--->
-
-
-<SqlClass name="CbpvendoracctData" package="org.openbravo.buildvalidation">
-   <SqlMethod name="select" type="preparedStatement" return="multiple">
-      <SqlMethodComment></SqlMethodComment>
-      <Sql><![CDATA[
-        SELECT  AD_CLIENT_ID,
-                AD_ORG_ID,
-                CREATED,
-                CREATEDBY,
-                UPDATED,
-                UPDATEDBY,
-                ISACTIVE, 
-                '' as RECORD_ID,
-                '' as DESCRIPTION,
-                '' as REFERENCEKEY_ID, 
-                '' as AD_ROLE_ID, 
-                AD_ALERTRULE_ID,
-                SQL,
-                NAME
-          FROM AD_ALERTRULE
-	  WHERE AD_ALERTRULE_ID = ?
-    ]]></Sql>
-      <Parameter name="alertRule"/>
-   </SqlMethod>
-   <SqlMethod name="existsAlertRule" type="preparedStatement" return="string">
-      <SqlMethodComment></SqlMethodComment>
-      <Sql><![CDATA[
-          SELECT COUNT(*) AS EXISTING
-            FROM AD_ALERTRULE
-           WHERE NAME LIKE 'Vendor Duplicate Accounts'
-             AND ISACTIVE = 'Y'
-      ]]></Sql>
-   </SqlMethod>
-   <SqlMethod name="existsReference" type="preparedStatement" return="string">
-      <SqlMethodComment></SqlMethodComment>
-      <Sql><![CDATA[
-          SELECT COUNT(*) AS EXISTING
-            FROM AD_ALERT
-           WHERE AD_ALERTRULE_ID = ?
-             AND REFERENCEKEY_ID = ?
-             AND STATUS != 'SOLVED'
-      ]]></Sql>
-      <Parameter name="alertRule"/>
-      <Parameter name="ref"/>      
-   </SqlMethod>
-   <SqlMethod name="getUUID" type="preparedStatement" return="string">
-      <SqlMethodComment></SqlMethodComment>
-      <Sql><![CDATA[
-          SELECT get_uuid()
-            FROM dual
-      ]]></Sql>
-   </SqlMethod>
-  <SqlMethod name="countNoDistinct" type="preparedStatement" return="string">
-      <SqlMethodComment>This query counts the number of rows in c_bp_vendor_acct</SqlMethodComment>
-      <Sql><![CDATA[
-         SELECT count(*) as count from (select c_acctschema_id, c_bpartner_id, status from c_bp_vendor_acct) a
-          ]]>
-      </Sql>
-  </SqlMethod>
-  <SqlMethod name="countDistinct" type="preparedStatement" return="string">
-      <SqlMethodComment>This query counts the number of unique combinations of (c_acctschema_id, c_bpartner_id, status) tuples in c_bp_vendor_acct</SqlMethodComment>
-      <Sql><![CDATA[
-         SELECT count(*) as count from (select distinct c_acctschema_id, c_bpartner_id, status from c_bp_vendor_acct) a
-          ]]>
-      </Sql>
-  </SqlMethod>
-  <SqlMethod name="insertAlertRule" type="preparedStatement" return="rowcount">
-      <SqlMethodComment></SqlMethodComment>
-      <Sql><![CDATA[
-         INSERT INTO AD_ALERTRULE (
-    AD_ALERTRULE_ID,
-    AD_CLIENT_ID   ,
-    AD_ORG_ID      ,
-    ISACTIVE       ,
-    CREATED        ,
-    CREATEDBY      ,
-    UPDATED        ,
-    UPDATEDBY      ,
-    NAME           ,
-    AD_TAB_ID      ,
-    FILTERCLAUSE   ,
-    SQL            ,
-    TYPE
-  )
-  VALUES (?, '0', '0', 'Y', now(), '100', now(), '100', 'Vendor Duplicate Accounts', '213', '', 
-  'select max(c_bp_vendor_acct_id) as referencekey_id, ad_column_identifier(''C_BP_Vendor_Acct'',max(C_BP_Vendor_Acct_ID),''en_US'') as record_id, 0 as ad_role_id, null as ad_user_id, ''Duplicated accounting Configuration entry. Please ensure just one entry exists per accounting schema and status for this business partner'' as description, ''Y'' as isActive, max(ad_org_id), max(ad_client_id), now() as created, 0 as createdBy,  now() as updated, 0 as updatedBy  from c_bp_vendor_acct p group by c_acctschema_id, c_bpartner_id, status having count(c_bp_vendor_acct_id)>1'
-  , 'D')
-          ]]>
-      </Sql>
-    <Parameter name="alertRuleId"/>
-  </SqlMethod>
-   <SqlMethod name="insertAlert" type="preparedStatement"
-   	return="rowcount">
-   	<SqlMethodComment></SqlMethodComment>
-   	<Sql>
-   		<![CDATA[
-       INSERT INTO AD_Alert (AD_Alert_ID, AD_Client_ID, AD_Org_ID, IsActive, 
-                      Created, CreatedBy, Updated, UpdatedBy, Description, AD_AlertRule_ID, Record_Id, Referencekey_ID,
-                      status)
-      		VALUES (get_uuid(), '0', '0', 'Y', NOW(), '0', NOW(), '0', ?, ?, ?, ?, 'NEW')
-      ]]>
-   	</Sql>
-   	<Parameter name="description" />
-   	<Parameter name="adAlertRuleId" />
-   	<Parameter name="recordId" />
-   	<Parameter name="referencekey_id" />
-   </SqlMethod>
-   
-   <SqlMethod name="selectAlert" type="preparedStatement" return="multiple">
-      <SqlMethodComment></SqlMethodComment>
-      <Sql><![CDATA[
-          SELECT AAA.* 
-            FROM (SELECT '' AS DESCRIPTION, '' AS RECORD_ID, '' AS REFERENCEKEY_ID FROM DUAL) AAA 
-      ]]></Sql>
-      <Parameter name="sql" type="replace" optional="true" after="FROM (" text="SELECT '' AS DESCRIPTION, '' AS RECORD_ID, '' AS REFERENCEKEY_ID FROM DUAL"/>
-   </SqlMethod>
-</SqlClass>