← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20240: PDF Form download changed as attachment file download. A bug fix on service to have number field...

 

------------------------------------------------------------
revno: 20240
committer: James Chang <jamesbchang@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2015-09-19 00:14:30 -0700
message:
  PDF Form download changed as attachment file download.  A bug fix on service to have number field not overwrite text field.
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/pdfform/DefaultPdfDataEntryFormService.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/PdfFormController.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-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/pdfform/DefaultPdfDataEntryFormService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/pdfform/DefaultPdfDataEntryFormService.java	2015-09-13 21:54:23 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/pdfform/DefaultPdfDataEntryFormService.java	2015-09-19 07:14:30 +0000
@@ -289,7 +289,7 @@
                 {
                     addCell_WithCheckBox( table, writer, PdfDataEntryFormUtil.getPdfPCell( hasBorder ), strFieldLabel );
                 }
-                if ( ValueType.BOOLEAN == valueType )
+                else if ( ValueType.BOOLEAN == valueType )
                 {
                     // Create Yes - true, No - false, Select..
                     String[] optionList = new String[]{ "[No Value]", "Yes", "No" };
@@ -298,11 +298,11 @@
                     // addCell_WithRadioButton(table, writer, strFieldLabel);
                     addCell_WithDropDownListField( table, rectangle, writer, PdfDataEntryFormUtil.getPdfPCell( hasBorder ), strFieldLabel, optionList, valueList );
                 }
-                if ( valueType.isNumeric() )
+                else if ( valueType.isNumeric() )
                 {
-                    rectangle = new Rectangle( TEXTBOXWIDTH_NUMBERTYPE, PdfDataEntryFormUtil.CONTENT_HEIGHT_DEFAULT );
+                    Rectangle rectNum = new Rectangle( TEXTBOXWIDTH_NUMBERTYPE, PdfDataEntryFormUtil.CONTENT_HEIGHT_DEFAULT );
 
-                    addCell_WithTextField( table, rectangle, writer, PdfDataEntryFormUtil.getPdfPCell( hasBorder ), strFieldLabel, PdfFieldCell.TYPE_TEXT_NUMBER );
+                    addCell_WithTextField( table, rectNum, writer, PdfDataEntryFormUtil.getPdfPCell( hasBorder ), strFieldLabel, PdfFieldCell.TYPE_TEXT_NUMBER );
                 }
                 else
                 {

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/PdfFormController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/PdfFormController.java	2015-09-14 17:57:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/PdfFormController.java	2015-09-19 07:14:30 +0000
@@ -128,9 +128,9 @@
             pdfFormFontSettings, i18nManager.getI18nFormat() );
 
         String fileName = dataSetService.getDataSet( dataSetUid ).getName() + " " + (new SimpleDateFormat(
-            Period.DEFAULT_DATE_FORMAT )).format( new Date() );
+            Period.DEFAULT_DATE_FORMAT )).format( new Date() ) + ".pdf";
 
-        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_PDF, CacheStrategy.NO_CACHE, fileName, false );
+        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_PDF, CacheStrategy.NO_CACHE, fileName, true );
         response.setContentLength( baos.size() );
 
         baos.writeTo( out );
@@ -177,9 +177,9 @@
             pdfFormFontSettings, i18nManager.getI18nFormat() );
 
         String fileName = programStageService.getProgramStage( programStageUid ).getName() + " "
-            + (new SimpleDateFormat( Period.DEFAULT_DATE_FORMAT )).format( new Date() );
+            + (new SimpleDateFormat( Period.DEFAULT_DATE_FORMAT )).format( new Date() ) + ".pdf";
 
-        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_PDF, CacheStrategy.NO_CACHE, fileName, false );
+        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_PDF, CacheStrategy.NO_CACHE, fileName, true );
         response.setContentLength( baos.size() );
 
         baos.writeTo( out );