← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18921: Fixed bug - The option of attributes for option-sets in Add/Upte a Program Validation Criteria s...

 

------------------------------------------------------------
revno: 18921
committer: Tran Chau<tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-04-16 14:08:07 +0700
message:
  Fixed bug - The option of attributes for option-sets  in Add/Upte a Program Validation Criteria shows wrong value.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addValidationCriteria.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/validationcriteria.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateValidationCriteria.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-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addValidationCriteria.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addValidationCriteria.vm	2014-08-06 15:20:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addValidationCriteria.vm	2015-04-16 07:08:07 +0000
@@ -27,7 +27,7 @@
 							#if( $programAttribute.attribute.valueType!='trackerAssociate')
 								#set($opt="")
 								#foreach($option in $programAttribute.attribute.optionSet.options)
-									#set($opt=$opt + ';' + $option )
+									#set($opt=$opt + ';' + $option.code + ':' + $option.name )
 								#end 
 								<option valuetype='$programAttribute.attribute.valueType' value="$programAttribute.attribute.uid" opt="$opt">$programAttribute.attribute.displayName</option>
 							#end

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/validationcriteria.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/validationcriteria.js	2014-06-13 10:58:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/validationcriteria.js	2015-04-16 07:08:07 +0000
@@ -53,7 +53,8 @@
 	var value = getFieldValue('value');
 	var property = jQuery('#property option:selected');
 	var type = property.attr('valueType');
-	var propertyName = property.val();
+	var propertyName = property.val();	
+	enable('operator');
 	
 	var valueField = "";
 	 if(type=='bool') {
@@ -74,9 +75,13 @@
 		var opts = property.attr('opt').split(";");
 		valueField = "<select id='value' name='value' class=\"{validate:{required:true}}\" style=\"width:140px;\">";
 		for(var i=1;i<opts.length;i++){
-			valueField += "<option value=\"" + opts[i] + "\" >" + opts[i] + "</option>";
+			var opt = opts[i].split(":");
+			valueField += "<option value=\"" + opt[0] + "\" >" + opt[1] + "</option>";
 		}
 		valueField += "</select>";
+		
+		setFieldValue('operator','0');
+		disable('operator');
 	}
 	else if( type == "phoneNumber" ){
 		valueField = "<input id='value' name='value' class=\"{validate:{phone:true,required:true}}\" style=\"width:140px;\" />";

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateValidationCriteria.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateValidationCriteria.vm	2014-11-03 13:35:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateValidationCriteria.vm	2015-04-16 07:08:07 +0000
@@ -31,9 +31,9 @@
 									#if( $programAttribute.attribute.valueType!='trackerAssociate')
 										set($opt="")
 										#foreach($option in $programAttribute.attribute.optionSet.options)
-											#set($opt=$opt + ';' + $option )
+											#set($opt=$opt + ';' + $option.code + ':' + $option.name )
 										#end 
-										<option valuetype='$programAttribute.attribute.valueType' value="$programAttribute.attribute.uid" opt="$opt" #if($validationCriteria.property==$$programAttribute.attribute.uid) #set($attribute = $$programAttribute.attribute) selected #end>$encoder.htmlEncode($programAttribute.attribute.displayName)</option>
+										<option valuetype='$programAttribute.attribute.valueType' value="$programAttribute.attribute.uid" opt="$opt" #if($validationCriteria.property==$programAttribute.attribute.uid) #set($attribute = $$programAttribute.attribute) selected #end>$encoder.htmlEncode($programAttribute.attribute.displayName)</option>
 									#end
 								#end
 							</select>