← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21967: bugfix for dataentry for multiorg datasets with optionsets

 

------------------------------------------------------------
revno: 21967
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2016-02-15 14:26:15 +0700
message:
  bugfix for dataentry for multiorg datasets with optionsets
modified:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js


--
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-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2016-02-13 20:57:05 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2016-02-15 07:26:15 +0000
@@ -2878,15 +2878,22 @@
  */
 dhis2.de.setOptionNameInField = function( fieldId, value )
 {
-	var optionSetUid = dhis2.de.optionSets[value.id].uid;
-	
-	DAO.store.get( 'optionSets', optionSetUid ).done( function( obj ) {		
+  var id = value.id;
+
+  if(value.id.split("-").length == 3)
+  {
+    id = id.substr(12);
+  }
+
+	var optionSetUid = dhis2.de.optionSets[id].uid;
+
+	DAO.store.get( 'optionSets', optionSetUid ).done( function( obj ) {
 		if ( obj && obj.optionSet && obj.optionSet.options ) {			
 			$.each( obj.optionSet.options, function( inx, option ) {
 				if ( option && option.code == value.val ) {
-                                        option.id = option.code;
-                                        option.text = option.name;					
-                                        $( fieldId ).select2("val", option.text );
+          option.id = option.code;
+          option.text = option.name;
+          $( fieldId ).select2("val", option.text );
 					return false;
 				}
 			} );