details: /erp/devel/main/rev/76c2e9c11f32 changeset: 7903:76c2e9c11f32 user: Víctor Martínez Romanos <victor.martinez <at> openbravo.com> date: Wed Jul 14 10:41:52 2010 +0200 summary: Fixed bug 13941: Initial Client Setup, several new requirements: Important datasets (core) selected by default Reference data checkbox has the following structure: <Reference data description> - <Module name> - <Module language> Display a confirmation in case any important dataset is not selected
details: /erp/devel/main/rev/ffcd5a96a0e4 changeset: 7904:ffcd5a96a0e4 user: RM packaging bot <staff.rm <at> openbravo.com> date: Wed Jul 14 16:58:55 2010 +0000 summary: CI: promote changesets from pi to main details: /erp/devel/main/rev/9567b78e2de6 changeset: 7905:9567b78e2de6 user: RM packaging bot <staff.rm <at> openbravo.com> date: Wed Jul 14 16:58:56 2010 +0000 summary: CI: update AD_MODULE - Core version and label diffstat: src-db/database/model/functions/AD_MODULE_CHECKED.xml | 42 +++++ src-db/database/model/functions/AD_MODULE_IDENTIFIER.xml | 48 ++++++ src-db/database/sourcedata/AD_MESSAGE.xml | 11 + src-db/database/sourcedata/AD_MODULE.xml | 5 +- src/org/openbravo/erpCommon/ad_forms/InitialClientSetup.html | 76 +++++++++- src/org/openbravo/erpCommon/ad_forms/InitialClientSetup.java | 30 +- src/org/openbravo/erpCommon/modules/ModuleReferenceDataClientTree_data.xsql | 5 +- src/org/openbravo/erpCommon/utility/GenericTree.srpt | 2 +- src/org/openbravo/erpCommon/utility/GenericTree.xml | 1 + 9 files changed, 199 insertions(+), 21 deletions(-) diffs (truncated from 325 to 300 lines): diff -r 4a73659a9927 -r 9567b78e2de6 src-db/database/model/functions/AD_MODULE_CHECKED.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src-db/database/model/functions/AD_MODULE_CHECKED.xml Wed Jul 14 16:58:56 2010 +0000 @@ -0,0 +1,42 @@ +<?xml version="1.0"?> + <database name="FUNCTION AD_MODULE_CHECKED"> + <function name="AD_MODULE_CHECKED" type="VARCHAR"> + <parameter name="p_module_id" type="VARCHAR" mode="in"> + <default/> + </parameter> + <body><![CDATA[/************************************************************************* +* 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) 2010 Openbravo SLU +* All Rights Reserved. +* Contributor(s): ______________________________________. +************************************************************************/ +/************************************************************************* +* Title: Returns true in case the module must be checked by default in the +* apply dataset windows (like the Initial Client/Org setup) +************************************************************************/ + +BEGIN + IF (p_module_id = null) THEN + RETURN 'false'; + ELSIF (p_module_id = '0') THEN + RETURN 'true'; + ELSE + -- TODO implement business logic when defined + RETURN 'false'; + END IF; + + EXCEPTION WHEN OTHERS THEN RETURN 'false'; +END AD_MODULE_CHECKED +]]></body> + </function> + </database> diff -r 4a73659a9927 -r 9567b78e2de6 src-db/database/model/functions/AD_MODULE_IDENTIFIER.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src-db/database/model/functions/AD_MODULE_IDENTIFIER.xml Wed Jul 14 16:58:56 2010 +0000 @@ -0,0 +1,48 @@ +<?xml version="1.0"?> + <database name="FUNCTION AD_MODULE_IDENTIFIER"> + <function name="AD_MODULE_IDENTIFIER" type="VARCHAR"> + <parameter name="p_module_id" type="VARCHAR" mode="in"> + <default/> + </parameter> + <parameter name="p_language" type="VARCHAR" mode="in"> + <default/> + </parameter> + <body><![CDATA[/************************************************************************* +* 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) 2010 Openbravo SLU +* All Rights Reserved. +* Contributor(s): ______________________________________. +************************************************************************/ +/************************************************************************* +* Title: Returns the identifier to be used in the Initial Client Setup +* The identifier is: +* <Reference data description> - <Module name> - <Module language> +************************************************************************/ + v_identifier VARCHAR2(2130); +BEGIN + SELECT TO_CHAR(COALESCE(TO_CHAR(T.ReferenceDataInfo) ||' - ','')) || TO_CHAR(COALESCE(TO_CHAR(T.Name),'')) ||' - '|| + COALESCE ((SELECT TO_CHAR(COALESCE(TO_CHAR(TT.Name),'')) + FROM AD_Language TT + WHERE TT.AD_Language=T.AD_Language),'') AS COLUMN_IDENTIFIER + INTO v_identifier + FROM (SELECT AD_LANGUAGE + FROM AD_LANGUAGE WHERE AD_LANGUAGE=p_language + ) L, + AD_Module T + WHERE AD_Module_ID=p_module_id; + + RETURN v_identifier; +END AD_MODULE_IDENTIFIER +]]></body> + </function> + </database> diff -r 4a73659a9927 -r 9567b78e2de6 src-db/database/sourcedata/AD_MESSAGE.xml --- a/src-db/database/sourcedata/AD_MESSAGE.xml Tue Jul 13 18:14:24 2010 +0200 +++ b/src-db/database/sourcedata/AD_MESSAGE.xml Wed Jul 14 16:58:56 2010 +0000 @@ -31559,6 +31559,17 @@ <!--7BF4B33E022E407BB6615E106AC7A8A6--> <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID> <!--7BF4B33E022E407BB6615E106AC7A8A6--></AD_MESSAGE> +<!--7DB7D480F58F4D3BB81F13B6BDE62AE5--><AD_MESSAGE> +<!--7DB7D480F58F4D3BB81F13B6BDE62AE5--> <AD_MESSAGE_ID><![CDATA[7DB7D480F58F4D3BB81F13B6BDE62AE5]]></AD_MESSAGE_ID> +<!--7DB7D480F58F4D3BB81F13B6BDE62AE5--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> +<!--7DB7D480F58F4D3BB81F13B6BDE62AE5--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID> +<!--7DB7D480F58F4D3BB81F13B6BDE62AE5--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> +<!--7DB7D480F58F4D3BB81F13B6BDE62AE5--> <VALUE><![CDATA[JS30]]></VALUE> +<!--7DB7D480F58F4D3BB81F13B6BDE62AE5--> <MSGTEXT><![CDATA[You have not selected important dataset(s). After your client is created, you will need to complete its configuration by either applying a dataset to one of its organization or performing the configuration manually. Do you want to continue?]]></MSGTEXT> +<!--7DB7D480F58F4D3BB81F13B6BDE62AE5--> <MSGTYPE><![CDATA[C]]></MSGTYPE> +<!--7DB7D480F58F4D3BB81F13B6BDE62AE5--> <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID> +<!--7DB7D480F58F4D3BB81F13B6BDE62AE5--></AD_MESSAGE> + <!--7FD28F8FE35B492FA9200FF14D0A7749--><AD_MESSAGE> <!--7FD28F8FE35B492FA9200FF14D0A7749--> <AD_MESSAGE_ID><![CDATA[7FD28F8FE35B492FA9200FF14D0A7749]]></AD_MESSAGE_ID> <!--7FD28F8FE35B492FA9200FF14D0A7749--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> diff -r 4a73659a9927 -r 9567b78e2de6 src-db/database/sourcedata/AD_MODULE.xml --- a/src-db/database/sourcedata/AD_MODULE.xml Tue Jul 13 18:14:24 2010 +0200 +++ b/src-db/database/sourcedata/AD_MODULE.xml Wed Jul 14 16:58:56 2010 +0000 @@ -6,7 +6,7 @@ <!--0--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID> <!--0--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> <!--0--> <NAME><![CDATA[core]]></NAME> -<!--0--> <VERSION><![CDATA[2.50.17732]]></VERSION> +<!--0--> <VERSION><![CDATA[2.50.17904]]></VERSION> <!--0--> <DESCRIPTION><![CDATA[Core module is the base one]]></DESCRIPTION> <!--0--> <HELP><![CDATA[Core module is the base one, all developments in core are included as part of the standard Openbravo ERP.]]></HELP> <!--0--> <URL><![CDATA[www.openbravo.com]]></URL> @@ -21,7 +21,8 @@ <!--0--> <HASCHARTOFACCOUNTS><![CDATA[N]]></HASCHARTOFACCOUNTS> <!--0--> <ISTRANSLATIONMODULE><![CDATA[N]]></ISTRANSLATIONMODULE> <!--0--> <HASREFERENCEDATA><![CDATA[Y]]></HASREFERENCEDATA> -<!--0--> <VERSION_LABEL><![CDATA[dev]]></VERSION_LABEL> +<!--0--> <REFERENCEDATAINFO><![CDATA[Standard document types for orders, invoices, etc. and settings]]></REFERENCEDATAINFO> +<!--0--> <VERSION_LABEL><![CDATA[CI]]></VERSION_LABEL> <!--0--> <ISCOMMERCIAL><![CDATA[N]]></ISCOMMERCIAL> <!--0--></AD_MODULE> diff -r 4a73659a9927 -r 9567b78e2de6 src/org/openbravo/erpCommon/ad_forms/InitialClientSetup.html --- a/src/org/openbravo/erpCommon/ad_forms/InitialClientSetup.html Tue Jul 13 18:14:24 2010 +0200 +++ b/src/org/openbravo/erpCommon/ad_forms/InitialClientSetup.html Wed Jul 14 16:58:56 2010 +0000 @@ -63,6 +63,80 @@ } function onloadFunctions() { + initialCheckModules(); + // Override gt_checkToggleNode() function used at onclick event + override_gt_checkToggleNode(); +} + +var warningModules = new Array(); + +function initialCheckModules() { + var inputs = gt_getElementsByName('inpNodes','input'); + for (var i=0; i<inputs.length; i++) { + if (inputs[i].getAttribute('type') == 'checkbox') { + if (inputs[i].getAttribute('defaultchecked') == 'true') { + inputs[i].checked = true; + } else if (inputs[i].getAttribute('defaultchecked') == 'false') { + inputs[i].checked = false; + } + } + } +} + +function runInitialClientSetup(){ + if (checkWarningModules()) { + setProcessingMode('window',true); + submitCommandForm('OK',true); + return false; + } +} + +function override_gt_checkToggleNode() { + window['original_gt_checkToggleNode'] = window['gt_checkToggleNode']; + + window['gt_checkToggleNode']= function(element, type, isClick){ + var allowChange = true; + var node = gt_returnNodeObject(element, type); + if (typeof node != "undefined") { + var nodeId = node.getAttribute('id').replace('node_',''); + var module = document.getElementById('inpNodes_' + nodeId); + if (module && module.getAttribute('type') == 'checkbox') { + var defaultChecked = module.getAttribute('defaultchecked'); + var newChecked = module.checked; + if (defaultChecked == 'true') { + if (!newChecked) { + addWarningModules(module); + } else { + removeWarningModules(module); + } + } + if (allowChange) { + original_gt_checkToggleNode(element, type, isClick); + } + } + } + } +} + +function addWarningModules(module) { + warningModules.unshift(module); +} + +function removeWarningModules(module) { + for (var i = 0; i < warningModules.length; i++) { + if (warningModules[i] == module) { + warningModules.splice(i, 1); + } + } +} + + +function checkWarningModules() { + if (warningModules.length > 0) { + return showJSMessage('30', defaultLang, null); + } else { + return true; + } } </script> <script language="JavaScript" type="text/javascript"> @@ -450,7 +524,7 @@ <button type="button" id="buttonOK" class="ButtonLink" - onclick="setProcessingMode('window',true);submitCommandForm('OK',true);return false;" + onclick="runInitialClientSetup();" onfocus="buttonEvent('onfocus', this); window.status='Accept'; return true;" onblur="buttonEvent('onblur', this);" onkeyup="buttonEvent('onkeyup', this);" diff -r 4a73659a9927 -r 9567b78e2de6 src/org/openbravo/erpCommon/ad_forms/InitialClientSetup.java --- a/src/org/openbravo/erpCommon/ad_forms/InitialClientSetup.java Tue Jul 13 18:14:24 2010 +0200 +++ b/src/org/openbravo/erpCommon/ad_forms/InitialClientSetup.java Wed Jul 14 16:58:56 2010 +0000 @@ -93,23 +93,23 @@ } catch (Exception ex) { throw new ServletException(ex); } - { - vars.removeMessage("InitialClientSetup"); - OBError myMessage = vars.getMessage("InitialClientSetup"); - if (myMessage != null) { - xmlDocument.setParameter("messageType", myMessage.getType()); - xmlDocument.setParameter("messageTitle", myMessage.getTitle()); - xmlDocument.setParameter("messageMessage", myMessage.getMessage()); - } - xmlDocument.setParameter("moduleTree", tree.toHtml()); - xmlDocument.setParameter("moduleTreeDescription", tree.descriptionToHtml()); - xmlDocument.setData("reportCurrency", "liststructure", MonedaComboData.select(this)); - response.setContentType("text/html; charset=UTF-8"); - PrintWriter out = response.getWriter(); - out.println(xmlDocument.print()); - out.close(); + vars.removeMessage("InitialClientSetup"); + OBError myMessage = vars.getMessage("InitialClientSetup"); + if (myMessage != null) { + xmlDocument.setParameter("messageType", myMessage.getType()); + xmlDocument.setParameter("messageTitle", myMessage.getTitle()); + xmlDocument.setParameter("messageMessage", myMessage.getMessage()); } + xmlDocument.setParameter("moduleTree", tree.toHtml()); + xmlDocument.setParameter("moduleTreeDescription", tree.descriptionToHtml()); + + xmlDocument.setData("reportCurrency", "liststructure", MonedaComboData.select(this)); + response.setContentType("text/html; charset=UTF-8"); + PrintWriter out = response.getWriter(); + out.println(xmlDocument.print()); + out.close(); + } private void printPageResult(HttpServletResponse response, VariablesSecureApp vars, diff -r 4a73659a9927 -r 9567b78e2de6 src/org/openbravo/erpCommon/modules/ModuleReferenceDataClientTree_data.xsql --- a/src/org/openbravo/erpCommon/modules/ModuleReferenceDataClientTree_data.xsql Tue Jul 13 18:14:24 2010 +0200 +++ b/src/org/openbravo/erpCommon/modules/ModuleReferenceDataClientTree_data.xsql Wed Jul 14 16:58:56 2010 +0000 @@ -12,7 +12,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2008 Openbravo SLU + * All portions are Copyright (C) 2008-2010 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -24,11 +24,12 @@ <SqlMethod name="select" type="preparedStatement" return="multiple"> <SqlMethodComment></SqlMethodComment> <Sql> - SELECT Type, M.AD_Module_ID as Node_ID, AD_Column_Identifier('AD_Module',M.AD_Module_ID, ?) as Name, + SELECT Type, M.AD_Module_ID as Node_ID, RPAD(AD_MODULE_IDENTIFIER(M.AD_Module_ID, ?), 90) as Name, (SELECT CASE WHEN COUNT(*)>0 THEN 'block' ELSE 'none' END FROM AD_Module_Dependency WHERE AD_Module_ID = M.AD_Module_ID AND IsIncluded = 'Y') as display, + AD_MODULE_CHECKED(M.AD_Module_ID) as defaultchecked, '' as linkClick, ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits