details:   https://code.openbravo.com/erp/devel/pi/rev/f063ce238a94
changeset: 14248:f063ce238a94
user:      Jon Alegría <jon.alegria <at> openbravo.com>
date:      Mon Nov 14 18:51:04 2011 +0100
summary:   Fixes issue 0019062: Report General Ledger shows a 
NullPointerException
The null pointer exception is solved. In html format, a warning is shown when
the fiscal year initial date can not be found regarding the date from selected
in the filter.

diffstat:

 src-db/database/sourcedata/AD_MESSAGE.xml                       |  11 +++
 src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedger.java |  35 +++------
 2 files changed, 23 insertions(+), 23 deletions(-)

diffs (96 lines):

diff -r 538dbb30856a -r f063ce238a94 src-db/database/sourcedata/AD_MESSAGE.xml
--- a/src-db/database/sourcedata/AD_MESSAGE.xml Mon Nov 14 15:40:16 2011 +0100
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml Mon Nov 14 18:51:04 2011 +0100
@@ -15037,6 +15037,17 @@
 <!--1BCCC42870244E12862BBB63BB64350B-->  
<AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--1BCCC42870244E12862BBB63BB64350B--></AD_MESSAGE>
 
+<!--1D9A15F68BC447C68725A544F8ED1719--><AD_MESSAGE>
+<!--1D9A15F68BC447C68725A544F8ED1719-->  
<AD_MESSAGE_ID><![CDATA[1D9A15F68BC447C68725A544F8ED1719]]></AD_MESSAGE_ID>
+<!--1D9A15F68BC447C68725A544F8ED1719-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--1D9A15F68BC447C68725A544F8ED1719-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--1D9A15F68BC447C68725A544F8ED1719-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--1D9A15F68BC447C68725A544F8ED1719-->  
<VALUE><![CDATA[InitialDateNotFoundCalendar]]></VALUE>
+<!--1D9A15F68BC447C68725A544F8ED1719-->  <MSGTEXT><![CDATA[The initial date 
for the fiscal calendar can not be retrieved. The initial balance could not 
show the real initial balance.]]></MSGTEXT>
+<!--1D9A15F68BC447C68725A544F8ED1719-->  <MSGTYPE><![CDATA[W]]></MSGTYPE>
+<!--1D9A15F68BC447C68725A544F8ED1719-->  
<AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--1D9A15F68BC447C68725A544F8ED1719--></AD_MESSAGE>
+
 <!--1DAB5DCDF04B4FEE97200DE4D2028FAB--><AD_MESSAGE>
 <!--1DAB5DCDF04B4FEE97200DE4D2028FAB-->  
<AD_MESSAGE_ID><![CDATA[1DAB5DCDF04B4FEE97200DE4D2028FAB]]></AD_MESSAGE_ID>
 <!--1DAB5DCDF04B4FEE97200DE4D2028FAB-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
diff -r 538dbb30856a -r f063ce238a94 
src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedger.java
--- a/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedger.java   Mon Nov 
14 15:40:16 2011 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedger.java   Mon Nov 
14 18:51:04 2011 +0100
@@ -244,9 +244,11 @@
     // String strTreeAccount = ReportTrialBalanceData.treeAccount(this, 
vars.getClient());
     String strOrgFamily = getFamily(strTreeOrg, strOrg);
     String strFinancialOrgFamily = getFinancialFamily(strTreeOrg, strOrg, 
vars.getClient());
-    String strYearInitialDate = ReportGeneralLedgerData.yearInitialDate(this,
+    String strExistsInitialDate = ReportGeneralLedgerData.yearInitialDate(this,
         vars.getSessionValue("#AD_SqlDateFormat"), strDateFrom,
         Utility.getContext(this, vars, "#User_Client", "ReportGeneralLedger"), 
strFinancialOrgFamily);
+    String strYearInitialDate = strDateFrom;
+    if (strExistsInitialDate.equals("")) strYearInitialDate = 
strExistsInitialDate;
     String toDatePlusOne = DateTimeData.nDaysAfter(this, strDateTo, "1");
 
     String strGroupByText = (strGroupBy.equals("BPartner") ? 
Utility.messageBD(this, "BusPartner",
@@ -267,16 +269,6 @@
           .prepareRelationBarTemplate(false, false,
               "submitCommandForm('XLS', false, frmMain, 
'ReportGeneralLedgerExcel.xls', 'EXCEL');return false;");
       data = ReportGeneralLedgerData.set();
-    } else if (strYearInitialDate.equals("")) {
-      xmlDocument.setParameter("messageType", "WARNING");
-      xmlDocument.setParameter("messageTitle", 
-          Utility.messageBD(this, "ProcessStatus-W", vars.getLanguage()));
-      xmlDocument.setParameter("messageMessage", 
-          Utility.messageBD(this, "PeriodNotFound", vars.getLanguage()));
-      toolbar
-          .prepareRelationBarTemplate(false, false,
-             "submitCommandForm('XLS', false, frmMain, 
'ReportGeneralLedgerExcel.xls', 'EXCEL');return false;");
-      data = ReportGeneralLedgerData.set();
     } else {
       String[] discard = { "discard" };
       if (strGroupBy.equals(""))
@@ -482,6 +474,13 @@
       log4j.debug("data.length: " + data.length);
 
     if (data != null && data.length > 0) {
+      if (strExistsInitialDate.equals("") && vars.commandIn("FIND")) {
+        xmlDocument.setParameter("messageType", "WARNING");
+        xmlDocument.setParameter("messageTitle",
+           Utility.messageBD(this, "ProcessStatus-W", vars.getLanguage()));
+        xmlDocument.setParameter("messageMessage",
+           Utility.messageBD(this, "InitialDateNotFoundCalendar", 
vars.getLanguage()));
+      }
       if (strGroupBy.equals(""))
         xmlDocument.setData("structure1", data);
       else
@@ -527,12 +526,7 @@
     String strYearInitialDate = ReportGeneralLedgerData.yearInitialDate(this,
         vars.getSessionValue("#AD_SqlDateFormat"), strDateFrom,
         Utility.getContext(this, vars, "#User_Client", "ReportGeneralLedger"), 
strFinancialOrgFamily);
-    if (strYearInitialDate.equals("")) {
-      advisePopUp(request, response, "WARNING",
-          Utility.messageBD(this, "ProcessStatus-W", vars.getLanguage()),
-          Utility.messageBD(this, "PeriodNotFound", vars.getLanguage()));
-
-    }
+    if (strYearInitialDate.equals("")) strYearInitialDate = strDateFrom;
     String toDatePlusOne = DateTimeData.nDaysAfter(this, strDateTo, "1");
 
     String strGroupByText = (strGroupBy.equals("BPartner") ? 
Utility.messageBD(this, "BusPartner",
@@ -634,12 +628,7 @@
     String strYearInitialDate = ReportGeneralLedgerData.yearInitialDate(this,
         vars.getSessionValue("#AD_SqlDateFormat"), strDateFrom,
         Utility.getContext(this, vars, "#User_Client", "ReportGeneralLedger"), 
strFinancialOrgFamily);
-    if (strYearInitialDate.equals("")) {
-      advisePopUp(request, response, "WARNING",
-          Utility.messageBD(this, "ProcessStatus-W", vars.getLanguage()),
-          Utility.messageBD(this, "PeriodNotFound", vars.getLanguage()));
-
-    }
+    if (strYearInitialDate.equals("")) strYearInitialDate = strDateFrom;
     String toDatePlusOne = DateTimeData.nDaysAfter(this, strDateTo, "1");
 
     String strAllaccounts = "Y";

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to