=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java 2012-09-13 05:37:51 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java 2012-09-13 07:24:01 +0000 @@ -405,16 +405,16 @@ { sql += "pgi.programid as programid,"; patientGroupBy += ",pgi.programid "; - operator = " and "; - + sql += " MIN( psi.programstageinstanceid ) as programstageinstanceid,"; isSearchEvent = true; patientWhere += patientOperator + "pgi.patientid=p.patientid and "; patientWhere += "programid=" + id + " and "; patientWhere += "psi.duedate>='" + keys[3] + "' and psi.duedate<='" + keys[4] + "' and "; + patientWhere += "pgi.completed = false "; if ( keys.length == 6 ) { - patientWhere += "psi.organisationunitid = " + keys[5]; + patientWhere += " and psi.organisationunitid = " + keys[5]; } int statusEvent = Integer.parseInt( keys[2] ); @@ -476,7 +476,7 @@ { sql += "(select organisationunitid from patient where patientid=p.patientid and organisationunitid = " + orgunit.getId() + " ) as orgunitid,"; - otherWhere += operator + "orgunitid=" + orgunit.getId(); + otherWhere += otherWhere + operator + "orgunitid=" + orgunit.getId(); } sql = sql.substring( 0, sql.length() - 1 ) + " "; // Removing last comma @@ -505,7 +505,7 @@ { sql += statementBuilder.limitRecord( min, max ); } - + return sql; } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js 2012-09-13 05:37:51 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js 2012-09-13 07:24:01 +0000 @@ -27,20 +27,27 @@ hideById('listPatientDiv'); contentDiv = 'listPatientDiv'; $('#contentDataRecord').html(''); - + var searchBySelectedOrgunit = false; var programId = getFieldValue('programIdAddPatient'); var searchTexts = "stat_" + programId + "_" + getFieldValue("statusEvent") + "_" + getFieldValue('startDueDate') - + "_" + getFieldValue('endDueDate') - + "_" + getFieldValue('orgunitId'); - + + "_" + getFieldValue('endDueDate'); + + if( getFieldValue("statusEvent") != '3' && getFieldValue("statusEvent") != '0' ) + { + searchTexts += "_" + getFieldValue('orgunitId'); + } + else + { + searchBySelectedOrgunit = true + } showLoader(); jQuery('#listPatientDiv').load('getActivityPlanRecords.action', { programId:programId, listAll:false, - searchBySelectedOrgunit: false, + searchBySelectedOrgunit: searchBySelectedOrgunit, searchTexts: searchTexts }, function() === 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 2012-09-13 05:37:51 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2012-09-13 07:24:01 +0000 @@ -850,7 +850,7 @@ $('.stage-flow').each(function(){ var programInstanceId = this.id.split('_')[0]; - if(jQuery(this).width() < jQuery(this).find(".table-flow").width() ){ + if(jQuery(this).find(".table-flow td").outerWidth() > 0){ jQuery('#tb_' + programInstanceId ).find('.arrow-left').show(); jQuery('#tb_' + programInstanceId ).find('.arrow-right').show(); }