details: https://code.openbravo.com/erp/devel/pi/rev/68f4bfe6d0cd changeset: 20147:68f4bfe6d0cd user: Pandeeswari Ramakrishnan <pandeeswari.ramakrishnan <at> openbravo.com> date: Thu Apr 11 13:33:00 2013 +0530 summary: Fixes issue 22565: The behaviour of the "Include Accounting" in ICS window should change
details: https://code.openbravo.com/erp/devel/pi/rev/9534810b6032 changeset: 20148:9534810b6032 user: Sandra Huguet <sandra.huguet <at> openbravo.com> date: Tue Apr 16 10:32:29 2013 +0200 summary: Related to issue 22565 diffstat: src/org/openbravo/erpCommon/ad_forms/InitialClientSetup.html | 21 ++++++- src/org/openbravo/erpCommon/businessUtility/InitialClientSetup.java | 30 +++++++++- 2 files changed, 49 insertions(+), 2 deletions(-) diffs (84 lines): diff -r 468cdf851655 -r 9534810b6032 src/org/openbravo/erpCommon/ad_forms/InitialClientSetup.html --- a/src/org/openbravo/erpCommon/ad_forms/InitialClientSetup.html Fri Apr 19 12:52:05 2013 +0200 +++ b/src/org/openbravo/erpCommon/ad_forms/InitialClientSetup.html Tue Apr 16 10:32:29 2013 +0200 @@ -13,7 +13,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) 2001-2012 Openbravo SLU + * All portions are Copyright (C) 2001-2013 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -82,7 +82,26 @@ } } +//Checks whether any of the reference data is selected +function isReferenceDataSelected() { + var boxes = gt_getElementsByName("inpNodes", "input"); + for (i = 0; i < boxes.length; i++) { + if (boxes[i].disabled == true) { + continue; + } + if (boxes[i].checked == true) { + return true; + } + } + return false; +} + function runInitialClientSetup(){ + if(document.frmMain.inpCreateAccounting.checked == true && document.frmMain.inpFile.value == "" && !isReferenceDataSelected()) { + showJSMessage('CreateAccountingButNoCoAProvided'); + setProcessingMode('window', false); + return false; + } if (checkWarningModules()) { setProcessingMode('window',true); submitCommandForm('OK',true); diff -r 468cdf851655 -r 9534810b6032 src/org/openbravo/erpCommon/businessUtility/InitialClientSetup.java --- a/src/org/openbravo/erpCommon/businessUtility/InitialClientSetup.java Fri Apr 19 12:52:05 2013 +0200 +++ b/src/org/openbravo/erpCommon/businessUtility/InitialClientSetup.java Tue Apr 16 10:32:29 2013 +0200 @@ -108,7 +108,14 @@ return logErrorAndRollback("@CreateClientFailed@", "process() - Cannot determine currency.", e); } - + if (bCreateAccounting) { + if (fileCoAFilePath == null || fileCoAFilePath.getSize() < 1) { + log4j.debug("process() - Check COA"); + obeResult = coaModule(strModules); + if (!obeResult.getType().equals(STRMESSAGEOK)) + return obeResult; + } + } log4j.debug("process() - Creating client."); obeResult = insertClient(vars, strClientName, strClientUser, strCurrencyID); if (!obeResult.getType().equals(STRMESSAGEOK)) @@ -783,4 +790,25 @@ return logErrorAndRollback(strMessage, strLogError, null); } + OBError coaModule(String strModules) { + strModules = cleanUpStrModules(strModules); + OBError obeResult = new OBError(); + obeResult.setType(STRMESSAGEOK); + List<Module> lCoaModules = null; + try { + lCoaModules = InitialSetupUtility.getCOAModules(strModules); + // Modules with CoA are retrieved. + if (lCoaModules.size() < 1) { + + return logErrorAndRollback( + "@CreateReferenceDataFailed@. @CreateAccountingButNoCoAProvided@", + "createReferenceData() - Create accounting option was active, but no file was provided, and no accoutning module was chosen"); + } + } catch (Exception e) { + return logErrorAndRollback("@CreateReferenceDataFailed@", + "createReferenceData() - Exception while processing accounting modules", e); + } + return obeResult; + } + } ------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits