← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2133: Fixed bug <678431> Data browser PDF export does not save the file name correctly

 

------------------------------------------------------------
revno: 2133
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2010-11-22 16:54:30 +0700
message:
  Fixed bug <678431> Data browser PDF export does not save the file name correctly
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/databrowser/ExportPDFAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/databrowser/SearchAction.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/databrowser/ExportPDFAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/databrowser/ExportPDFAction.java	2010-10-21 05:41:06 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/databrowser/ExportPDFAction.java	2010-11-22 09:54:30 +0000
@@ -58,6 +58,10 @@
 
     private static final String KEY_DATABROWSERTABLE = "dataBrowserTableResults";
 
+    private static final String REGEX_EXTENSION_PDF = "\\.pdf";
+
+    private static final String EXTENSION_PDF = ".pdf";
+
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -117,14 +121,7 @@
 
     public void setFileName( String fileName )
     {
-        if ( fileName.endsWith( ".pdf" ) )
-        {
-            this.fileName = fileName.substring( 0, fileName.length() - 4 );
-        }
-        else
-        {
-            this.fileName = fileName;
-        }
+        this.fileName = fileName.replaceAll( REGEX_EXTENSION_PDF, "" ).concat( EXTENSION_PDF );
     }
 
     public String getFileName()

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/databrowser/SearchAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/databrowser/SearchAction.java	2010-11-17 06:42:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/databrowser/SearchAction.java	2010-11-22 09:54:30 +0000
@@ -441,7 +441,6 @@
 
                 dataBrowserTable = dataBrowserService.getCountDataElementsForDataSetInPeriod( parentInt, fromDate,
                     toDate, periodType, format );
-
             }
             else
             {