=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java 2013-08-02 04:53:58 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java 2013-08-12 06:23:01 +0000 @@ -208,19 +208,19 @@ void removeErollmentPrograms( Program program ); - Collection searchPatients( List searchKeys, OrganisationUnit orgunit, Boolean followup, - Collection patientAttributes, Integer min, Integer max ); - - int countSearchPatients( List searchKeys, OrganisationUnit orgunit, Boolean followup ); - - Collection getPatientPhoneNumbers( List searchKeys, OrganisationUnit orgunit, Boolean followup, - Integer min, Integer max ); - - List getProgramStageInstances( List searchKeys, OrganisationUnit orgunit, Boolean followup, - Integer min, Integer max ); - - Grid getScheduledEventsReport( List searchKeys, OrganisationUnit orgunit, Boolean followup, Integer min, - Integer max, I18n i18n ); + Collection searchPatients( List searchKeys, Collection orgunit, + Boolean followup, Collection patientAttributes, Integer min, Integer max ); + + int countSearchPatients( List searchKeys, Collection orgunit, Boolean followup ); + + Collection getPatientPhoneNumbers( List searchKeys, Collection orgunit, + Boolean followup, Integer min, Integer max ); + + List getProgramStageInstances( List searchKeys, Collection orgunit, + Boolean followup, Integer min, Integer max ); + + Grid getScheduledEventsReport( List searchKeys, Collection orgunits, Boolean followup, + Integer min, Integer max, I18n i18n ); Collection getPatientsByPhone( String phoneNumber, Integer min, Integer max ); @@ -228,7 +228,7 @@ Collection getRegistrationOrgunitIds( Date startDate, Date endDate ); - Grid getTrackingEventsReport( Program program, List searchKeys, OrganisationUnit orgunit, Boolean followup, - I18n i18n ); + Grid getTrackingEventsReport( Program program, List searchKeys, Collection orgunit, + Boolean followup, I18n i18n ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java 2013-08-02 04:53:58 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java 2013-08-12 06:23:01 +0000 @@ -68,7 +68,7 @@ void removeErollmentPrograms( Program program ); - int countSearch( List searchKeys, OrganisationUnit orgunit, Boolean followup ); + int countSearch( List searchKeys, Collection orgunit, Boolean followup ); Collection getByPhoneNumber( String phoneNumber, Integer min, Integer max ); @@ -76,18 +76,19 @@ Collection getRegistrationOrgunitIds( Date startDate, Date endDate ); - Collection search( List searchKeys, OrganisationUnit orgunit, Boolean followup, - Collection patientAttributes, Integer min, Integer max ); - - Collection getPatientPhoneNumbers( List searchKeys, OrganisationUnit orgunit, Boolean followup, - Collection patientAttributes, Integer min, Integer max ); - - Grid getPatientEventReport( Grid grid, List searchKeys, OrganisationUnit orgunit, Boolean followup, - Collection patientAttributes, Collection identifierTypes, Integer min, - Integer max ); - - List getProgramStageInstances( List searchKeys, OrganisationUnit orgunit, Boolean followup, - Collection patientAttributes, Collection identifierTypes, Integer min, - Integer max ); + Collection search( List searchKeys, Collection orgunit, Boolean followup, + Collection patientAttributes, Integer min, Integer max ); + + Collection getPatientPhoneNumbers( List searchKeys, Collection orgunits, Boolean followup, + Collection patientAttributes, Integer min, Integer max ); + + Grid getPatientEventReport( Grid grid, List searchKeys, Collection orgunit, Boolean followup, + Collection patientAttributes, Collection identifierTypes, Integer min, + Integer max ); + + List getProgramStageInstances( List searchKeys, Collection orgunits, Boolean followup, + Collection patientAttributes, Collection identifierTypes, Integer min, + Integer max ); + } === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java 2013-08-02 04:53:58 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java 2013-08-12 06:23:01 +0000 @@ -523,27 +523,27 @@ patientStore.removeErollmentPrograms( program ); } - public Collection searchPatients( List searchKeys, OrganisationUnit orgunit, Boolean followup, - Collection patientAttributes, Integer min, Integer max ) - { - return patientStore.search( searchKeys, orgunit, followup, patientAttributes, min, max ); - } - - public int countSearchPatients( List searchKeys, OrganisationUnit orgunit, Boolean followup ) - { - return patientStore.countSearch( searchKeys, orgunit, followup ); - } - - public Collection getPatientPhoneNumbers( List searchKeys, OrganisationUnit orgunit, - Boolean followup, Integer min, Integer max ) - { - return patientStore.getPatientPhoneNumbers( searchKeys, orgunit, followup, null, min, max ); - } - - public List getProgramStageInstances( List searchKeys, OrganisationUnit orgunit, Boolean followup, - Integer min, Integer max ) - { - return patientStore.getProgramStageInstances( searchKeys, orgunit, followup, null, null, min, max ); + public Collection searchPatients( List searchKeys, Collection orgunits, + Boolean followup, Collection patientAttributes, Integer min, Integer max ) + { + return patientStore.search( searchKeys, orgunits, followup, patientAttributes, min, max ); + } + + public int countSearchPatients( List searchKeys, Collection orgunits, Boolean followup ) + { + return patientStore.countSearch( searchKeys, orgunits, followup ); + } + + public Collection getPatientPhoneNumbers( List searchKeys, Collection orgunits, + Boolean followup, Integer min, Integer max ) + { + return patientStore.getPatientPhoneNumbers( searchKeys, orgunits, followup, null, min, max ); + } + + public List getProgramStageInstances( List searchKeys, Collection orgunits, + Boolean followup, Integer min, Integer max ) + { + return patientStore.getProgramStageInstances( searchKeys, orgunits, followup, null, null, min, max ); } @Override @@ -553,8 +553,8 @@ } @Override - public Grid getScheduledEventsReport( List searchKeys, OrganisationUnit orgunit, Boolean followup, - Integer min, Integer max, I18n i18n ) + public Grid getScheduledEventsReport( List searchKeys, Collection orgunits, + Boolean followup, Integer min, Integer max, I18n i18n ) { String startDate = ""; String endDate = ""; @@ -593,14 +593,14 @@ grid.addHeader( new GridHeader( i18n.getString( "program_stage" ), false, true ) ); grid.addHeader( new GridHeader( i18n.getString( "due_date" ), false, true ) ); - return patientStore.getPatientEventReport( grid, searchKeys, orgunit, followup, patientAttributes, null, min, + return patientStore.getPatientEventReport( grid, searchKeys, orgunits, followup, patientAttributes, null, min, max ); } @Override - public Grid getTrackingEventsReport( Program program, List searchKeys, OrganisationUnit orgunit, - Boolean followup, I18n i18n ) + public Grid getTrackingEventsReport( Program program, List searchKeys, + Collection orgunits, Boolean followup, I18n i18n ) { String startDate = ""; String endDate = ""; @@ -638,7 +638,7 @@ grid.addHeader( new GridHeader( i18n.getString( "due_date" ), false, true ) ); grid.addHeader( new GridHeader( i18n.getString( "risk" ), false, true ) ); - return patientStore.getPatientEventReport( grid, searchKeys, orgunit, followup, null, patientIdentifierTypes, + return patientStore.getPatientEventReport( grid, searchKeys, orgunits, followup, null, patientIdentifierTypes, null, null ); } === 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 2013-08-02 05:53:34 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java 2013-08-12 06:23:01 +0000 @@ -255,10 +255,10 @@ } @Override - public Collection search( List searchKeys, OrganisationUnit orgunit, Boolean followup, - Collection patientAttributes, Integer min, Integer max ) + public Collection search( List searchKeys, Collection orgunits, + Boolean followup, Collection patientAttributes, Integer min, Integer max ) { - String sql = searchPatientSql( false, searchKeys, orgunit, followup, patientAttributes, null, min, max ); + String sql = searchPatientSql( false, searchKeys, orgunits, followup, patientAttributes, null, min, max ); Collection patients = new HashSet(); try { @@ -279,10 +279,10 @@ } @Override - public Collection getPatientPhoneNumbers( List searchKeys, OrganisationUnit orgunit, + public Collection getPatientPhoneNumbers( List searchKeys, Collection orgunits, Boolean followup, Collection patientAttributes, Integer min, Integer max ) { - String sql = searchPatientSql( false, searchKeys, orgunit, followup, patientAttributes, null, min, max ); + String sql = searchPatientSql( false, searchKeys, orgunits, followup, patientAttributes, null, min, max ); Collection phoneNumbers = new HashSet(); try { @@ -304,11 +304,11 @@ } @Override - public List getProgramStageInstances( List searchKeys, OrganisationUnit orgunit, Boolean followup, - Collection patientAttributes, Collection identifierTypes, Integer min, - Integer max ) + public List getProgramStageInstances( List searchKeys, Collection orgunits, + Boolean followup, Collection patientAttributes, + Collection identifierTypes, Integer min, Integer max ) { - String sql = searchPatientSql( false, searchKeys, orgunit, followup, patientAttributes, identifierTypes, min, + String sql = searchPatientSql( false, searchKeys, orgunits, followup, patientAttributes, identifierTypes, min, max ); List programStageInstanceIds = new ArrayList(); try @@ -330,21 +330,23 @@ return programStageInstanceIds; } - public int countSearch( List searchKeys, OrganisationUnit orgunit, Boolean followup ) + public int countSearch( List searchKeys, Collection orgunits, Boolean followup ) { - String sql = searchPatientSql( true, searchKeys, orgunit, followup, null, null, null, null ); + String sql = searchPatientSql( true, searchKeys, orgunits, followup, null, null, null, null ); return jdbcTemplate.queryForObject( sql, Integer.class ); } @Override - public Grid getPatientEventReport( Grid grid, List searchKeys, OrganisationUnit orgunit, Boolean followup, - Collection patientAttributes, Collection identifierTypes, Integer min, Integer max ) + public Grid getPatientEventReport( Grid grid, List searchKeys, Collection orgunits, + Boolean followup, Collection patientAttributes, + Collection identifierTypes, Integer min, Integer max ) { // --------------------------------------------------------------------- // Get SQL and build grid // --------------------------------------------------------------------- - String sql = searchPatientSql( false, searchKeys, orgunit, followup, patientAttributes, identifierTypes, null, null ); + String sql = searchPatientSql( false, searchKeys, orgunits, followup, patientAttributes, identifierTypes, null, + null ); SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql ); @@ -357,7 +359,7 @@ // Supportive methods // ------------------------------------------------------------------------- - private String searchPatientSql( boolean count, List searchKeys, OrganisationUnit orgunit, + private String searchPatientSql( boolean count, List searchKeys, Collection orgunits, Boolean followup, Collection patientAttributes, Collection identifierTypes, Integer min, Integer max ) { @@ -371,11 +373,15 @@ for ( PatientIdentifierType identifierType : identifierTypes ) { sql += "(select identifier from patientidentifier where patientid=p.patientid and patientidentifiertypeid=" - + identifierType.getId() + " ) as " + Patient.PREFIX_IDENTIFIER_TYPE + "_" + identifierType.getId() + + identifierType.getId() + + " ) as " + + Patient.PREFIX_IDENTIFIER_TYPE + + "_" + + identifierType.getId() + " ,"; } } - + if ( patientAttributes != null ) { for ( PatientAttribute patientAttribute : patientAttributes ) @@ -386,7 +392,6 @@ } } - String patientWhere = ""; String patientOperator = " where "; String patientGroupBy = " GROUP BY p.patientid, p.firstname, p.middlename, p.lastname, p.gender, p.phonenumber "; @@ -396,7 +401,7 @@ boolean hasIdentifier = false; boolean isSearchEvent = false; boolean isPriorityEvent = false; - Collection orgunitChilrenIds = getOrgunitChildren( orgunit ); + Collection orgunitChilrenIds = getOrgunitChildren( orgunits ); for ( String searchKey : searchKeys ) { @@ -609,11 +614,12 @@ } } - if ( orgunit != null && !isSearchEvent ) + if ( orgunits != null && !isSearchEvent ) { - sql += "(select organisationunitid from patient where patientid=p.patientid and organisationunitid = " - + orgunit.getId() + " ) as orgunitid,"; - otherWhere += operator + "orgunitid=" + orgunit.getId(); + sql += "(select organisationunitid from patient where patientid=p.patientid and organisationunitid in ( " + + TextUtils.getCommaDelimitedString( getOrganisationUnitIds( orgunits ) ) + " ) ) as orgunitid,"; + otherWhere += operator + "orgunitid in ( " + + TextUtils.getCommaDelimitedString( getOrganisationUnitIds( orgunits ) ) + " ) "; } sql = sql.substring( 0, sql.length() - 1 ) + " "; // Removing last comma @@ -664,7 +670,7 @@ { sql += statementBuilder.limitRecord( min, max ); } - + return sql; } @@ -730,14 +736,35 @@ // Supportive methods // ------------------------------------------------------------------------- - private Collection getOrgunitChildren( OrganisationUnit orgunit ) - { - Collection orgunitIds = new HashSet(); - if ( orgunit != null ) - { - orgunitIds.addAll( organisationUnitService.getOrganisationUnitHierarchy().getChildren( orgunit.getId() ) ); - orgunitIds.remove( orgunit.getId() ); - } + private Collection getOrgunitChildren( Collection orgunits ) + { + Collection orgunitIds = new HashSet(); + if ( orgunits != null ) + { + for ( OrganisationUnit orgunit : orgunits ) + { + + orgunitIds + .addAll( organisationUnitService.getOrganisationUnitHierarchy().getChildren( orgunit.getId() ) ); + orgunitIds.remove( orgunit.getId() ); + } + } + + if ( orgunitIds.size() == 0 ) + { + orgunitIds.add( 0 ); + } + return orgunitIds; + } + + private Collection getOrganisationUnitIds( Collection orgunits ) + { + Collection orgunitIds = new HashSet(); + for ( OrganisationUnit orgunit : orgunits ) + { + orgunitIds.add( orgunit.getId() ); + } + if ( orgunitIds.size() == 0 ) { orgunitIds.add( 0 ); === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetDataRecordsAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetDataRecordsAction.java 2013-08-02 04:53:58 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetDataRecordsAction.java 2013-08-12 06:23:01 +0000 @@ -31,8 +31,10 @@ import java.util.Collection; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; + import org.hisp.dhis.caseentry.state.SelectedStateManager; import org.hisp.dhis.common.Grid; import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator; @@ -219,6 +221,9 @@ { OrganisationUnit orgunit = selectedStateManager.getSelectedOrganisationUnit(); + Collection orgunits = new HashSet(); + orgunits.add( orgunit ); + if ( programId != null ) { program = programService.getProgram( programId ); @@ -235,10 +240,10 @@ Collections.sort( patientAttributes, IdentifiableObjectNameComparator.INSTANCE ); - total = patientService.countSearchPatients( searchTexts, orgunit, followup ); + total = patientService.countSearchPatients( searchTexts, orgunits, followup ); this.paging = createPaging( total ); - List stageInstanceIds = patientService.getProgramStageInstances( searchTexts, orgunit, + List stageInstanceIds = patientService.getProgramStageInstances( searchTexts, orgunits, followup, paging.getStartPos(), paging.getPageSize() ); for ( Integer stageInstanceId : stageInstanceIds ) @@ -268,11 +273,11 @@ } else if(trackingReport != null && trackingReport ) { - grid = patientService.getTrackingEventsReport( program, searchTexts, orgunit, followup, i18n ); + grid = patientService.getTrackingEventsReport( program, searchTexts, orgunits, followup, i18n ); } else { - grid = patientService.getScheduledEventsReport( searchTexts, orgunit, followup, null, null, i18n ); + grid = patientService.getScheduledEventsReport( searchTexts, orgunits, followup, null, null, i18n ); } } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SearchPatientAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SearchPatientAction.java 2013-05-28 09:04:10 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SearchPatientAction.java 2013-08-12 06:23:01 +0000 @@ -30,6 +30,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; @@ -41,6 +42,7 @@ import org.hisp.dhis.patient.PatientService; import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramService; +import org.hisp.dhis.user.CurrentUserService; /** * @author Abyot Asalefew Gizaw @@ -59,6 +61,8 @@ private ProgramService programService; + private CurrentUserService currentUserService; + // ------------------------------------------------------------------------- // Input/output // ------------------------------------------------------------------------- @@ -67,6 +71,8 @@ private Boolean searchBySelectedOrgunit; + private Boolean searchByUserOrgunits; + private boolean listAll; private Collection patients = new ArrayList(); @@ -75,11 +81,21 @@ // Getters && Setters // ------------------------------------------------------------------------- + public void setCurrentUserService( CurrentUserService currentUserService ) + { + this.currentUserService = currentUserService; + } + public void setSelectionManager( OrganisationUnitSelectionManager selectionManager ) { this.selectionManager = selectionManager; } + public void setSearchByUserOrgunits( Boolean searchByUserOrgunits ) + { + this.searchByUserOrgunits = searchByUserOrgunits; + } + public void setProgramService( ProgramService programService ) { this.programService = programService; @@ -150,6 +166,8 @@ public String execute() throws Exception { + Collection orgunits = new HashSet(); + OrganisationUnit organisationUnit = selectionManager.getSelectedOrganisationUnit(); // List all patients @@ -164,14 +182,26 @@ // search patients else if ( searchTexts.size() > 0 ) { - organisationUnit = (searchBySelectedOrgunit) ? organisationUnit : null; + if ( searchByUserOrgunits ) + { + Collection userOrgunits = currentUserService.getCurrentUser().getOrganisationUnits(); + orgunits.addAll( userOrgunits ); + } + else if ( searchBySelectedOrgunit ) + { + orgunits.add( organisationUnit ); + } + else + { + organisationUnit = null; + } - total = patientService.countSearchPatients( searchTexts, organisationUnit, null ); + total = patientService.countSearchPatients( searchTexts, orgunits, null ); this.paging = createPaging( total ); - patients = patientService.searchPatients( searchTexts, organisationUnit, null, null, paging.getStartPos(), + patients = patientService.searchPatients( searchTexts, orgunits, null, null, paging.getStartPos(), paging.getPageSize() ); - if ( !searchBySelectedOrgunit ) + if ( !searchBySelectedOrgunit || searchByUserOrgunits ) { for ( Patient patient : patients ) { === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsToListAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsToListAction.java 2013-08-12 03:29:54 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsToListAction.java 2013-08-12 06:23:01 +0000 @@ -62,7 +62,7 @@ private PatientService patientService; private SmsSender smsSender; - + private ProgramStageInstanceService programStageInstanceService; private CurrentUserService currentUserService; @@ -77,6 +77,8 @@ private Boolean searchBySelectedOrgunit; + private Boolean searchByUserOrgunits; + private Boolean followup; // ------------------------------------------------------------------------- @@ -118,6 +120,11 @@ this.searchBySelectedOrgunit = searchBySelectedOrgunit; } + public void setSearchByUserOrgunits( Boolean searchByUserOrgunits ) + { + this.searchByUserOrgunits = searchByUserOrgunits; + } + public void setPatientService( PatientService patientService ) { this.patientService = patientService; @@ -128,10 +135,6 @@ this.searchTexts = searchTexts; } - // ------------------------------------------------------------------------- - // Input & Output - // ------------------------------------------------------------------------- - private String msg; public void setMsg( String msg ) @@ -154,14 +157,29 @@ public String execute() throws Exception { - OrganisationUnit organisationUnit = (searchBySelectedOrgunit) ? selectionManager.getSelectedOrganisationUnit() - : null; - - Collection programStageInstanceIds = patientService.getProgramStageInstances( searchTexts, - organisationUnit, followup, null, null ); + OrganisationUnit organisationUnit = selectionManager.getSelectedOrganisationUnit(); + Collection orgunits = new HashSet(); + + if ( searchByUserOrgunits ) + { + Collection userOrgunits = currentUserService.getCurrentUser().getOrganisationUnits(); + orgunits.addAll( userOrgunits ); + } + else if ( searchBySelectedOrgunit ) + { + orgunits.add( organisationUnit ); + } + + else + { + organisationUnit = null; + } + + Collection programStageInstanceIds = patientService.getProgramStageInstances( searchTexts, orgunits, + followup, null, null ); Set phoneNumberList = new HashSet( patientService.getPatientPhoneNumbers( searchTexts, - organisationUnit, followup, null, null ) ); + orgunits, followup, null, null ) ); try { OutboundSms outboundSms = new OutboundSms(); @@ -182,5 +200,4 @@ return SUCCESS; } - } === 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-08-12 03:29:54 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2013-08-12 06:23:01 +0000 @@ -31,6 +31,7 @@ ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" /> + /dhis-web-commons/ajax/jsonResponseSuccess.vm F_SEARCH_PATIENT_IN_ALL_FACILITIES + + + /dhis-web-commons/ajax/jsonResponseSuccess.vm + F_SEARCH_PATIENT_IN_USER_FACILITIES + @@ -71,14 +77,19 @@ /dhis-web-caseentry/jsonProgramStageInstance.vm - + /dhis-web-commons/ajax/jsonResponseSuccess.vm + F_PATIENT_DATAVALUE_ADD,F_PATIENT_DATAVALUE_DELETE + + + /content.vm /dhis-web-caseentry/dataEntryForm.vm style/style.css - F_PATIENT_DATAVALUE_ADD,F_PATIENT_DATAVALUE_DELETE - + /dhis-web-commons/ajax/jsonResponseSuccess.vm === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm 2013-08-06 03:47:55 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm 2013-08-12 06:23:01 +0000 @@ -37,10 +37,10 @@ - - + @@ -111,8 +111,16 @@ var i18n_incomplete_confirm_message = '$encoder.jsEscape( $i18n.getString( "incomplete_confirm_message" ) , "'" )'; var i18n_add_patient_related_the_selected_event = '$encoder.jsEscape( $i18n.getString( "add_patient_related_the_selected_event" ) , "'" )'; - if(getFieldValue('completed')=='true' && getFieldValue('blockEntryForm')=='true'){ + var editDataEntryForm = eval($auth.hasAccess( "dhis-web-caseentry", "editDataEntryForm" )); + if( (getFieldValue('completed')=='true' && getFieldValue('blockEntryForm')=='true' ) + || !editDataEntryForm) { blockEntryForm(); + if(!editDataEntryForm){ + disable('executionDate'); + disable('completeBtn'); + disable('uncompleteBtn'); + disable('validateBtn'); + } } #if($programStage.relatedPatient=='true') === 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 2013-08-08 06:29:51 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2013-08-12 06:23:01 +0000 @@ -281,6 +281,10 @@ }); params += '&listAll=false'; + + var searchByUserOrgunits = byId('searchByUserOrgunits').checked ? true : false; + params += '&searchByUserOrgunits=' + searchByUserOrgunits; + if( getFieldValue('searchByProgramStage') == "false"){ var searchInAllFacility = byId('searchInAllFacility').checked; params += '&searchBySelectedOrgunit=' + !searchInAllFacility; === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js 2013-08-08 06:20:51 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js 2013-08-12 06:23:01 +0000 @@ -352,36 +352,47 @@ programStageInstanceId: programStageInstanceId },function( ) { - var executionDate = jQuery('#executionDate').val(); - var completed = jQuery('#entryFormContainer input[id=completed]').val(); - var irregular = jQuery('#entryFormContainer input[id=irregular]').val(); - var reportDateDes = jQuery("#ps_" + programStageInstanceId).attr("reportDateDes"); - setInnerHTML('reportDateDescriptionField',reportDateDes); - enable('validationBtn'); - if( executionDate == '' ) - { - disable('validationBtn'); - } - else if( executionDate != ''){ - if ( completed == 'false' ){ - disableCompletedButton(false); - } - else if( completed == 'true' ){ - disableCompletedButton(true); - } - } - - var linkedEvent = jQuery(".stage-object-selected").attr("linkedEvent"); - if( linkedEvent=='true' ) { + var editDataEntryForm = getFieldValue('editDataEntryForm'); + if(editDataEntryForm=='true') + { + var executionDate = jQuery('#executionDate').val(); + var completed = jQuery('#entryFormContainer input[id=completed]').val(); + var irregular = jQuery('#entryFormContainer input[id=irregular]').val(); + var reportDateDes = jQuery("#ps_" + programStageInstanceId).attr("reportDateDes"); + setInnerHTML('reportDateDescriptionField',reportDateDes); + enable('validationBtn'); + if( executionDate == '' ) + { + disable('validationBtn'); + } + else if( executionDate != ''){ + if ( completed == 'false' ){ + disableCompletedButton(false); + } + else if( completed == 'true' ){ + disableCompletedButton(true); + } + } + + var linkedEvent = jQuery(".stage-object-selected").attr("linkedEvent"); + if( linkedEvent=='true' ) { + blockEntryForm(); + disable('executionDate'); + } + else{ + enable('executionDate'); + } + $(window).scrollTop(200); + } + else + { blockEntryForm(); disable('executionDate'); - } - else{ - enable('executionDate'); - } + hideById('inputCriteriaDiv'); + } + resize(); hideLoader(); hideById('contentDiv'); - $(window).scrollTop(200); } ); } === 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-05-30 06:42:28 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm 2013-08-12 06:23:01 +0000 @@ -5,6 +5,8 @@ + +
    #if( $hasDataEntry == 'true' ) === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm 2013-08-02 04:53:58 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm 2013-08-12 06:23:01 +0000 @@ -71,16 +71,27 @@