=== 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 2014-07-18 11:34:34 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2014-09-09 07:13:50 +0000 @@ -562,10 +562,6 @@ - - - === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2014-07-11 05:28:48 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2014-09-09 07:13:50 +0000 @@ -626,13 +626,6 @@ /dhis-web-caseentry/attributeFormDiv.vm F_TRACKED_ENTITY_INSTANCE_ADD - - - - /dhis-web-caseentry/jsonProgramAttributes.vm - - === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2014-07-18 04:16:17 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2014-09-09 07:13:50 +0000 @@ -358,39 +358,73 @@ } else { hideById('enrollmentSelectTR'); } - - $.postJSON("getAttributesByProgram.action", { - id : program, - entityInstanceId : getFieldValue('entityInstanceId') - }, function(json) { - removeAttributeOption('advSearchBox0'); - var attributeList = jQuery('#searchObjectId'); - jQuery('input[name=clearSearchBtn]').each(function() { - jQuery(this).click(); - }); - - clearListById('searchObjectId'); - clearListById('attributeIds'); - for ( var i in json.attributes) { - jQuery('#searchObjectId').append( - ''); - - if(json.attributes[i].displayed=='true'){ - jQuery('#attributeIds').append( - ''); - } - } - - if (getFieldValue('program') != '') { - jQuery('#searchObjectId').append( - ''); - } - - addAttributeOption(); - }); + + if( program!=""){ + $.get("../api/programs/" + program + ".json?fields=programTrackedEntityAttributes", {} + , function(json) { + removeAttributeOption('advSearchBox0'); + var attributeList = jQuery('#searchObjectId'); + jQuery('input[name=clearSearchBtn]').each(function() { + jQuery(this).click(); + }); + + clearListById('searchObjectId'); + clearListById('attributeIds'); + for ( var i in json.programTrackedEntityAttributes) { + var progamAttribute = json.programTrackedEntityAttributes[i]; + var attribute = progamAttribute.trackedEntityAttribute; + jQuery('#searchObjectId').append( + ''); + + if(json.programTrackedEntityAttributes[i].displayed=='true'){ + jQuery('#attributeIds').append( + ''); + } + } + + if (getFieldValue('program') != '') { + jQuery('#searchObjectId').append( + ''); + } + + addAttributeOption(); + }); + } + else + { + $.get("../api/trackedEntityAttributes.json?fields=id,name&filter=displayInListNoProgram:eq:true", {} + , function(json) { + removeAttributeOption('advSearchBox0'); + var attributeList = jQuery('#searchObjectId'); + jQuery('input[name=clearSearchBtn]').each(function() { + jQuery(this).click(); + }); + + clearListById('searchObjectId'); + clearListById('attributeIds'); + for ( var i in json.trackedEntityAttributes) { + var attribute = json.trackedEntityAttributes[i]; + jQuery('#searchObjectId').append( + ''); + + jQuery('#attributeIds').append( + ''); + } + + if (getFieldValue('program') != '') { + jQuery('#searchObjectId').append( + ''); + } + + addAttributeOption(); + }); + } + } function enableRadioButton(programId) {