details:   https://code.openbravo.com/erp/devel/pi/rev/6d253677f642
changeset: 20166:6d253677f642
user:      David Miguelez <david.miguelez <at> openbravo.com>
date:      Fri Apr 19 15:14:43 2013 +0200
summary:   Fixes Issue 23594: The behaviour of the "Include Accounting" in IOS
window should change

diffstat:

 src/org/openbravo/erpCommon/ad_forms/InitialOrgSetup.html        |  19 ++++++
 src/org/openbravo/erpCommon/businessUtility/InitialOrgSetup.java |  31 
++++++++++
 2 files changed, 50 insertions(+), 0 deletions(-)

diffs (77 lines):

diff -r 6f099465923b -r 6d253677f642 
src/org/openbravo/erpCommon/ad_forms/InitialOrgSetup.html
--- a/src/org/openbravo/erpCommon/ad_forms/InitialOrgSetup.html Mon Apr 22 
11:03:54 2013 +0530
+++ b/src/org/openbravo/erpCommon/ad_forms/InitialOrgSetup.html Fri Apr 19 
15:14:43 2013 +0200
@@ -103,8 +103,27 @@
     }
     return true;
   }
+  
+  //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 runInitialOrgSetup() {
+    if(document.frmMain.inpCreateAccounting.checked == true && 
document.frmMain.inpFile.value == "" && !isReferenceDataSelected()) {
+        showJSMessage('CreateAccountingButNoCoAProvided');
+        setProcessingMode('window', false);
+        return false;
+    }
     setProcessingMode('window',true);
     submitCommandForm('OK',true);
     return false;
diff -r 6f099465923b -r 6d253677f642 
src/org/openbravo/erpCommon/businessUtility/InitialOrgSetup.java
--- a/src/org/openbravo/erpCommon/businessUtility/InitialOrgSetup.java  Mon Apr 
22 11:03:54 2013 +0530
+++ b/src/org/openbravo/erpCommon/businessUtility/InitialOrgSetup.java  Fri Apr 
19 15:14:43 2013 +0200
@@ -134,6 +134,15 @@
       return obResult;
     logEvent("@StartingOrg@" + NEW_LINE);
 
+    if (boCreateAccounting) {
+      if (fileCoAFilePath == null || fileCoAFilePath.getSize() < 1) {
+        log4j.debug("process() - Check COA");
+        obResult = coaModule(strModules);
+        if (!obResult.getType().equals(OKTYPE))
+          return obResult;
+      }
+    }
+
     log4j.debug("createOrganization() - Creating organization.");
     obResult = insertOrganization((strOrgName == null || 
strOrgName.equals("")) ? "newOrg"
         : strOrgName, strOrgType, strParentOrg, strcLocationId, strCurrency);
@@ -765,4 +774,26 @@
       return "";
   }
 
+  OBError coaModule(String strModules) {
+    strModules = cleanUpStrModules(strModules);
+    OBError obeResult = new OBError();
+    obeResult.setType(OKTYPE);
+    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 accounting module was chosen",
+            null);
+      }
+    } 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to