Related to issue 19362: Improving quality of code in response to code review
authorGuillermo Álvarez de Eulate <guillermo.alvarez@openbravo.com>
Thu, 26 Apr 2012 12:02:01 +0200
changeset 16218 6f9831dd17ba
parent 16216 86fe6f8c5c29
child 16219 c88ce1de44de
Related to issue 19362: Improving quality of code in response to code review
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-view-manager.js
src/org/openbravo/erpCommon/ad_actionButton/Posted.java
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-view-manager.js	Wed Apr 25 20:29:57 2012 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-view-manager.js	Thu Apr 26 12:02:01 2012 +0200
@@ -231,7 +231,7 @@
     // to initialize an instance.
     //
     openView: function (viewName, params, state) {
-
+      var recentObjProperties;
       params = params || {};
 
       // only add closable views to the recent items, this prevents the workspace
@@ -248,7 +248,7 @@
           params.viewId = viewName;
         }
         //If recents receives null in params the tab is not added to the recent list
-        var recentObjProperties = null;
+        recentObjProperties = null;
         if (params.addToRecents === undefined || params.addToRecents === null || params.addToRecents === true) {
           // add and set a default icon
           recentObjProperties = isc.addProperties({
--- a/src/org/openbravo/erpCommon/ad_actionButton/Posted.java	Wed Apr 25 20:29:57 2012 +0200
+++ b/src/org/openbravo/erpCommon/ad_actionButton/Posted.java	Thu Apr 26 12:02:01 2012 +0200
@@ -53,6 +53,7 @@
     if (log4j.isDebugEnabled())
       log4j.debug("Posted: doPost");
 
+    final String generalLedgerJournalReport_ID = "800000";
     VariablesSecureApp vars = new VariablesSecureApp(request);
 
     if (vars.commandIn("DEFAULT")) {
@@ -71,7 +72,6 @@
       printPage(response, vars, strKey, strWindowId, strTabId, strProcessId, strTableId,
           strForcedTableId, strPath, strTabName, strPosted);
     } else if (vars.commandIn("SAVE")) {
-
       String strKey = vars.getRequiredGlobalVariable("inpKey", "Posted|key");
       String strTableId = vars.getRequiredGlobalVariable("inpTableId", "Posted|tableId");
       String strTabId = vars.getRequestGlobalVariable("inpTabId", "Posted|tabId");
@@ -98,9 +98,15 @@
             vars.setMessage(strTabId, messageResult);
             printPageClosePopUp(response, vars);
           } else {
-            String title = "POST";
+            String title;
             OBContext.setAdminMode();
-            title = OBDal.getInstance().get(Process.class, "800000").getIdentifier();
+            Process genLedJour = OBDal.getInstance().get(Process.class,
+                generalLedgerJournalReport_ID);
+            if (genLedJour != null) {
+              title = genLedJour.getIdentifier();
+            } else {
+              title = "POST";
+            }
             printPageClosePopUp(response, vars, strDireccion
                 + "/ad_reports/ReportGeneralLedgerJournal.html?Command=DIRECT&inpTable="
                 + strTableId + "&inpRecord=" + strKey + "&inpOrg=" + data[0].org, title);
@@ -120,9 +126,15 @@
                 Utility.translateError(this, vars, vars.getLanguage(), "NoFactAcct"));
             printPageClosePopUp(response, vars);
           } else {
-            String title = "POST";
+            String title;
             OBContext.setAdminMode();
-            title = OBDal.getInstance().get(Process.class, "800000").getIdentifier();
+            Process genLedJour = OBDal.getInstance().get(Process.class,
+                generalLedgerJournalReport_ID);
+            if (genLedJour != null) {
+              title = genLedJour.getIdentifier();
+            } else {
+              title = "POST";
+            }
             printPageClosePopUp(response, vars, strDireccion
                 + "/ad_reports/ReportGeneralLedgerJournal.html?Command=DIRECT&inpTable="
                 + strTableId + "&inpRecord=" + strKey + "&inpOrg=" + data[0].org, title);