← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11647: Fixed bug - Don't search events and error paging in single event without registration;

 

------------------------------------------------------------
revno: 11647
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-08-13 13:11:05 +0700
message:
  Fixed bug - Don't search events and error paging in single event without registration; 
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/TabularReportColumn.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstancesList.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm


--
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-api/src/main/java/org/hisp/dhis/patientreport/TabularReportColumn.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/TabularReportColumn.java	2013-05-19 08:24:25 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/TabularReportColumn.java	2013-08-13 06:11:05 +0000
@@ -2,36 +2,42 @@
 
 public class TabularReportColumn
 {
-    public static String PREFIX_META_DATA = "meta";    
+    public static String PREFIX_META_DATA = "meta";
+
     public static String PREFIX_IDENTIFIER_TYPE = "iden";
-    public static String PREFIX_FIXED_ATTRIBUTE = "fixedAttr";    
+
+    public static String PREFIX_FIXED_ATTRIBUTE = "fixedAttr";
+
     public static String PREFIX_PATIENT_ATTRIBUTE = "attr";
+
     public static String PREFIX_DATA_ELEMENT = "de";
+
     public static String PREFIX_NUMBER_DATA_ELEMENT = "numberDe";
-    
+
     private String prefix;
-    
+
     private String identifier;
-    
+
     private boolean hidden;
-    
+
     private String query;
-    
+
     private String operator;
-    
+
     private String name;
-    
+
     private boolean dateType = false;
 
     // -------------------------------------------------------------------------
     // Constructor
     // -------------------------------------------------------------------------
-    
+
     public TabularReportColumn()
     {
     }
-    
-    public TabularReportColumn( String prefix, String identifier, String name, boolean hidden, String operator, String query )
+
+    public TabularReportColumn( String prefix, String identifier, String name, boolean hidden, String operator,
+        String query )
     {
         this.prefix = prefix;
         this.identifier = identifier;
@@ -44,10 +50,10 @@
     // -------------------------------------------------------------------------
     // Logic
     // -------------------------------------------------------------------------
-    
+
     public boolean hasQuery()
     {
-        return query != null;
+        return (operator != null && !operator.isEmpty()) || (query != null && !query.isEmpty());
     }
 
     public Integer getIdentifierAsInt()
@@ -59,27 +65,27 @@
     {
         return PREFIX_META_DATA.equals( prefix );
     }
-    
+
     public boolean isIdentifierType()
     {
         return PREFIX_IDENTIFIER_TYPE.equals( prefix );
     }
-    
+
     public boolean isFixedAttribute()
     {
         return PREFIX_FIXED_ATTRIBUTE.equals( prefix );
     }
-    
+
     public boolean isDynamicAttribute()
     {
         return PREFIX_PATIENT_ATTRIBUTE.equals( prefix );
     }
-    
+
     public boolean isDataElement()
     {
-        return PREFIX_DATA_ELEMENT.equals( prefix ) || PREFIX_NUMBER_DATA_ELEMENT.equals( prefix ) ;
+        return PREFIX_DATA_ELEMENT.equals( prefix ) || PREFIX_NUMBER_DATA_ELEMENT.equals( prefix );
     }
-    
+
     public boolean isNumberDataElement()
     {
         return PREFIX_NUMBER_DATA_ELEMENT.equals( prefix );
@@ -88,7 +94,7 @@
     // -------------------------------------------------------------------------
     // Get methods
     // -------------------------------------------------------------------------
-    
+
     public String getPrefix()
     {
         return prefix;

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java	2013-08-12 03:29:54 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java	2013-08-13 06:11:05 +0000
@@ -53,7 +53,6 @@
 import org.hisp.dhis.sms.SmsSender;
 import org.hisp.dhis.sms.SmsServiceException;
 import org.hisp.dhis.sms.outbound.OutboundSms;
-import org.hisp.dhis.sms.outbound.OutboundSmsService;
 import org.hisp.dhis.system.grid.ListGrid;
 import org.hisp.dhis.user.CurrentUserService;
 import org.springframework.transaction.annotation.Transactional;

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2013-08-08 06:20:51 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2013-08-13 06:11:05 +0000
@@ -1063,7 +1063,7 @@
         sql += where; // filters
         sql = sql.substring( 0, sql.length() - 1 ) + " "; // Remove last comma
         sql += (min != null && max != null) ? statementBuilder.limitRecord( min, max ) : "";
-
+        
         return sql;
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java	2013-05-30 09:08:10 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java	2013-08-13 06:11:05 +0000
@@ -220,6 +220,13 @@
         this.userOrganisationUnitChildren = userOrganisationUnitChildren;
     }
 
+    private Integer pageSize;
+
+    public void setPageSize( Integer pageSize )
+    {
+        this.pageSize = pageSize;
+    }
+
     private Grid grid;
 
     public Grid getGrid()
@@ -234,13 +241,13 @@
         return totalRecords;
     }
 
+    private Integer total;
+
     public void setTotal( Integer total )
     {
         this.total = total;
     }
 
-    private Integer total;
-
     public Integer getTotal()
     {
         return total;
@@ -432,7 +439,7 @@
 
                 grid = programStageInstanceService.getTabularReport( anonynousEntryForm, programStage, columns,
                     organisationUnits, level, startValue, endValue, !orderByOrgunitAsc, useCompletedEvents,
-                    accessPrivateInfo, displayOrgunitCode, getStartPos(), paging.getPageSize(), i18n );
+                    accessPrivateInfo, displayOrgunitCode, paging.getStartPos(), paging.getPageSize(), i18n );
             }
             // Download as Excel
             else
@@ -456,19 +463,8 @@
 
     private int getNumberOfPages( int totalRecord )
     {
-        int pageSize = this.getDefaultPageSize();
-        return (totalRecord % pageSize == 0) ? (totalRecord / pageSize) : (totalRecord / pageSize + 1);
-    }
-
-    public int getStartPos()
-    {
-        if ( currentPage == null )
-        {
-            return paging.getStartPos();
-        }
-        int startPos = currentPage <= 0 ? 0 : (currentPage - 1) * paging.getPageSize();
-        startPos = (startPos > total) ? total : startPos;
-        return startPos;
+        int size = ( pageSize != null ) ? pageSize : this.getDefaultPageSize();
+        return (totalRecord % size == 0) ? (totalRecord / size) : (totalRecord / size + 1);
     }
 
     private List<TabularReportColumn> getTableColumns()
@@ -490,9 +486,8 @@
                 column.setIdentifier( values[1] );
                 column.setHidden( Boolean.parseBoolean( values[2] ) );
 
-                column.setOperator( values.length == 5 ? TextUtils.lower( values[3] ) : null );
-                column.setQuery( values.length == 5 ? TextUtils.lower( values[4] ) : null );
-
+                column.setOperator( values.length > 3 ? TextUtils.lower( values[3] ) : TextUtils.EMPTY);
+                column.setQuery( values.length > 4 ? TextUtils.lower( values[4] ) : TextUtils.EMPTY );
                 if ( PREFIX_FIXED_ATTRIBUTE.equals( prefix ) )
                 {
                     column.setName( values[1] );
@@ -543,20 +538,20 @@
                     {
                         column.setDateType( true );
                     }
-                    
+
                     if ( useFormNameDataElement != null && useFormNameDataElement )
                     {
                         column.setName( dataElement.getFormNameFallback() );
                     }
                     else
                     {
-                        column.setName( dataElement.getDisplayName() );  
+                        column.setName( dataElement.getDisplayName() );
                     }
+                    
+                    columns.add( column );
                 }
 
-                columns.add( column );
-
-                index++;
+               index++;
             }
         }
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstancesList.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstancesList.vm	2013-06-06 09:34:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstancesList.vm	2013-08-13 06:11:05 +0000
@@ -3,13 +3,6 @@
 #else
 	<table>
 		<tr>
-			<td class='text-column'>$i18n.getString( "search_result_matching_the_search_criteria" ):</td>
-			<td>&nbsp;</td>
-			<td>&nbsp;</td>
-			<td id='searchInforTD'></td>
-		</tr>	
-		
-		<tr>
 			<td class='text-column'>$i18n.getString( "total_result" )</td>
 			<td>&nbsp;</td>
 			<td>&nbsp;</td>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm	2013-08-12 06:23:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm	2013-08-13 06:11:05 +0000
@@ -71,27 +71,20 @@
 
 <div id='advanced-search' name='advanced-search' class='hidden advanced-search'>
 	<table>	
+		#if( $auth.hasAccess( "dhis-web-caseentry", "searchAllFacilities" ) )
 			<tr id='searchBySelectedUnitTD'>
-				#if( $auth.hasAccess( "dhis-web-caseentry", "searchAllFacilities" ) )
-					<td>
-						$i18n.getString('search_in_all_facilities') 
-						<input type='checkbox' id='searchInAllFacility' name='searchInAllFacility' />&nbsp;&nbsp;&nbsp;
-					</td>
-				#else
-					<input type='checkbox' class='hidden' id='searchInAllFacility' name='searchInAllFacility' />
-				#end
-				
-				#if( $auth.hasAccess( "dhis-web-caseentry", "searchByUserFacilities" ) )
-					<td>
-						$i18n.getString('search_by_user_orgunits') 
-						<input type='checkbox' id='searchByUserOrgunits' name='searchByUserOrgunits' />&nbsp;&nbsp;&nbsp;
-					</td>
-				#else
-					<input type='checkbox' class='hidden' id='searchByUserOrgunits' name='searchByUserOrgunits' />
-				#end
+				<td>
+					$i18n.getString('search_in_all_facilities') 
+					<input type='checkbox' id='searchInAllFacility' name='searchInAllFacility' />&nbsp;&nbsp;&nbsp;
+				</td>
+				<td>
+					$i18n.getString('search_by_user_orgunits') 
+					<input type='checkbox' id='searchByUserOrgunits' name='searchByUserOrgunits' />&nbsp;&nbsp;&nbsp;
+				</td>
 			</tr>
-		
-		
+		#else
+			<input type='checkbox' class='hidden' id='searchInAllFacility' name='searchInAllFacility' />
+		#end
 		<tr id='dueDateTR' class='hidden'>
 			<td>$i18n.getString('due_date_from_to')</td>
 			<td>