← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10054: Hide calculated attributes in Identifier and Attribute tab in dashboard; fix bug - don't save com...

 

------------------------------------------------------------
revno: 10054
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-03-07 23:01:54 +0700
message:
  Hide calculated attributes in Identifier and Attribute tab in dashboard; fix bug - don't save common attribute values in dashboard.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValuesAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveIdentifierAndAttributeAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/identifierAndAttributeForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipList.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-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValuesAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValuesAction.java	2013-03-07 05:59:08 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValuesAction.java	2013-03-07 16:01:54 +0000
@@ -61,8 +61,6 @@
     implements Action
 {
     private static final Log LOG = LogFactory.getLog( SaveValueAction.class );
-    
-    private static final String PREFIX_DATA_ELEMENT = "DE";
 
     // -------------------------------------------------------------------------
     // Dependencies
@@ -196,13 +194,14 @@
         {
             String dataElementFieldId = programStage.getId() + "-" + psDataElement.getDataElement().getId() + "-val";
             String value = request.getParameter( dataElementFieldId );
-            if ( value != null && value.trim().length()>0)
+            if ( value != null && value.trim().length() > 0 )
             {
                 String providedElsewhereId = programStage.getId() + "_" + psDataElement.getDataElement().getId()
                     + "_facility";
                 boolean providedElsewhere = (request.getParameter( providedElsewhereId ) == null) ? false : true;
 
-                PatientDataValue patientDataValue = new PatientDataValue( programStageInstance, psDataElement.getDataElement(), new Date(), value.trim() );
+                PatientDataValue patientDataValue = new PatientDataValue( programStageInstance,
+                    psDataElement.getDataElement(), new Date(), value.trim() );
                 patientDataValue.setStoredBy( storedBy );
                 patientDataValue.setProvidedElsewhere( providedElsewhere );
                 patientDataValueService.savePatientDataValue( patientDataValue );

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveIdentifierAndAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveIdentifierAndAttributeAction.java	2012-09-20 13:04:02 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveIdentifierAndAttributeAction.java	2013-03-07 16:01:54 +0000
@@ -38,6 +38,7 @@
 import org.hisp.dhis.patient.PatientAttribute;
 import org.hisp.dhis.patient.PatientAttributeOption;
 import org.hisp.dhis.patient.PatientAttributeOptionService;
+import org.hisp.dhis.patient.PatientAttributeService;
 import org.hisp.dhis.patient.PatientIdentifier;
 import org.hisp.dhis.patient.PatientIdentifierService;
 import org.hisp.dhis.patient.PatientIdentifierType;
@@ -67,6 +68,8 @@
 
     private PatientAttributeValueService patientAttributeValueService;
     
+    private PatientAttributeService patientAttributeService;
+    
     private PatientAttributeOptionService patientAttributeOptionService;
 
     private ProgramService programService;
@@ -90,6 +93,11 @@
         this.patientService = patientService;
     }
 
+    public void setPatientAttributeService( PatientAttributeService patientAttributeService )
+    {
+        this.patientAttributeService = patientAttributeService;
+    }
+
     public void setPatientAttributeValueService( PatientAttributeValueService patientAttributeValueService )
     {
         this.patientAttributeValueService = patientAttributeValueService;
@@ -209,7 +217,7 @@
 
         String value = null;
 
-        Collection<PatientAttribute> attributes = program.getPatientAttributes();
+        Collection<PatientAttribute> attributes = patientAttributeService.getAllPatientAttributes();
 
         PatientAttributeValue attributeValue = null;
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-03-06 14:31:30 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-03-07 16:01:54 +0000
@@ -670,6 +670,7 @@
 		<property name="patientAttributeOptionService"
 			ref="org.hisp.dhis.patient.PatientAttributeOptionService" />
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+		<property name="patientAttributeService" ref="org.hisp.dhis.patient.PatientAttributeService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.caseentry.action.patient.SetProgramInstanceStatusAction"

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/identifierAndAttributeForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/identifierAndAttributeForm.vm	2013-03-05 14:47:06 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/identifierAndAttributeForm.vm	2013-03-07 16:01:54 +0000
@@ -9,21 +9,23 @@
 #end
 				
 #foreach($attribute in $program.patientAttributes )
+	#if( $attribute.valueType!='calculated')
+	#set( $attributeValue = '')
 	<tr>
 		<td class='text-column'><label>$attribute.displayName #if($attribute.mandatory)<em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
 		<td class="input-column" >
-			#if( $attribute.valueType == "YES/NO" )
+			#if( $attribute.valueType == "bool" )
 				<select id="attr$attribute.id" name="attr$attribute.id" >              
 					<option value="">[$i18n.getString( "please_select" )]</option>
 					<option value="true">$i18n.getString( "yes" )</option>
 					<option value="false">$i18n.getString( "no" )</option>
 				</select>                
-			#elseif( $attribute.valueType == "DATE" )
+			#elseif( $attribute.valueType == "date" )
 				<input type="text" id="attr$attribute.id" name="attr$attribute.id" objectId='$attribute.id' objectType='attr' class=' #validate( "default"  $attribute.mandatory )' >
 				<script type="text/javascript">
 					datePickerValid( 'attr$attribute.id', false );
 				</script>                 
-			#elseif( $attribute.valueType == "COMBO" )
+			#elseif( $attribute.valueType == "combo" )
 				<select  id="attr$attribute.id" name="attr$attribute.id" class=' #validate( "default"  $attribute.mandatory )' >
 					 <option value="">[$i18n.getString( "please_select" )]</option>
 				#foreach ($option in $attribute.attributeOptions )
@@ -35,4 +37,5 @@
 			#end
 		</td>		
 	</tr>
+	#end
 #end
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm	2013-02-28 08:50:43 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm	2013-03-07 16:01:54 +0000
@@ -76,7 +76,7 @@
 				<tr>
 					<td>$attributeValue.patientAttribute.displayName</td>
 					<td>
-						#if($attributeValue.patientAttribute.valueType=='YES/NO')
+						#if($attributeValue.patientAttribute.valueType=='bool')
 							#if($attributeValue.value)
 								$i18n.getString("yes")
 							#else

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm	2013-03-01 09:15:24 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm	2013-03-07 16:01:54 +0000
@@ -83,7 +83,7 @@
 					#if( $attribute )
 						#set ( $key = $patient.id + '-' + $attribute.id )
 						<td>
-							#if( $attribute.valueType == 'YES/NO')
+							#if( $attribute.valueType == 'bool')
 								$i18n.getString( $mapPatientPatientAttr.get($key) )
 							#else
 								$mapPatientPatientAttr.get($key)

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm	2013-03-05 14:47:06 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm	2013-03-07 16:01:54 +0000
@@ -69,35 +69,38 @@
 						#set( $mark = !$mark  )
 					#end
 					
-				<!-- ATTRIBUTES IN GROUPS -->
+					<!-- ATTRIBUTES IN GROUPS -->
 					#foreach($attribute in $patientAttributes )
-						#set( $attributeValue = $!patientAttributeValueMap.get( $attribute.id ) )
-						<tr #alternate( $mark )>
-							<td class='text-column'><label>$attribute.displayName #if($attribute.mandatory)<em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
-							<td class="input-column" >
-								#if( $attribute.valueType == "YES/NO" )
-									<select id="attr$attribute.id" name="attr$attribute.id" >              
-										<option value="">[$i18n.getString( "please_select" )]</option>
-										<option value="true" #if( $attributeValue=='true') selected="selected" #end>$i18n.getString( "yes" )</option>
-										<option value="false" #if( $attributeValue=='false') selected="selected" #end>$i18n.getString( "no" )</option>
-									</select>                
-								#elseif( $attribute.valueType == "DATE" )
-									<input type="text" id="attr$attribute.id" name="attr$attribute.id" value="$!attributeValue"  objectId='$attribute.id' objectType='attr' class=' #validate( "default"  $attribute.mandatory )' >
-									<script type="text/javascript">
-										datePickerValid( 'attr$attribute.id', false );
-									</script>                 
-								#elseif( $attribute.valueType == "COMBO" )
-									<select  id="attr$attribute.id" name="attr$attribute.id" class=' #validate( "default"  $attribute.mandatory )' >
-										 <option value="">[$i18n.getString( "please_select" )]</option>
-										#foreach ($option in $attribute.attributeOptions )
-											<option value="$option.id" #if($attributeValue == $option.name) selected="selected" #end>$option.name</option>
-										#end
-									</select>
-								#else 
-									<input type="text"  id="attr$attribute.id" name="attr$attribute.id" value="$!attributeValue" class="{validate:{required:$attribute.mandatory #if($!attribute.noChars),maxlength:$attribute.noChars #end #if($attribute.valueType=='NUMBER'),number:true #end }}"  > 
-								#end
-							</td>		
-						</tr>
+						#if( $attribute.valueType!='calculated')
+							#set( $attributeValue = '')
+							#set( $attributeValue = $!patientAttributeValueMap.get( $attribute.id ) )
+							<tr #alternate( $mark )>
+								<td class='text-column'><label>$attribute.displayName #if($attribute.mandatory)<em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
+								<td class="input-column" >
+									#if( $attribute.valueType == "bool" )
+										<select id="attr$attribute.id" name="attr$attribute.id" >              
+											<option value="">[$i18n.getString( "please_select" )]</option>
+											<option value="true" #if( $attributeValue=='true') selected="selected" #end>$i18n.getString( "yes" )</option>
+											<option value="false" #if( $attributeValue=='false') selected="selected" #end>$i18n.getString( "no" )</option>
+										</select>                
+									#elseif( $attribute.valueType == "date" )
+										<input type="text" id="attr$attribute.id" name="attr$attribute.id" value="$!attributeValue"  objectId='$attribute.id' objectType='attr' class=' #validate( "default"  $attribute.mandatory )' >
+										<script type="text/javascript">
+											datePickerValid( 'attr$attribute.id', false, false );
+										</script>                 
+									#elseif( $attribute.valueType == "combo" )
+										<select  id="attr$attribute.id" name="attr$attribute.id" class=' #validate( "default"  $attribute.mandatory )' >
+											 <option value="">[$i18n.getString( "please_select" )]</option>
+											#foreach ($option in $attribute.attributeOptions )
+												<option value="$option.id" #if($attributeValue == $option.name) selected="selected" #end>$option.name</option>
+											#end
+										</select>
+									#else 
+										<input type="text"  id="attr$attribute.id" name="attr$attribute.id" value="$!attributeValue" class="{validate:{required:$attribute.mandatory #if($!attribute.noChars),maxlength:$attribute.noChars #end #if($attribute.valueType=='NUMBER'),number:true #end }}"  > 
+									#end
+								</td>		
+							</tr>
+						#end
 						#set( $mark = !$mark  )
 					#end
 					<tr><td>&nbsp;</td></tr>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipList.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipList.vm	2012-12-10 12:54:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipList.vm	2013-03-07 16:01:54 +0000
@@ -39,7 +39,7 @@
 						<tr>
 							<td class="bold text-column">$encoder.htmlEncode( $patientAttributeValue.patientAttribute.name ):</td>
 							<td>
-							#if( $patientAttributeValue.patientAttribute.valueType=="YES/NO")
+							#if( $patientAttributeValue.patientAttribute.valueType=="bool")
 								$i18n.getString("$patientAttributeValue.value")
 							#else
 								$encoder.htmlEncode( $patientAttributeValue.value )