details: https://code.openbravo.com/erp/devel/main/rev/e0d914c1efd1 changeset: 15709:e0d914c1efd1 user: Javier Etxarri <javier.echarri <at> openbravo.com> date: Wed Mar 21 10:29:38 2012 +0100 summary: Fixes issue 19697: It is not possible to create a Campaign, see error attached. Also complete the issue 18407
details: https://code.openbravo.com/erp/devel/main/rev/f5fe379ed93a changeset: 15710:f5fe379ed93a user: Javier Etxarri <javier.echarri <at> openbravo.com> date: Wed Mar 21 11:40:03 2012 +0100 summary: issue 19697, issue 18407. Changed the method selectClientsID to have better performance and only update the neccesary clients diffstat: src-util/modulescript/build/classes/org/openbravo/modulescript/UpdateADClientInfo.class | 0 src-util/modulescript/build/classes/org/openbravo/modulescript/UpdateADClientInfoData.class | 0 src-util/modulescript/src/org/openbravo/modulescript/UpdateADClientInfo.java | 39 +++++++ src-util/modulescript/src/org/openbravo/modulescript/UpdateADClientInfo_data.xsql | 50 ++++++++++ 4 files changed, 89 insertions(+), 0 deletions(-) diffs (102 lines): diff -r 799471bc25a1 -r f5fe379ed93a src-util/modulescript/build/classes/org/openbravo/modulescript/UpdateADClientInfo.class Binary file src-util/modulescript/build/classes/org/openbravo/modulescript/UpdateADClientInfo.class has changed diff -r 799471bc25a1 -r f5fe379ed93a src-util/modulescript/build/classes/org/openbravo/modulescript/UpdateADClientInfoData.class Binary file src-util/modulescript/build/classes/org/openbravo/modulescript/UpdateADClientInfoData.class has changed diff -r 799471bc25a1 -r f5fe379ed93a src-util/modulescript/src/org/openbravo/modulescript/UpdateADClientInfo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src-util/modulescript/src/org/openbravo/modulescript/UpdateADClientInfo.java Wed Mar 21 11:40:03 2012 +0100 @@ -0,0 +1,39 @@ +/* + ************************************************************************* + * 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.modulescript; + +import org.openbravo.database.ConnectionProvider; + +public class UpdateADClientInfo extends ModuleScript { + + //This module script has ben created due to issue 18407 and related to issue 19697 + @Override + public void execute() { + try { + ConnectionProvider cp = getConnectionProvider(); + UpdateADClientInfoData[] clientsID = UpdateADClientInfoData.selectClientsID(cp); + + for (UpdateADClientInfoData clientID : clientsID) { + UpdateADClientInfoData.update(cp,clientID.adClientId); + } + } catch (Exception e) { + handleError(e); + } + } +} \ No newline at end of file diff -r 799471bc25a1 -r f5fe379ed93a src-util/modulescript/src/org/openbravo/modulescript/UpdateADClientInfo_data.xsql --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src-util/modulescript/src/org/openbravo/modulescript/UpdateADClientInfo_data.xsql Wed Mar 21 11:40:03 2012 +0100 @@ -0,0 +1,50 @@ +<?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="UpdateADClientInfoData" package="org.openbravo.modulescript"> + <SqlClassComment></SqlClassComment> + <SqlMethod name="select" type="preparedStatement" return="multiple"> + <SqlMethodComment></SqlMethodComment> + <Sql><![CDATA[ + SELECT '' as ad_client_id FROM DUAL; + ]]> + </Sql> + </SqlMethod> + <SqlMethod name="update" type="preparedStatement" return="rowcount"> + <SqlMethodComment></SqlMethodComment> + <Sql><![CDATA[ + UPDATE AD_CLIENTINFO SET AD_TREE_CAMPAIGN_ID = + (SELECT AD_TREE_ID FROM AD_TREE T + WHERE TREETYPE = 'MC' AND AD_CLIENT_ID = ?) + WHERE AD_CLIENT_ID = ? + ]]> + </Sql> + <Parameter name="clientID"/> + <Parameter name="clientID"/> + </SqlMethod> + <SqlMethod name="selectClientsID" type="preparedStatement" return="multiple"> + <SqlMethodComment></SqlMethodComment> + <Sql><![CDATA[ + SELECT AD_CLIENT_ID + FROM AD_CLIENTINFO CI + WHERE CI.AD_TREE_CAMPAIGN_ID IS NULL AND CI.AD_CLIENT_ID <> '0' + ]]> + </Sql> + </SqlMethod> +</SqlClass> ------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure _______________________________________________ Openbravo-commits mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbravo-commits
