=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java 2012-07-30 04:48:17 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java 2012-09-05 14:30:23 +0000 @@ -35,7 +35,6 @@ import org.hisp.dhis.common.BaseIdentifiableObject; import org.hisp.dhis.common.Dxf2Namespace; -import org.hisp.dhis.program.Program; /** * @author Abyot Asalefew @@ -73,8 +72,6 @@ private Set attributeOptions; - private Program program; - // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- @@ -188,16 +185,6 @@ this.valueType = valueType; } - public Program getProgram() - { - return program; - } - - public void setProgram( Program program ) - { - this.program = program; - } - public PatientAttributeGroup getPatientAttributeGroup() { return patientAttributeGroup; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeGroupService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeGroupService.java 2012-03-27 01:29:30 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeGroupService.java 2012-09-05 14:30:23 +0000 @@ -28,8 +28,6 @@ import java.util.Collection; -import org.hisp.dhis.program.Program; - /** * @author Chau Thu Tran * @version $Id$ @@ -49,9 +47,4 @@ PatientAttributeGroup getPatientAttributeGroupByName( String name ); Collection getAllPatientAttributeGroups(); - - Collection getPatientAttributeGroups( Program program ); - - Collection getPatientAttributeGroupsWithoutProgram(); - } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeService.java 2012-03-29 04:15:07 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeService.java 2012-09-05 14:30:23 +0000 @@ -28,8 +28,6 @@ import java.util.Collection; -import org.hisp.dhis.program.Program; - /** * @author Abyot Asalefew * @version $Id$ @@ -59,9 +57,4 @@ PatientAttribute getPatientAttributeByGroupBy(boolean groupBy); Collection getPatientAttributesWithoutGroup(); - - Collection getPatientAttributes( Program program, PatientAttributeGroup group ); - - Collection getPatientAttributes( Program program ); - } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeStore.java 2012-03-29 04:15:07 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeStore.java 2012-09-05 14:30:23 +0000 @@ -30,7 +30,6 @@ import java.util.Collection; import org.hisp.dhis.common.GenericNameableObjectStore; -import org.hisp.dhis.program.Program; /** * @author Abyot Asalefew Gizaw @@ -47,11 +46,7 @@ Collection getByMandatory(boolean mandatory); - Collection get( Program program, PatientAttributeGroup group ); - Collection getWithoutGroup(); PatientAttribute getByGroupBy( boolean groupBy ); - - Collection get( Program program ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierType.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierType.java 2012-03-26 06:36:24 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierType.java 2012-09-05 14:30:23 +0000 @@ -33,7 +33,6 @@ import org.hisp.dhis.common.BaseIdentifiableObject; import org.hisp.dhis.common.Dxf2Namespace; -import org.hisp.dhis.program.Program; @XmlRootElement( name = "patientIdentifierType", namespace = Dxf2Namespace.NAMESPACE ) @XmlAccessorType( value = XmlAccessType.NONE ) @@ -63,8 +62,8 @@ private String type; - private Program program; - + private Boolean personDisplayName; + // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- @@ -186,14 +185,14 @@ this.type = type; } - public Program getProgram() - { - return program; - } - - public void setProgram( Program program ) - { - this.program = program; - } - + public Boolean getPersonDisplayName() + { + return personDisplayName; + } + + public void setPersonDisplayName( Boolean personDisplayName ) + { + this.personDisplayName = personDisplayName; + } + } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeService.java 2012-03-26 06:36:24 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeService.java 2012-09-05 14:30:23 +0000 @@ -28,8 +28,6 @@ import java.util.Collection; -import org.hisp.dhis.program.Program; - /** * @author Abyot Asalefew * @version $Id$ @@ -52,8 +50,6 @@ Collection getPatientIdentifierTypes( boolean mandatory ); - Collection getPatientIdentifierTypes( Program program ); - - Collection getPatientIdentifierTypesWithoutProgram(); + Collection getDisplayedPatientIdentifierTypes( boolean personDisplayName ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeStore.java 2012-03-27 01:29:30 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeStore.java 2012-09-05 14:30:23 +0000 @@ -3,14 +3,11 @@ import java.util.Collection; import org.hisp.dhis.common.GenericNameableObjectStore; -import org.hisp.dhis.program.Program; public interface PatientIdentifierTypeStore extends GenericNameableObjectStore { Collection get( boolean mandatory ); - - Collection get( Program program ); - - Collection getWithoutProgram(); + + Collection getByDisplayed( boolean personDisplayName ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientattributevalue/PatientAttributeValueService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientattributevalue/PatientAttributeValueService.java 2012-07-06 09:59:36 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientattributevalue/PatientAttributeValueService.java 2012-09-05 14:30:23 +0000 @@ -32,7 +32,6 @@ import org.hisp.dhis.patient.Patient; import org.hisp.dhis.patient.PatientAttribute; import org.hisp.dhis.patient.PatientAttributeOption; -import org.hisp.dhis.program.Program; /** * @author Abyot Asalefew @@ -75,9 +74,4 @@ Collection getPatient( PatientAttribute attribute, String value ); void updatePatientAttributeValues( PatientAttributeOption patientAttributeOption); - - Collection getPatientAttributeValues( Patient patient, Program program ); - - Collection getPatientAttributeValuesWithoutProgram( Patient patient ); - } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2012-08-06 09:34:34 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2012-09-05 14:30:23 +0000 @@ -27,6 +27,7 @@ package org.hisp.dhis.program; +import java.util.Collection; import java.util.HashSet; import java.util.Set; @@ -34,6 +35,8 @@ import org.hisp.dhis.common.BaseIdentifiableObject; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.patient.Patient; +import org.hisp.dhis.patient.PatientAttribute; +import org.hisp.dhis.patient.PatientIdentifierType; import org.hisp.dhis.validation.ValidationCriteria; /** @@ -52,7 +55,6 @@ public static final int SINGLE_EVENT_WITH_REGISTRATION = 2; public static final int SINGLE_EVENT_WITHOUT_REGISTRATION = 3; - private String description; @@ -83,9 +85,13 @@ private Integer type; private Boolean displayProvidedOtherFacility; - + private Boolean displayIncidentDate; + private Collection patientIdentifierTypes; + + private Collection patientAttributes; + // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- @@ -247,6 +253,26 @@ this.patientValidationCriteria = patientValidationCriteria; } + public Collection getPatientIdentifierTypes() + { + return patientIdentifierTypes; + } + + public void setPatientIdentifierTypes( Collection patientIdentifierTypes ) + { + this.patientIdentifierTypes = patientIdentifierTypes; + } + + public Collection getPatientAttributes() + { + return patientAttributes; + } + + public void setPatientAttributes( Collection patientAttributes ) + { + this.patientAttributes = patientAttributes; + } + // ------------------------------------------------------------------------- // Logic methods // ------------------------------------------------------------------------- @@ -317,14 +343,14 @@ { return Patient.class.getMethod( "get" + property ).invoke( patient ); } - + public boolean isSingleEvent() { - return type != null && ( SINGLE_EVENT_WITH_REGISTRATION == type || SINGLE_EVENT_WITHOUT_REGISTRATION == type ); + return type != null && (SINGLE_EVENT_WITH_REGISTRATION == type || SINGLE_EVENT_WITHOUT_REGISTRATION == type); } - + public boolean isRegistration() { - return type != null && ( SINGLE_EVENT_WITH_REGISTRATION == type || MULTIPLE_EVENTS_WITH_REGISTRATION == type ); + return type != null && (SINGLE_EVENT_WITH_REGISTRATION == type || MULTIPLE_EVENTS_WITH_REGISTRATION == type); } } === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeGroupService.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeGroupService.java 2012-03-27 01:29:30 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeGroupService.java 2012-09-05 14:30:23 +0000 @@ -83,16 +83,5 @@ { return patientAttributeGroupStore.getAll(); } - - @Override - public Collection getPatientAttributeGroups( Program program ) - { - return patientAttributeGroupStore.get( program ); - } - - @Override - public Collection getPatientAttributeGroupsWithoutProgram() - { - return patientAttributeGroupStore.getWithoutProgram(); - } + } === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeService.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeService.java 2012-03-29 04:15:07 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeService.java 2012-09-05 14:30:23 +0000 @@ -103,20 +103,10 @@ { return patientAttributeStore.getByMandatory( mandatory ); } - - public Collection getPatientAttributes( Program program, PatientAttributeGroup group ) - { - return patientAttributeStore.get( program, group ); - } public Collection getPatientAttributesWithoutGroup() { return patientAttributeStore.getWithoutGroup(); } - - public Collection getPatientAttributes( Program program ) - { - return patientAttributeStore.get( program ); - } } === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientIdentifierTypeService.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientIdentifierTypeService.java 2012-03-26 06:36:24 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientIdentifierTypeService.java 2012-09-05 14:30:23 +0000 @@ -28,7 +28,6 @@ import java.util.Collection; -import org.hisp.dhis.program.Program; import org.springframework.transaction.annotation.Transactional; /** @@ -89,15 +88,9 @@ return patientIdentifierTypeStore.get( mandatory ); } - public Collection getPatientIdentifierTypes( Program program ) - { - return patientIdentifierTypeStore.get( program ); - } - - public Collection getPatientIdentifierTypesWithoutProgram() - { - return patientIdentifierTypeStore.getWithoutProgram(); - } - + public Collection getDisplayedPatientIdentifierTypes( boolean personDisplayName ) + { + return patientIdentifierTypeStore.get( personDisplayName ); + } } === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientAttributeStore.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientAttributeStore.java 2012-03-29 07:25:53 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientAttributeStore.java 2012-09-05 14:30:23 +0000 @@ -29,13 +29,10 @@ import java.util.Collection; -import org.hibernate.Criteria; import org.hibernate.criterion.Restrictions; import org.hisp.dhis.hibernate.HibernateGenericStore; import org.hisp.dhis.patient.PatientAttribute; -import org.hisp.dhis.patient.PatientAttributeGroup; import org.hisp.dhis.patient.PatientAttributeStore; -import org.hisp.dhis.program.Program; /** * @author Abyot Asalefew Gizaw @@ -70,40 +67,8 @@ } @SuppressWarnings("unchecked") - public Collection get( Program program, PatientAttributeGroup group ) - { - Criteria criteria = getCriteria(); - - if ( program == null ) - { - criteria.add( Restrictions.isNull( "program" ) ); - } - else - { - criteria.add( Restrictions.eq( "program", program ) ); - } - - if ( group == null ) - { - criteria.add( Restrictions.isNull( "patientAttributeGroup" ) ); - } - else - { - criteria.add( Restrictions.eq( "patientAttributeGroup", group ) ); - } - - return criteria.list(); - } - - @SuppressWarnings("unchecked") public Collection getWithoutGroup() { return getCriteria( Restrictions.isNull( "patientAttributeGroup" ) ).list(); } - - @SuppressWarnings("unchecked") - public Collection get( Program program ) - { - return getCriteria( Restrictions.eq( "program", program ) ).list(); - } } === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierTypeStore.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierTypeStore.java 2012-03-26 06:36:24 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierTypeStore.java 2012-09-05 14:30:23 +0000 @@ -33,7 +33,6 @@ import org.hisp.dhis.hibernate.HibernateGenericStore; import org.hisp.dhis.patient.PatientIdentifierType; import org.hisp.dhis.patient.PatientIdentifierTypeStore; -import org.hisp.dhis.program.Program; public class HibernatePatientIdentifierTypeStore extends HibernateGenericStore @@ -44,16 +43,10 @@ { return getCriteria( Restrictions.eq( "mandatory", mandatory ) ).list(); } - - @SuppressWarnings( "unchecked" ) - public Collection get( Program program ) - { - return getCriteria( Restrictions.eq( "program", program ) ).list(); - } - - @SuppressWarnings( "unchecked" ) - public Collection getWithoutProgram() - { - return getCriteria( Restrictions.isNull( "program" ) ).list(); + + @SuppressWarnings( "unchecked" ) + public Collection getByDisplayed( boolean personDisplayName ) + { + return getCriteria( Restrictions.eq( "personDisplayName", personDisplayName ) ).list(); } } === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2012-08-16 15:47:08 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2012-09-05 14:30:23 +0000 @@ -122,6 +122,9 @@ executeSql( "ALTER TABLE patientattribute DROP COLUMN inheritable" ); executeSql( "ALTER TABLE programstageinstance DROP COLUMN stageInProgram" ); + + updateRelationshipIdentifiers(); + updateRelationshipAttributes(); } // ------------------------------------------------------------------------- @@ -305,6 +308,62 @@ } } + private void updateRelationshipIdentifiers() + { + StatementHolder holder = statementManager.getHolder(); + + try + { + Statement statement = holder.getStatement(); + + ResultSet resultSet = statement + .executeQuery( "SELECT distinct programid, patientidentifiertypeid FROM patientidentifiertype" ); + + while ( resultSet.next() ) + { + executeSql( "INSERT into program_patientIdentifierTypes( programid, patientidentifiertypeid) values (" + resultSet.getString( 1 ) + "," + resultSet.getString( 2 ) + ")"); + } + + executeSql( "ALTER TABLE patientidentifiertype DROP COLUMN programid" ); + } + catch ( Exception ex ) + { + log.debug( ex ); + } + finally + { + holder.close(); + } + } + + private void updateRelationshipAttributes() + { + StatementHolder holder = statementManager.getHolder(); + + try + { + Statement statement = holder.getStatement(); + + ResultSet resultSet = statement + .executeQuery( "SELECT distinct programid, patientattributeid FROM program_patientAttributes" ); + + while ( resultSet.next() ) + { + executeSql( "INSERT into program_patientAttributes( programid, patientattributeid) values (" + resultSet.getString( 1 ) + "," + resultSet.getString( 2 ) + ")"); + } + + executeSql( "ALTER TABLE patientattribute DROP COLUMN programid" ); + } + catch ( Exception ex ) + { + log.debug( ex ); + } + finally + { + holder.close(); + } + } + private int executeSql( String sql ) { try === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/DefaultPatientAttributeValueService.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/DefaultPatientAttributeValueService.java 2012-07-06 09:59:36 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/DefaultPatientAttributeValueService.java 2012-09-05 14:30:23 +0000 @@ -38,7 +38,6 @@ import org.hisp.dhis.patient.Patient; import org.hisp.dhis.patient.PatientAttribute; import org.hisp.dhis.patient.PatientAttributeOption; -import org.hisp.dhis.program.Program; import org.springframework.transaction.annotation.Transactional; /** @@ -219,14 +218,4 @@ { patientAttributeValueStore.updatePatientAttributeValues( patientAttributeOption ); } - - public Collection getPatientAttributeValues( Patient patient, Program program ) - { - return patientAttributeValueStore.get( patient, program ); - } - - public Collection getPatientAttributeValuesWithoutProgram( Patient patient ) - { - return patientAttributeValueStore.getWithoutProgram( patient ); - } } === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml' --- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml 2012-07-30 04:48:17 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml 2012-09-05 14:30:23 +0000 @@ -30,7 +30,5 @@ - - === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientIdentifierType.hbm.xml' --- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientIdentifierType.hbm.xml 2012-03-26 06:36:24 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientIdentifierType.hbm.xml 2012-09-05 14:30:23 +0000 @@ -24,7 +24,7 @@ - - + + === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml' --- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml 2012-08-06 09:34:34 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml 2012-09-05 14:30:23 +0000 @@ -44,6 +44,16 @@ + + + + + + + + + + === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ShowEventWithRegistrationFormAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ShowEventWithRegistrationFormAction.java 2012-08-02 05:27:55 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ShowEventWithRegistrationFormAction.java 2012-09-05 14:30:23 +0000 @@ -29,19 +29,19 @@ import java.util.ArrayList; 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.dataentryform.DataEntryForm; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager; import org.hisp.dhis.patient.PatientAttribute; import org.hisp.dhis.patient.PatientAttributeGroup; -import org.hisp.dhis.patient.PatientAttributeGroupService; import org.hisp.dhis.patient.PatientAttributeService; import org.hisp.dhis.patient.PatientIdentifierType; import org.hisp.dhis.patient.PatientIdentifierTypeService; -import org.hisp.dhis.patient.comparator.PatientAttributeGroupSortOrderComparator; import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramDataEntryService; import org.hisp.dhis.program.ProgramService; @@ -76,13 +76,6 @@ this.patientAttributeService = patientAttributeService; } - private PatientAttributeGroupService patientAttributeGroupService; - - public void setPatientAttributeGroupService( PatientAttributeGroupService patientAttributeGroupService ) - { - this.patientAttributeGroupService = patientAttributeGroupService; - } - private PatientIdentifierTypeService patientIdentifierTypeService; public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService ) @@ -110,9 +103,9 @@ private Integer programId; - private Collection noGroupAttributes; + private Collection noGroupAttributes = new HashSet(); - private List attributeGroups; + private Map> attributeGroupsMap = new HashMap>(); private Collection identifierTypes; @@ -121,23 +114,46 @@ private String customDataEntryFormCode; private List programStageDataElements = new ArrayList(); - + private ProgramStage programStage; - + // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- public String execute() { - identifierTypes = patientIdentifierTypeService.getPatientIdentifierTypesWithoutProgram(); - - noGroupAttributes = patientAttributeService.getPatientAttributes( null, null ); - - attributeGroups = new ArrayList( patientAttributeGroupService - .getPatientAttributeGroupsWithoutProgram() ); - Collections.sort( attributeGroups, new PatientAttributeGroupSortOrderComparator() ); - + identifierTypes = patientIdentifierTypeService.getAllPatientIdentifierTypes(); + Collection patientAttributes = patientAttributeService.getAllPatientAttributes(); + Collection programs = programService.getAllPrograms(); + for ( Program program : programs ) + { + identifierTypes.removeAll( program.getPatientIdentifierTypes() ); + patientAttributes.removeAll( program.getPatientAttributes() ); + } + + for( PatientAttribute patientAttribute : patientAttributes ) + { + PatientAttributeGroup attributeGroup = patientAttribute.getPatientAttributeGroup(); + if( attributeGroup!=null){ + if( attributeGroupsMap.containsKey( attributeGroup ) ) + { + Collection attributes = attributeGroupsMap.get( attributeGroup ); + attributes.add(patientAttribute); + } + else + { + Collection attributes = new HashSet(); + attributes.add(patientAttribute); + attributeGroupsMap.put( attributeGroup, attributes ); + } + } + else + { + noGroupAttributes.add( patientAttribute ); + } + } + organisationUnit = selectionManager.getSelectedOrganisationUnit(); // Get data entry form @@ -154,8 +170,8 @@ } else { - programStageDataElements = new ArrayList( programStage - .getProgramStageDataElements() ); + programStageDataElements = new ArrayList( + programStage.getProgramStageDataElements() ); } return SUCCESS; @@ -170,9 +186,9 @@ return identifierTypes; } - public List getAttributeGroups() + public Map> getAttributeGroupsMap() { - return attributeGroups; + return attributeGroupsMap; } public void setProgramId( Integer programId ) === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetPatientAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetPatientAction.java 2012-06-14 13:07:22 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetPatientAction.java 2012-09-05 14:30:23 +0000 @@ -26,24 +26,21 @@ */ package org.hisp.dhis.caseentry.action.patient; -import java.util.ArrayList; 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.patient.Patient; import org.hisp.dhis.patient.PatientAttribute; import org.hisp.dhis.patient.PatientAttributeGroup; -import org.hisp.dhis.patient.PatientAttributeGroupService; import org.hisp.dhis.patient.PatientAttributeService; import org.hisp.dhis.patient.PatientIdentifier; import org.hisp.dhis.patient.PatientIdentifierService; import org.hisp.dhis.patient.PatientIdentifierType; import org.hisp.dhis.patient.PatientIdentifierTypeService; import org.hisp.dhis.patient.PatientService; -import org.hisp.dhis.patient.comparator.PatientAttributeGroupSortOrderComparator; import org.hisp.dhis.patientattributevalue.PatientAttributeValue; import org.hisp.dhis.patientattributevalue.PatientAttributeValueService; import org.hisp.dhis.program.Program; @@ -74,8 +71,6 @@ private PatientAttributeService patientAttributeService; - private PatientAttributeGroupService patientAttributeGroupService; - private PatientIdentifierTypeService patientIdentifierTypeService; private RelationshipService relationshipService; @@ -94,7 +89,7 @@ private Map patientAttributeValueMap = new HashMap(); - private Collection noGroupAttributes; + private Collection noGroupAttributes = new HashSet(); private List attributeGroups; @@ -109,6 +104,8 @@ private String systemIdentifier; private Relationship relationship; + + private Map> attributeGroupsMap = new HashMap>(); // ------------------------------------------------------------------------- // Action implementation @@ -122,12 +119,46 @@ programs = programService.getAllPrograms(); // ------------------------------------------------------------------------- - // Get identifier + // Get identifier-types && attributes // ------------------------------------------------------------------------- patientIdentifier = patientIdentifierService.getPatientIdentifier( patient ); - identifierTypes = patientIdentifierTypeService.getPatientIdentifierTypesWithoutProgram(); + identifierTypes = patientIdentifierTypeService.getAllPatientIdentifierTypes(); + Collection patientAttributes = patientAttributeService.getAllPatientAttributes(); + + Collection programs = programService.getAllPrograms(); + for ( Program program : programs ) + { + identifierTypes.removeAll( program.getPatientIdentifierTypes() ); + patientAttributes.removeAll( program.getPatientAttributes() ); + } + + for( PatientAttribute patientAttribute : patientAttributes ) + { + PatientAttributeGroup attributeGroup = patientAttribute.getPatientAttributeGroup(); + if( attributeGroup!=null){ + if( attributeGroupsMap.containsKey( attributeGroup ) ) + { + Collection attributes = attributeGroupsMap.get( attributeGroup ); + attributes.add(patientAttribute); + } + else + { + Collection attributes = new HashSet(); + attributes.add(patientAttribute); + attributeGroupsMap.put( attributeGroup, attributes ); + } + } + else + { + noGroupAttributes.add( patientAttribute ); + } + } + + // ------------------------------------------------------------------------- + // Get data + // ------------------------------------------------------------------------- identiferMap = new HashMap(); @@ -165,15 +196,32 @@ // ------------------------------------------------------------------------- // Get patient-attribute values // ------------------------------------------------------------------------- - - attributeGroups = new ArrayList( patientAttributeGroupService - .getPatientAttributeGroupsWithoutProgram() ); - Collections.sort( attributeGroups, new PatientAttributeGroupSortOrderComparator() ); - - noGroupAttributes = patientAttributeService.getPatientAttributes( null, null ); + + + for( PatientAttribute patientAttribute : patientAttributes ) + { + PatientAttributeGroup attributeGroup = patientAttribute.getPatientAttributeGroup(); + if( attributeGroup!=null){ + if( attributeGroupsMap.containsKey( attributeGroup ) ) + { + Collection attributes = attributeGroupsMap.get( attributeGroup ); + attributes.add(patientAttribute); + } + else + { + Collection attributes = new HashSet(); + attributes.add(patientAttribute); + attributeGroupsMap.put( attributeGroup, attributes ); + } + } + else + { + noGroupAttributes.add( patientAttribute ); + } + } Collection patientAttributeValues = patientAttributeValueService - .getPatientAttributeValuesWithoutProgram( patient ); + .getPatientAttributeValues( patient ); for ( PatientAttributeValue patientAttributeValue : patientAttributeValues ) { @@ -197,7 +245,12 @@ // ----------------------------------------------------------------------------- // Getter / Setter // ----------------------------------------------------------------------------- - + + public Map> getAttributeGroupsMap() + { + return attributeGroupsMap; + } + public void setPatientService( PatientService patientService ) { this.patientService = patientService; @@ -227,12 +280,7 @@ { this.patientAttributeService = patientAttributeService; } - - public void setPatientAttributeGroupService( PatientAttributeGroupService patientAttributeGroupService ) - { - this.patientAttributeGroupService = patientAttributeGroupService; - } - + public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService ) { this.patientIdentifierTypeService = patientIdentifierTypeService; === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java 2012-08-28 05:48:46 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java 2012-09-05 14:30:23 +0000 @@ -30,6 +30,7 @@ import java.util.Collection; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; @@ -38,11 +39,9 @@ import org.hisp.dhis.patient.PatientAttribute; import org.hisp.dhis.patient.PatientAttributeGroup; import org.hisp.dhis.patient.PatientAttributeGroupService; -import org.hisp.dhis.patient.PatientAttributeService; import org.hisp.dhis.patient.PatientIdentifier; import org.hisp.dhis.patient.PatientIdentifierService; import org.hisp.dhis.patient.PatientIdentifierType; -import org.hisp.dhis.patient.PatientIdentifierTypeService; import org.hisp.dhis.patient.comparator.PatientAttributeGroupSortOrderComparator; import org.hisp.dhis.patientattributevalue.PatientAttributeValue; import org.hisp.dhis.patientattributevalue.PatientAttributeValueService; @@ -69,12 +68,8 @@ private ProgramStageInstanceService programStageInstanceService; - private PatientIdentifierTypeService identifierTypeService; - private PatientIdentifierService patientIdentifierService; - private PatientAttributeService patientAttributeService; - private PatientAttributeGroupService patientAttributeGroupService; private PatientAttributeValueService patientAttributeValueService; @@ -95,7 +90,7 @@ private Collection identifierTypes; - private Collection noGroupAttributes; + private Collection noGroupAttributes = new HashSet(); private List attributeGroups; @@ -105,6 +100,8 @@ private Map statusMap = new HashMap(); + private Map> attributeGroupsMap = new HashMap>(); + // ------------------------------------------------------------------------- // Getters/Setters // ------------------------------------------------------------------------- @@ -129,11 +126,6 @@ return patientAttributeValueMap; } - public void setPatientAttributeService( PatientAttributeService patientAttributeService ) - { - this.patientAttributeService = patientAttributeService; - } - public void setPatientAttributeGroupService( PatientAttributeGroupService patientAttributeGroupService ) { this.patientAttributeGroupService = patientAttributeGroupService; @@ -154,11 +146,6 @@ this.patientIdentifierService = patientIdentifierService; } - public void setIdentifierTypeService( PatientIdentifierTypeService identifierTypeService ) - { - this.identifierTypeService = identifierTypeService; - } - public void setProgramInstanceService( ProgramInstanceService programInstanceService ) { this.programInstanceService = programInstanceService; @@ -193,6 +180,11 @@ { return hasDataEntry; } + + public Map> getAttributeGroupsMap() + { + return attributeGroupsMap; + } public Map getStatusMap() { @@ -222,9 +214,9 @@ .getProgramStageInstances() ); } - loadIdentifierTypes(programInstance); + loadIdentifierTypes( programInstance ); - loadPatientAttributes(programInstance); + loadPatientAttributes( programInstance ); hasDataEntry = showDataEntry( orgunit, programInstance.getProgram(), programInstance ); @@ -241,7 +233,7 @@ // Load identifier types of the selected program // --------------------------------------------------------------------- - identifierTypes = identifierTypeService.getPatientIdentifierTypes( programInstance.getProgram() ); + identifierTypes = programInstance.getProgram().getPatientIdentifierTypes(); identiferMap = new HashMap(); if ( identifierTypes != null && identifierTypes.size() > 0 ) @@ -262,11 +254,30 @@ // Load patient-attributes of the selected program // --------------------------------------------------------------------- - attributeGroups = new ArrayList( - patientAttributeGroupService.getPatientAttributeGroups( programInstance.getProgram() ) ); - Collections.sort( attributeGroups, new PatientAttributeGroupSortOrderComparator() ); + Collection patientAttributes = programInstance.getProgram().getPatientAttributes(); - noGroupAttributes = patientAttributeService.getPatientAttributes( programInstance.getProgram(), null ); + for ( PatientAttribute patientAttribute : patientAttributes ) + { + PatientAttributeGroup attributeGroup = patientAttribute.getPatientAttributeGroup(); + if ( attributeGroup != null ) + { + if ( attributeGroupsMap.containsKey( attributeGroup ) ) + { + Collection attributes = attributeGroupsMap.get( attributeGroup ); + attributes.add( patientAttribute ); + } + else + { + Collection attributes = new HashSet(); + attributes.add( patientAttribute ); + attributeGroupsMap.put( attributeGroup, attributes ); + } + } + else + { + noGroupAttributes.add( patientAttribute ); + } + } Collection patientAttributeValues = patientAttributeValueService .getPatientAttributeValues( programInstance.getPatient() ); === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveIdentifierAndAttributeAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveIdentifierAndAttributeAction.java 2012-06-18 03:29:11 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveIdentifierAndAttributeAction.java 2012-09-05 14:30:23 +0000 @@ -38,11 +38,9 @@ import org.hisp.dhis.patient.PatientAttribute; import org.hisp.dhis.patient.PatientAttributeOption; import org.hisp.dhis.patient.PatientAttributeOptionService; -import org.hisp.dhis.patient.PatientAttributeService; import org.hisp.dhis.patient.PatientIdentifier; import org.hisp.dhis.patient.PatientIdentifierService; import org.hisp.dhis.patient.PatientIdentifierType; -import org.hisp.dhis.patient.PatientIdentifierTypeService; import org.hisp.dhis.patient.PatientService; import org.hisp.dhis.patientattributevalue.PatientAttributeValue; import org.hisp.dhis.patientattributevalue.PatientAttributeValueService; @@ -65,14 +63,10 @@ private PatientService patientService; - private PatientIdentifierTypeService identifierTypeService; - private PatientIdentifierService patientIdentifierService; private PatientAttributeValueService patientAttributeValueService; - - private PatientAttributeService patientAttributeService; - + private PatientAttributeOptionService patientAttributeOptionService; private ProgramService programService; @@ -101,11 +95,6 @@ this.patientAttributeValueService = patientAttributeValueService; } - public void setPatientAttributeService( PatientAttributeService patientAttributeService ) - { - this.patientAttributeService = patientAttributeService; - } - public void setPatientAttributeOptionService( PatientAttributeOptionService patientAttributeOptionService ) { this.patientAttributeOptionService = patientAttributeOptionService; @@ -126,11 +115,6 @@ this.patientIdentifierService = patientIdentifierService; } - public void setIdentifierTypeService( PatientIdentifierTypeService identifierTypeService ) - { - this.identifierTypeService = identifierTypeService; - } - public void setPatientId( Integer patientId ) { this.patientId = patientId; @@ -170,7 +154,7 @@ String value = null; - Collection identifierTypes = identifierTypeService.getPatientIdentifierTypes( program ); + Collection identifierTypes = program.getPatientIdentifierTypes(); PatientIdentifier identifier = null; @@ -215,7 +199,7 @@ String value = null; - Collection attributes = patientAttributeService.getPatientAttributes( program ); + Collection attributes = program.getPatientAttributes(); PatientAttributeValue attributeValue = null; === 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 2012-08-16 06:20:33 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SearchPatientAction.java 2012-09-05 14:30:23 +0000 @@ -37,7 +37,10 @@ import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager; import org.hisp.dhis.paging.ActionPagingSupport; import org.hisp.dhis.patient.Patient; +import org.hisp.dhis.patient.PatientIdentifierType; import org.hisp.dhis.patient.PatientService; +import org.hisp.dhis.program.Program; +import org.hisp.dhis.program.ProgramService; /** * @author Abyot Asalefew Gizaw @@ -54,6 +57,8 @@ private PatientService patientService; + private ProgramService programService; + // ------------------------------------------------------------------------- // Input/output // ------------------------------------------------------------------------- @@ -63,7 +68,7 @@ private Boolean searchBySelectedOrgunit; private boolean listAll; - + private Collection patients = new ArrayList(); // ------------------------------------------------------------------------- @@ -75,6 +80,11 @@ this.selectionManager = selectionManager; } + public void setProgramService( ProgramService programService ) + { + this.programService = programService; + } + public void setSearchBySelectedOrgunit( Boolean searchBySelectedOrgunit ) { this.searchBySelectedOrgunit = searchBySelectedOrgunit; @@ -90,6 +100,11 @@ this.searchTexts = searchTexts; } + public boolean isListAll() + { + return listAll; + } + public void setListAll( boolean listAll ) { this.listAll = listAll; @@ -114,6 +129,20 @@ return mapPatientOrgunit; } + private List programIds; + + public void setProgramIds( List programIds ) + { + this.programIds = programIds; + } + + private List identifierTypes = new ArrayList(); + + public List getIdentifierTypes() + { + return identifierTypes; + } + // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -147,6 +176,15 @@ { mapPatientOrgunit.put( patient.getId(), getHierarchyOrgunit( patient.getOrganisationUnit() ) ); } + + if ( programIds != null ) + { + for( Integer programId : programIds ) + { + Program progam = programService.getProgram( programId ); + identifierTypes.addAll( progam.getPatientIdentifierTypes() ); + } + } } return SUCCESS; === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddPatientFormAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddPatientFormAction.java 2012-09-05 01:41:15 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddPatientFormAction.java 2012-09-05 14:30:23 +0000 @@ -27,20 +27,20 @@ package org.hisp.dhis.caseentry.action.patient; -import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; -import java.util.List; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager; import org.hisp.dhis.patient.PatientAttribute; import org.hisp.dhis.patient.PatientAttributeGroup; -import org.hisp.dhis.patient.PatientAttributeGroupService; import org.hisp.dhis.patient.PatientAttributeService; import org.hisp.dhis.patient.PatientIdentifierType; import org.hisp.dhis.patient.PatientIdentifierTypeService; -import org.hisp.dhis.patient.comparator.PatientAttributeGroupSortOrderComparator; +import org.hisp.dhis.program.Program; +import org.hisp.dhis.program.ProgramService; import com.opensymphony.xwork2.Action; @@ -69,13 +69,6 @@ this.patientAttributeService = patientAttributeService; } - private PatientAttributeGroupService patientAttributeGroupService; - - public void setPatientAttributeGroupService( PatientAttributeGroupService patientAttributeGroupService ) - { - this.patientAttributeGroupService = patientAttributeGroupService; - } - private PatientIdentifierTypeService patientIdentifierTypeService; public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService ) @@ -83,12 +76,19 @@ this.patientIdentifierTypeService = patientIdentifierTypeService; } + private ProgramService programService; + + public void setProgramService( ProgramService programService ) + { + this.programService = programService; + } + // ------------------------------------------------------------------------- // Input/Output // ------------------------------------------------------------------------- private Boolean addNewForm; - + public Boolean getAddNewForm() { return addNewForm; @@ -99,27 +99,52 @@ this.addNewForm = addNewForm; } - private Collection noGroupAttributes; - - private List attributeGroups; + private Collection noGroupAttributes = new HashSet(); private Collection identifierTypes; private OrganisationUnit organisationUnit; + private Map> attributeGroupsMap = new HashMap>(); + // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- public String execute() { - identifierTypes = patientIdentifierTypeService.getPatientIdentifierTypesWithoutProgram(); - - noGroupAttributes = patientAttributeService.getPatientAttributes( null, null ); - - attributeGroups = new ArrayList( patientAttributeGroupService - .getPatientAttributeGroupsWithoutProgram() ); - Collections.sort( attributeGroups, new PatientAttributeGroupSortOrderComparator() ); + identifierTypes = patientIdentifierTypeService.getAllPatientIdentifierTypes(); + Collection patientAttributes = patientAttributeService.getAllPatientAttributes(); + Collection programs = programService.getAllPrograms(); + for ( Program program : programs ) + { + identifierTypes.removeAll( program.getPatientIdentifierTypes() ); + patientAttributes.removeAll( program.getPatientAttributes() ); + } + + attributeGroupsMap = new HashMap>(); + for ( PatientAttribute patientAttribute : patientAttributes ) + { + PatientAttributeGroup attributeGroup = patientAttribute.getPatientAttributeGroup(); + if ( attributeGroup != null ) + { + if ( attributeGroupsMap.containsKey( attributeGroup ) ) + { + Collection attributes = attributeGroupsMap.get( attributeGroup ); + attributes.add( patientAttribute ); + } + else + { + Collection attributes = new HashSet(); + attributes.add( patientAttribute ); + attributeGroupsMap.put( attributeGroup, attributes ); + } + } + else + { + noGroupAttributes.add( patientAttribute ); + } + } organisationUnit = selectionManager.getSelectedOrganisationUnit(); @@ -134,12 +159,7 @@ { return identifierTypes; } - - public List getAttributeGroups() - { - return attributeGroups; - } - + public Collection getNoGroupAttributes() { return noGroupAttributes; @@ -149,4 +169,9 @@ { return organisationUnit; } + + public Map> getAttributeGroupsMap() + { + return attributeGroupsMap; + } } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddRelationshipPatientAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddRelationshipPatientAction.java 2012-03-27 01:29:30 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddRelationshipPatientAction.java 2012-09-05 14:30:23 +0000 @@ -27,25 +27,24 @@ package org.hisp.dhis.caseentry.action.patient; -import java.util.ArrayList; 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.patient.Patient; import org.hisp.dhis.patient.PatientAttribute; import org.hisp.dhis.patient.PatientAttributeGroup; -import org.hisp.dhis.patient.PatientAttributeGroupService; import org.hisp.dhis.patient.PatientAttributeService; import org.hisp.dhis.patient.PatientIdentifier; import org.hisp.dhis.patient.PatientIdentifierType; import org.hisp.dhis.patient.PatientIdentifierTypeService; import org.hisp.dhis.patient.PatientService; -import org.hisp.dhis.patient.comparator.PatientAttributeGroupSortOrderComparator; import org.hisp.dhis.patientattributevalue.PatientAttributeValue; import org.hisp.dhis.patientattributevalue.PatientAttributeValueService; +import org.hisp.dhis.program.Program; +import org.hisp.dhis.program.ProgramService; import org.hisp.dhis.relationship.RelationshipType; import org.hisp.dhis.relationship.RelationshipTypeService; @@ -67,23 +66,21 @@ private PatientAttributeService patientAttributeService; - private PatientAttributeGroupService patientAttributeGroupService; - private PatientIdentifierTypeService patientIdentifierTypeService; private RelationshipTypeService relationshipTypeService; private PatientAttributeValueService patientAttributeValueService; + private ProgramService programService; + // ------------------------------------------------------------------------- // Input/Output // ------------------------------------------------------------------------- private Integer id; - private Collection noGroupAttributes; - - private List attributeGroups; + private Collection noGroupAttributes = new HashSet(); private Collection identifierTypes; @@ -95,6 +92,8 @@ private Map attributeMap; + private Map> attributeGroupsMap = new HashMap>(); + // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -104,8 +103,36 @@ patient = patientService.getPatient( id.intValue() ); identifierTypes = patientIdentifierTypeService.getAllPatientIdentifierTypes(); + Collection patientAttributes = patientAttributeService.getAllPatientAttributes(); + Collection programs = programService.getAllPrograms(); + for ( Program program : programs ) + { + identifierTypes.removeAll( program.getPatientIdentifierTypes() ); + patientAttributes.removeAll( program.getPatientAttributes() ); + } - noGroupAttributes = new ArrayList( patientAttributeService.getPatientAttributes( null, null ) ); + for ( PatientAttribute patientAttribute : patientAttributes ) + { + PatientAttributeGroup attributeGroup = patientAttribute.getPatientAttributeGroup(); + if ( attributeGroup != null ) + { + if ( attributeGroupsMap.containsKey( attributeGroup ) ) + { + Collection attributes = attributeGroupsMap.get( attributeGroup ); + attributes.add( patientAttribute ); + } + else + { + Collection attributes = new HashSet(); + attributes.add( patientAttribute ); + attributeGroupsMap.put( attributeGroup, attributes ); + } + } + else + { + noGroupAttributes.add( patientAttribute ); + } + } relationshipTypes = relationshipTypeService.getAllRelationshipTypes(); @@ -121,14 +148,8 @@ // Get patient-attribute values // ------------------------------------------------------------------------- - attributeGroups = new ArrayList( patientAttributeGroupService - .getPatientAttributeGroupsWithoutProgram() ); - Collections.sort( attributeGroups, new PatientAttributeGroupSortOrderComparator() ); - - noGroupAttributes = patientAttributeService.getPatientAttributes( null, null ); - Collection patientAttributeValues = patientAttributeValueService - .getPatientAttributeValuesWithoutProgram( patient ); + .getPatientAttributeValues( patient ); for ( PatientAttributeValue patientAttributeValue : patientAttributeValues ) { @@ -151,6 +172,16 @@ // ------------------------------------------------------------------------- // Getter/Setter // ------------------------------------------------------------------------- + + public void setProgramService( ProgramService programService ) + { + this.programService = programService; + } + + public Map> getAttributeGroupsMap() + { + return attributeGroupsMap; + } public void setId( Integer id ) { @@ -161,12 +192,7 @@ { return identifierTypes; } - - public Collection getAttributeGroups() - { - return attributeGroups; - } - + public Collection getNoGroupAttributes() { return noGroupAttributes; @@ -202,11 +228,6 @@ this.patientAttributeService = patientAttributeService; } - public void setPatientAttributeGroupService( PatientAttributeGroupService patientAttributeGroupService ) - { - this.patientAttributeGroupService = patientAttributeGroupService; - } - public void setPatientService( PatientService patientService ) { this.patientService = patientService; === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/LoadPatientPropertiesAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/LoadPatientPropertiesAction.java 2012-05-29 13:03:38 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/LoadPatientPropertiesAction.java 2012-09-05 14:30:23 +0000 @@ -111,11 +111,17 @@ { Program program = programService.getProgram( programId ); - identifierTypes = identifierTypeService.getPatientIdentifierTypesWithoutProgram(); - identifierTypes.addAll( identifierTypeService.getPatientIdentifierTypes( program ) ); + identifierTypes = identifierTypeService.getAllPatientIdentifierTypes(); + patientAttributes = attributeService.getAllPatientAttributes(); - patientAttributes.addAll( attributeService.getPatientAttributes( null, null ) ); - patientAttributes.addAll( attributeService.getPatientAttributes( program ) ); + Collection programs = programService.getAllPrograms(); + programs.remove( program ); + + for ( Program _program : programs ) + { + identifierTypes.removeAll( _program.getPatientIdentifierTypes() ); + patientAttributes.removeAll( _program.getPatientAttributes() ); + } 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 2012-09-04 10:10:05 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2012-09-05 14:30:23 +0000 @@ -31,6 +31,7 @@ + - - - + + + - - - - @@ -806,14 +796,13 @@ - + /dhis-web-commons/ajax/jsonResponseSuccess.vm - F_PATIENT_DATAVALUE_ADD,F_PATIENT_DATAVALUE_UPDATE,F_PATIENT_DATAVALUE_DELETE + F_PATIENT_DATAVALUE_ADD,F_PATIENT_DATAVALUE_UPDATE,F_PATIENT_DATAVALUE_DELETE - + /dhis-web-commons/ajax/jsonResponseSuccess.vm - F_PATIENT_DATAVALUE_ADD,F_PATIENT_DATAVALUE_UPDATE,F_PATIENT_DATAVALUE_DELETE + F_PATIENT_DATAVALUE_ADD,F_PATIENT_DATAVALUE_UPDATE,F_PATIENT_DATAVALUE_DELETE plainTextError F_PATIENT_DATAVALUE_ADD,F_PATIENT_DATAVALUE_UPDATE,F_PATIENT_DATAVALUE_DELETE - + @@ -107,28 +107,28 @@ style/style.css F_NAME_BASED_DATA_ENTRY - + /dhis-web-caseentry/jsonSingleEventPrograms.vm F_NAME_BASED_DATA_ENTRY - + /dhis-web-commons/ajax/jsonResponseSuccess.vm - /dhis-web-commons/ajax/jsonResponseInput.vm + /dhis-web-commons/ajax/jsonResponseInput.vm F_PATIENT_DATAVALUE_ADD,F_PATIENT_DATAVALUE_UPDATE,F_PATIENT_DATAVALUE_DELETE - + /dhis-web-caseentry/jsonProgramInstances.vm - + @@ -137,36 +137,37 @@ /dhis-web-commons/ajax/jsonResponseError.vm F_PATIENT_DATAVALUE_ADD,F_PATIENT_DATAVALUE_UPDATE,F_PATIENT_DATAVALUE_DELETE - + /content.vm /dhis-web-caseentry/validationResult.vm - - - /dhis-web-caseentry/jsonOptions.vm - - + + + /dhis-web-caseentry/jsonOptions.vm + + /dhis-web-caseentry/jsonProgramStageDataElements.vm - + /content.vm /dhis-web-caseentry/programStageInstancesList.vm F_NAME_BASED_DATA_ENTRY - + /dhis-web-commons/ajax/jsonResponseSuccess.vm F_PATIENT_REMOVE_EMPTY_EVENTS - + /dhis-web-caseentry/multiDataEntrySelect.vm /dhis-web-caseentry/dataEntryMenu.vm style/style.css - ../dhis-web-commons/ouwt/ouwt.js,javascript/commons.js,javascript/multiDataEntry.js + ../dhis-web-commons/ouwt/ouwt.js,javascript/commons.js,javascript/multiDataEntry.js F_NAME_BASED_DATA_ENTRY @@ -234,9 +235,9 @@ getDataRecords.action?programId=${programId} F_PATIENT_DATAVALUE_ADD,F_PATIENT_DATAVALUE_UPDATE,F_PATIENT_DATAVALUE_DELETE - + - + @@ -253,26 +254,26 @@ style/style.css F_NAME_BASED_DATA_ENTRY - + /dhis-web-caseentry/jsonSingleEventPrograms.vm F_NAME_BASED_DATA_ENTRY - + /content.vm /dhis-web-caseentry/addSingleEventRegistration.vm style/style.css - + status.vm F_PATIENT_DATAVALUE_ADD,F_PATIENT_DATAVALUE_UPDATE,F_PATIENT_DATAVALUE_DELETE - + /content.vm /dhis-web-caseentry/records.vm - - /dhis-web-caseentry/responsePrograms.vm - - /dhis-web-caseentry/i18n.vm - - + + /dhis-web-caseentry/i18n.vm + + javascript/caseagg.js F_PATIENT_AGGREGATION - + @@ -410,7 +411,7 @@ style/style.css F_PATIENT_MANAGEMENT - + @@ -427,7 +428,7 @@ style/style.css F_PATIENT_ADD - + @@ -435,7 +436,7 @@ /dhis-web-caseentry/patientRegistrationList.vm F_PATIENT_MANAGEMENT - + @@ -510,35 +511,35 @@ F_PATIENT_ADD - - /content.vm - + /dhis-web-caseentry/patientHistory.vm - + /content.vm /dhis-web-caseentry/programInstanceHistory.vm - + /content.vm - /dhis-web-caseentry/patientLocation.vm + /dhis-web-caseentry/patientLocation.vm F_PATIENT_UPDATE - + /dhis-web-commons/ajax/jsonResponseSuccess.vm F_PATIENT_UPDATE - + /dhis-web-caseentry/responseProgramInstance.vm - + /content.vm @@ -598,19 +599,19 @@ plainTextError F_PROGRAM_ENROLLMENT - + status.vm F_PATIENT_UPDATE, F_PROGRAM_ENROLLMENT - + status.vm F_PATIENT_UPDATE, F_PROGRAM_ENROLLMENT - + /dhis-web-commons/ajax/xmlResponseInput.vm - plainTextError + plainTextError F_RELATIONSHIP_ADD @@ -690,7 +691,7 @@ /dhis-web-commons/ajax/xmlResponseError.vm /dhis-web-commons/ajax/xmlResponseInput.vm - plainTextError + plainTextError F_RELATIONSHIP_DELETE @@ -720,9 +721,9 @@ /dhis-web-commons/ajax/jsonResponseSuccess.vm F_RELATIONSHIP_ADD - + - + @@ -733,40 +734,40 @@ style/style.css F_GENERATE_BENEFICIARY_TABULAR_REPORT - + /dhis-web-caseentry/jsonminOrganisationUnitChildren.vm - + - - /dhis-web-caseentry/jsonTabularInitialize.vm + + /dhis-web-caseentry/jsonTabularInitialize.vm - + /dhis-web-caseentry/jsonPatientProperties.vm - + /dhis-web-caseentry/jsonProgramStages.vm - + /dhis-web-caseentry/responseDataElements.vm - + /dhis-web-caseentry/responseTabularParams.vm - + @@ -774,51 +775,51 @@ /dhis-web-commons/ajax/jsonResponseInput.vm - + /dhis-web-caseentry/jsonTabularReportResult.vm - + F_GENERATE_BENEFICIARY_TABULAR_REPORT - + - - /dhis-web-commons/ajax/jsonResponseSuccess.vm - - - - - /dhis-web-caseentry/jsonTabularReportList.vm - - - - - /dhis-web-caseentry/jsonTabularReport.vm - - - - - /dhis-web-commons/ajax/jsonResponseSuccess.vm - - - - - /dhis-web-commons/ajax/jsonResponseSuccess.vm - - - + + /dhis-web-commons/ajax/jsonResponseSuccess.vm + + + + + /dhis-web-caseentry/jsonTabularReportList.vm + + + + + /dhis-web-caseentry/jsonTabularReport.vm + + + + + /dhis-web-commons/ajax/jsonResponseSuccess.vm + + + + + /dhis-web-commons/ajax/jsonResponseSuccess.vm + + + /content.vm /dhis-web-caseentry/programStageDataEntryForm.vm - + /dhis-web-caseentry/smsReminderSelect.vm /dhis-web-caseentry/smsMenu.vm style/style.css - ../dhis-web-commons/ouwt/ouwt.js,javascript/commons.js,javascript/smsReminder.js + ../dhis-web-commons/ouwt/ouwt.js,javascript/commons.js,javascript/smsReminder.js F_SMS_REMINDER - + /content.vm /dhis-web-caseentry/smsPatientRecords.vm style/style.css - + /content.vm /dhis-web-caseentry/smsReminderList.vm style/style.css - + /content.vm /dhis-web-caseentry/sendSmsForm.vm style/style.css - - - /dhis-web-commons/ajax/jsonResponseSuccess.vm - /dhis-web-commons/ajax/jsonResponseError.vm - plainTextError - - - - /dhis-web-commons/ajax/jsonResponseSuccess.vm - /dhis-web-commons/ajax/jsonResponseError.vm - plainTextError - - - - - - /content.vm - /dhis-web-caseentry/patientDashboard.vm - style/style.css - - - - - - /dhis-web-commons/ajax/jsonResponseSuccess.vm - - - - /dhis-web-commons/ajax/jsonResponseSuccess.vm - - + + + /dhis-web-commons/ajax/jsonResponseSuccess.vm + /dhis-web-commons/ajax/jsonResponseError.vm + plainTextError + + + + /dhis-web-commons/ajax/jsonResponseSuccess.vm + /dhis-web-commons/ajax/jsonResponseError.vm + plainTextError + + + + + + /content.vm + /dhis-web-caseentry/patientDashboard.vm + style/style.css + + + + + + /dhis-web-commons/ajax/jsonResponseSuccess.vm + + + + /dhis-web-commons/ajax/jsonResponseSuccess.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 2012-08-29 01:33:43 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2012-09-05 14:30:23 +0000 @@ -218,6 +218,7 @@ function getSearchParams() { var params = ""; + var programIds = ""; var programStageId = jQuery('#programStageAddPatient').val(); if( getFieldValue('searchByProgramStage') == "true" && programStageId!=''){ var statusEvent = jQuery('#programStageAddPatientTR [id=statusEvent]').val(); @@ -226,12 +227,17 @@ params += '&searchTexts=prgst_' + programStageId + '_' + statusEvent + '_' + startDueDate + '_' + endDueDate; } + var flag = false; jQuery( '#advancedSearchTB tr' ).each( function( i, row ){ var dateOperator = ""; var p = ""; jQuery( this ).find(':input').each( function( idx, item ){ if( idx == 0){ p = "&searchTexts=" + item.value; + if(item.value=='prg'){ + programIds += '&programIds='; + flag = true; + } } else if( item.name == 'dateOperator'){ dateOperator = item.value; @@ -246,6 +252,11 @@ else{ p += htmlEncode( item.value.toLowerCase().replace(/^\s*/, "").replace(/\s*$/, "") ); } + + if( flag ){ + programIds += item.value; + flag = false; + } } else { p = ""; @@ -257,6 +268,7 @@ params += '&listAll=false'; params += '&searchBySelectedOrgunit=' + byId('searchBySelectedOrgunit').checked; + params += programIds; return params; } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm 2012-08-29 06:02:27 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm 2012-09-05 14:30:23 +0000 @@ -90,12 +90,11 @@ #end -#foreach ($attributeGroup in $attributeGroups ) +#foreach ($attributeGroup in $attributeGroupsMap.keySet() )   $attributeGroup.name - #foreach($attribute in $attributeGroup.attributes ) - #if( $!attribute && $attribute.program ) - #elseif( $!attribute) + #set($attributes = $attributeGroupsMap.get($attributeGroup)) + #foreach($attribute in $attributes ) @@ -122,7 +121,6 @@ #end - #end #end #end === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm 2012-09-05 01:41:15 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm 2012-09-05 14:30:23 +0000 @@ -28,7 +28,13 @@ #foreach( $attribute in $patientAttributes ) #if($attribute)#end #end - + + #foreach( $identifierType in $identifierTypes) + + #end + #if( $identifierTypes.size()==0 ) + + #end @@ -42,16 +48,27 @@ # #foreach( $attribute in $patientAttributes ) #if($attribute) - $attribute.name + $attribute.name #end #end - $i18n.getString( "full_name" ) + + #foreach( $identifierType in $identifierTypes) + + $identifierType.name + + #end + #if( $identifierTypes.size()==0 ) + $i18n.getString( "full_name" ) + #end + $i18n.getString( "gender" ) $i18n.getString( "date_of_birth" ) $i18n.getString( "age" ) + #if($mapPatientOrgunit.size()!=0) - $i18n.getString( "hierachy_orgunit" ) + $i18n.getString( "hierachy_orgunit" ) #end + $i18n.getString( "operations" ) @@ -79,7 +96,21 @@ #end #end - $!patient.getFullName() + #foreach( $identifierType in $identifierTypes) + #foreach( $identifier in $patient.identifiers) + #if($identifier.identifierType.id==$identifierType.id) + + $identifier.identifier + + #end + #end + #end + #if( $identifierTypes.size()==0 ) + + $!patient.getFullName() + + #end + $i18n.getString($!patient.gender) === 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 2012-09-04 10:10:05 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm 2012-09-05 14:30:23 +0000 @@ -1,5 +1,4 @@ #set($noIden = $identifierTypes.size() ) -#set($noOtherGroup = $noGroupAttributes.size() ) #set($noGroup = $attributeGroups.size() ) #if( $programInstance || $hasDataEntry=='true') @@ -66,13 +65,12 @@ #end - #foreach ($attributeGroup in $attributeGroups ) + #foreach ($attributeGroup in $attributeGroupsMap.keySet() )   $attributeGroup.name #set( $mark = false ) - #foreach($attribute in $attributeGroup.attributes) - #if( $attribute.program && $attribute.program.id == $programInstance.program.id ) - #set( $attributeValue = '') + #set($attributes = $attributeGroupsMap.get($attributeGroup)) + #foreach($attribute in $attributes ) #set( $attributeValue = $!patientAttributeValueMap.get( $attribute.id ) ) @@ -101,48 +99,6 @@ #set( $mark = !$mark ) - #end - #end - #end -   - - - - #if ( $noGroupAttributes && $noOtherGroup > 0) - $i18n.getString( "Other details" ) - #set( $mark = false ) - #foreach($attribute in $noGroupAttributes ) - #if( $attribute.program && $attribute.program.id == $programInstance.program.id) - #set( $attributeValue = '') - #set( $attributeValue = $!patientAttributeValueMap.get( $attribute.id ) ) - - - - #if( $attribute.valueType == "YES/NO" ) - - #elseif( $attribute.valueType == "DATE" ) - - - #elseif( $attribute.valueType == "COMBO" ) - - #else - - #end - - - #set( $mark = !$mark ) - #end #end #end   === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/updatePatientForm.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/updatePatientForm.vm 2012-08-12 06:10:50 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/updatePatientForm.vm 2012-09-05 14:30:23 +0000 @@ -170,45 +170,43 @@ #end #end #end + - - #foreach ($attributeGroup in $attributeGroups ) -   + + #foreach ($attributeGroup in $attributeGroupsMap.keySet() ) +   $attributeGroup.name - #foreach($attribute in $attributeGroup.attributes) - #if( $!attribute && $attribute.program ) - #elseif( $!attribute ) - #set( $attributeValue = "" ) - #set( $attributeValue = $!patientAttributeValueMap.get( $attribute.id ) ) - - - - #if( $attribute.valueType == "YES/NO" ) - - #elseif( $attribute.valueType == "DATE" ) - - - #elseif( $attribute.valueType == "COMBO" ) - + + + + + #elseif( $attribute.valueType == "DATE" ) + + + #elseif( $attribute.valueType == "COMBO" ) + - #else - - #end - - - #end + + #else + + #end + + #end #end +   === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetParamsByProgramAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetParamsByProgramAction.java 2012-06-04 04:06:04 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetParamsByProgramAction.java 2012-09-05 14:30:23 +0000 @@ -102,8 +102,15 @@ if ( program.isRegistration() ) { - patientAttributes.addAll( attributeService.getPatientAttributes( null, null ) ); - patientAttributes.addAll( attributeService.getPatientAttributes( program ) ); + patientAttributes = attributeService.getAllPatientAttributes(); + + Collection programs = programService.getAllPrograms(); + programs.remove( program ); + + for ( Program _program : programs ) + { + patientAttributes.remove( _program.getPatientAttributes() ); + } } return SUCCESS; === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java 2012-07-30 04:48:17 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java 2012-09-05 14:30:23 +0000 @@ -33,8 +33,6 @@ import org.hisp.dhis.patient.PatientAttributeOption; import org.hisp.dhis.patient.PatientAttributeOptionService; import org.hisp.dhis.patient.PatientAttributeService; -import org.hisp.dhis.program.Program; -import org.hisp.dhis.program.ProgramService; import com.opensymphony.xwork2.Action; @@ -62,14 +60,7 @@ { this.patientAttributeOptionService = patientAttributeOptionService; } - - private ProgramService programService; - - public void setProgramService( ProgramService programService ) - { - this.programService = programService; - } - + // ------------------------------------------------------------------------- // Input/Output // ------------------------------------------------------------------------- @@ -109,13 +100,6 @@ this.attrOptions = attrOptions; } - private Integer programId; - - public void setProgramId( Integer programId ) - { - this.programId = programId; - } - // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -132,9 +116,6 @@ mandatory = (mandatory == null) ? false : true; patientAttribute.setMandatory( mandatory ); - Program program = (programId != null) ? programService.getProgram( programId ) : null; - patientAttribute.setProgram( program ); - patientAttributeService.savePatientAttribute( patientAttribute ); if ( PatientAttribute.TYPE_COMBO.equalsIgnoreCase( valueType ) ) === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java 2012-07-30 04:48:17 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java 2012-09-05 14:30:23 +0000 @@ -39,8 +39,6 @@ import org.hisp.dhis.patient.PatientAttributeOptionService; import org.hisp.dhis.patient.PatientAttributeService; import org.hisp.dhis.patientattributevalue.PatientAttributeValueService; -import org.hisp.dhis.program.Program; -import org.hisp.dhis.program.ProgramService; import com.opensymphony.xwork2.Action; @@ -78,13 +76,6 @@ this.patientAttributeValueService = patientAttributeValueService; } - private ProgramService programService; - - public void setProgramService( ProgramService programService ) - { - this.programService = programService; - } - // ------------------------------------------------------------------------- // Input/Output // ------------------------------------------------------------------------- @@ -154,9 +145,6 @@ mandatory = (mandatory == null) ? false : true; patientAttribute.setMandatory( mandatory ); - Program program = (programId != null) ? programService.getProgram( programId ) : null; - patientAttribute.setProgram( program ); - HttpServletRequest request = ServletActionContext.getRequest(); Collection attributeOptions = patientAttributeOptionService.get( patientAttribute ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/AddPatientIdentifierTypeAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/AddPatientIdentifierTypeAction.java 2012-05-24 03:51:44 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/AddPatientIdentifierTypeAction.java 2012-09-05 14:30:23 +0000 @@ -29,8 +29,6 @@ import org.hisp.dhis.patient.PatientIdentifierType; import org.hisp.dhis.patient.PatientIdentifierTypeService; -import org.hisp.dhis.program.Program; -import org.hisp.dhis.program.ProgramService; import com.opensymphony.xwork2.Action; @@ -46,9 +44,7 @@ // ------------------------------------------------------------------------- private PatientIdentifierTypeService patientIdentifierTypeService; - - private ProgramService programService; - + // ------------------------------------------------------------------------- // Input/Output // ------------------------------------------------------------------------- @@ -65,8 +61,6 @@ private String type; - private Integer programId; - // ------------------------------------------------------------------------- // Getters && Setters // ------------------------------------------------------------------------- @@ -91,11 +85,6 @@ this.description = description; } - public void setProgramService( ProgramService programService ) - { - this.programService = programService; - } - public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService ) { this.patientIdentifierTypeService = patientIdentifierTypeService; @@ -111,11 +100,6 @@ this.related = related; } - public void setProgramId( Integer programId ) - { - this.programId = programId; - } - // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -136,9 +120,6 @@ identifierType.setNoChars( noChars ); identifierType.setType( type ); - Program program = (programId != null) ? programService.getProgram( programId ) : null; - identifierType.setProgram( program ); - patientIdentifierTypeService.savePatientIdentifierType( identifierType ); return SUCCESS; === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/UpdatePatientIdentifierTypeAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/UpdatePatientIdentifierTypeAction.java 2012-05-24 03:51:44 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/UpdatePatientIdentifierTypeAction.java 2012-09-05 14:30:23 +0000 @@ -47,8 +47,6 @@ private PatientIdentifierTypeService patientIdentifierTypeService; - private ProgramService programService; - // ------------------------------------------------------------------------- // Input/Output // ------------------------------------------------------------------------- @@ -67,8 +65,6 @@ private String type; - private Integer programId; - // ------------------------------------------------------------------------- // Getters && Setters // ------------------------------------------------------------------------- @@ -93,11 +89,6 @@ this.name = name; } - public void setProgramService( ProgramService programService ) - { - this.programService = programService; - } - public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService ) { this.patientIdentifierTypeService = patientIdentifierTypeService; @@ -117,12 +108,7 @@ { this.related = related; } - - public void setProgramId( Integer programId ) - { - this.programId = programId; - } - + // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -145,9 +131,6 @@ identifierType.setNoChars( noChars ); identifierType.setType( type ); - Program program = (programId != null) ? programService.getProgram( programId ) : null; - identifierType.setProgram( program ); - patientIdentifierTypeService.updatePatientIdentifierType( identifierType ); } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java 2012-08-06 09:34:34 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java 2012-09-05 14:30:23 +0000 @@ -27,8 +27,17 @@ package org.hisp.dhis.patient.action.program; +import java.util.ArrayList; +import java.util.Collection; import java.util.Date; +import java.util.HashSet; +import java.util.List; +import org.hisp.dhis.patient.Patient; +import org.hisp.dhis.patient.PatientAttribute; +import org.hisp.dhis.patient.PatientAttributeService; +import org.hisp.dhis.patient.PatientIdentifierType; +import org.hisp.dhis.patient.PatientIdentifierTypeService; import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramInstance; import org.hisp.dhis.program.ProgramInstanceService; @@ -72,6 +81,20 @@ this.programInstanceService = programInstanceService; } + private PatientIdentifierTypeService patientIdentifierTypeService; + + public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService ) + { + this.patientIdentifierTypeService = patientIdentifierTypeService; + } + + private PatientAttributeService patientAttributeService; + + public void setPatientAttributeService( PatientAttributeService patientAttributeService ) + { + this.patientAttributeService = patientAttributeService; + } + // ------------------------------------------------------------------------- // Input/Output // ------------------------------------------------------------------------- @@ -132,6 +155,20 @@ this.displayIncidentDate = displayIncidentDate; } + private List selectedPropertyIds = new ArrayList(); + + public void setSelectedPropertyIds( List selectedPropertyIds ) + { + this.selectedPropertyIds = selectedPropertyIds; + } + + private List personDisplayNames = new ArrayList(); + + public void setPersonDisplayNames( List personDisplayNames ) + { + this.personDisplayNames = personDisplayNames; + } + // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -141,7 +178,7 @@ { displayProvidedOtherFacility = (displayProvidedOtherFacility == null) ? false : displayProvidedOtherFacility; displayIncidentDate = (displayIncidentDate == null) ? false : displayIncidentDate; - + Program program = new Program(); program.setName( name ); @@ -152,8 +189,38 @@ program.setMaxDaysAllowedInputData( maxDaysAllowedInputData ); program.setType( type ); program.setDisplayProvidedOtherFacility( displayProvidedOtherFacility ); - program.setDisplayIncidentDate(displayIncidentDate); - + program.setDisplayIncidentDate( displayIncidentDate ); + + Collection identifierTypes = new HashSet(); + Collection patientAttributes = new HashSet(); + int index = 0; + for ( String selectedPropertyId : selectedPropertyIds ) + { + String[] ids = selectedPropertyId.split( "_" ); + + if ( ids[0].equals( Patient.PREFIX_IDENTIFIER_TYPE ) ) + { + PatientIdentifierType identifierType = patientIdentifierTypeService.getPatientIdentifierType( Integer + .parseInt( ids[1] ) ); + + identifierType.setPersonDisplayName( personDisplayNames.get( index ) ); + patientIdentifierTypeService.updatePatientIdentifierType( identifierType ); + + identifierTypes.add( identifierType ); + } + else if ( ids[0].equals( Patient.PREFIX_PATIENT_ATTRIBUTE ) ) + { + PatientAttribute patientAttribute = patientAttributeService.getPatientAttribute( Integer + .parseInt( ids[1] ) ); + patientAttributes.add( patientAttribute ); + } + + index++; + } + + program.setPatientIdentifierTypes( identifierTypes ); + program.setPatientAttributes( patientAttributes ); + programService.saveProgram( program ); if ( program.getType().equals( Program.SINGLE_EVENT_WITH_REGISTRATION ) === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/ShowAddProgramFormAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/ShowAddProgramFormAction.java 2011-03-31 01:42:05 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/ShowAddProgramFormAction.java 2012-09-05 14:30:23 +0000 @@ -27,11 +27,14 @@ package org.hisp.dhis.patient.action.program; -import java.util.ArrayList; import java.util.Collection; -import org.hisp.dhis.program.ProgramStage; -import org.hisp.dhis.program.ProgramStageService; +import org.hisp.dhis.patient.PatientAttribute; +import org.hisp.dhis.patient.PatientAttributeService; +import org.hisp.dhis.patient.PatientIdentifierType; +import org.hisp.dhis.patient.PatientIdentifierTypeService; +import org.hisp.dhis.program.Program; +import org.hisp.dhis.program.ProgramService; import com.opensymphony.xwork2.Action; @@ -46,22 +49,43 @@ // Dependency // ------------------------------------------------------------------------- - private ProgramStageService programStageService; - - public void setProgramStageService( ProgramStageService programStageService ) - { - this.programStageService = programStageService; + private ProgramService programService; + + public void setProgramService( ProgramService programService ) + { + this.programService = programService; + } + + private PatientIdentifierTypeService patientIdentifierTypeService; + + public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService ) + { + this.patientIdentifierTypeService = patientIdentifierTypeService; + } + + private PatientAttributeService patientAttributeService; + + public void setPatientAttributeService( PatientAttributeService patientAttributeService ) + { + this.patientAttributeService = patientAttributeService; } // ------------------------------------------------------------------------- // Output // ------------------------------------------------------------------------- - private Collection programStages; - - public Collection getProgramStages() - { - return programStages; + private Collection availableIdentifierTypes; + + public Collection getAvailableIdentifierTypes() + { + return availableIdentifierTypes; + } + + private Collection availableAttributes; + + public Collection getAvailableAttributes() + { + return availableAttributes; } // ------------------------------------------------------------------------- @@ -70,8 +94,18 @@ public String execute() { - programStages = new ArrayList( programStageService.getAllProgramStages() ); - + availableIdentifierTypes = patientIdentifierTypeService.getAllPatientIdentifierTypes(); + + availableAttributes = patientAttributeService.getAllPatientAttributes(); + + Collection programs = programService.getAllPrograms(); + + for ( Program program : programs ) + { + availableIdentifierTypes.removeAll( program.getPatientIdentifierTypes() ); + availableAttributes.removeAll( program.getPatientAttributes() ); + } + return SUCCESS; } } === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/ShowUpdateProgramFormAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/ShowUpdateProgramFormAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/ShowUpdateProgramFormAction.java 2012-09-05 14:30:23 +0000 @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2004-2009, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package org.hisp.dhis.patient.action.program; + +import java.util.Collection; +import java.util.List; + +import org.hisp.dhis.organisationunit.OrganisationUnitGroup; +import org.hisp.dhis.organisationunit.OrganisationUnitLevel; +import org.hisp.dhis.oust.manager.SelectionTreeManager; +import org.hisp.dhis.patient.PatientAttribute; +import org.hisp.dhis.patient.PatientAttributeService; +import org.hisp.dhis.patient.PatientIdentifierType; +import org.hisp.dhis.patient.PatientIdentifierTypeService; +import org.hisp.dhis.program.Program; +import org.hisp.dhis.program.ProgramService; + +import com.opensymphony.xwork2.Action; + +/** + * @author Chau Thu Tran + * @version $Id$ + */ +public class ShowUpdateProgramFormAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private ProgramService programService; + + public void setProgramService( ProgramService programService ) + { + this.programService = programService; + } + + private PatientIdentifierTypeService patientIdentifierTypeService; + + public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService ) + { + this.patientIdentifierTypeService = patientIdentifierTypeService; + } + + private PatientAttributeService patientAttributeService; + + public void setPatientAttributeService( PatientAttributeService patientAttributeService ) + { + this.patientAttributeService = patientAttributeService; + } + + // ------------------------------------------------------------------------- + // Input/Output + // ------------------------------------------------------------------------- + + private int id; + + public int getId() + { + return id; + } + + public void setId( int id ) + { + this.id = id; + } + + private Program program; + + public Program getProgram() + { + return program; + } + + private List levels; + + public List getLevels() + { + return levels; + } + + private List groups; + + public List getGroups() + { + return groups; + } + + private Integer level; + + public Integer getLevel() + { + return level; + } + + public void setLevel( Integer level ) + { + this.level = level; + } + + private Integer organisationUnitGroupId; + + public Integer getOrganisationUnitGroupId() + { + return organisationUnitGroupId; + } + + public void setOrganisationUnitGroupId( Integer organisationUnitGroupId ) + { + this.organisationUnitGroupId = organisationUnitGroupId; + } + + private Collection availableIdentifierTypes; + + public Collection getAvailableIdentifierTypes() + { + return availableIdentifierTypes; + } + + private Collection availableAttributes; + + public Collection getAvailableAttributes() + { + return availableAttributes; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + public String execute() + throws Exception + { + program = programService.getProgram( id ); + + availableIdentifierTypes = patientIdentifierTypeService.getAllPatientIdentifierTypes(); + + availableAttributes = patientAttributeService.getAllPatientAttributes(); + + Collection programs = programService.getAllPrograms(); + + for ( Program program : programs ) + { + availableIdentifierTypes.removeAll( program.getPatientIdentifierTypes() ); + availableAttributes.removeAll( program.getPatientAttributes() ); + } + + return SUCCESS; + } +} === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java 2012-08-06 09:34:34 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java 2012-09-05 14:30:23 +0000 @@ -27,6 +27,16 @@ package org.hisp.dhis.patient.action.program; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; + +import org.hisp.dhis.patient.Patient; +import org.hisp.dhis.patient.PatientAttribute; +import org.hisp.dhis.patient.PatientAttributeService; +import org.hisp.dhis.patient.PatientIdentifierType; +import org.hisp.dhis.patient.PatientIdentifierTypeService; import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramService; @@ -50,6 +60,20 @@ this.programService = programService; } + private PatientIdentifierTypeService patientIdentifierTypeService; + + public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService ) + { + this.patientIdentifierTypeService = patientIdentifierTypeService; + } + + private PatientAttributeService patientAttributeService; + + public void setPatientAttributeService( PatientAttributeService patientAttributeService ) + { + this.patientAttributeService = patientAttributeService; + } + // ------------------------------------------------------------------------- // Input/Output // ------------------------------------------------------------------------- @@ -129,6 +153,20 @@ this.displayIncidentDate = displayIncidentDate; } + private List selectedPropertyIds = new ArrayList(); + + public void setSelectedPropertyIds( List selectedPropertyIds ) + { + this.selectedPropertyIds = selectedPropertyIds; + } + + private List personDisplayNames = new ArrayList(); + + public void setPersonDisplayNames( List personDisplayNames ) + { + this.personDisplayNames = personDisplayNames; + } + // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -150,6 +188,33 @@ program.setDisplayProvidedOtherFacility( displayProvidedOtherFacility ); program.setDisplayIncidentDate(displayIncidentDate); + Collection identifierTypes = new HashSet(); + Collection patientAttributes = new HashSet(); + int index = 0; + for( String selectedPropertyId : selectedPropertyIds ) + { + String[] ids = selectedPropertyId.split( "_" ); + + if( ids[0].equals( Patient.PREFIX_IDENTIFIER_TYPE )) + { + PatientIdentifierType identifierType = patientIdentifierTypeService.getPatientIdentifierType( Integer.parseInt( ids[1] )); + + identifierType.setPersonDisplayName( personDisplayNames.get( index ) ); + patientIdentifierTypeService.updatePatientIdentifierType( identifierType ); + + identifierTypes.add( identifierType ); + } + else if( ids[0].equals( Patient.PREFIX_PATIENT_ATTRIBUTE )) + { + PatientAttribute patientAttribute = patientAttributeService.getPatientAttribute( Integer.parseInt( ids[1] )); + patientAttributes.add( patientAttribute ); + } + index++; + } + + program.setPatientIdentifierTypes( identifierTypes ); + program.setPatientAttributes( patientAttributes ); + programService.updateProgram( program ); return SUCCESS; === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2012-08-24 10:09:45 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2012-09-05 14:30:23 +0000 @@ -88,8 +88,6 @@ ref="org.hisp.dhis.patient.PatientAttributeService" /> - - + + - - + + + + + + + + + + + + + - - - + class="org.hisp.dhis.patient.action.program.ShowUpdateProgramFormAction"> /main.vm /dhis-web-maintenance-patient/updateProgramForm.vm javascript/program.js === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm 2012-07-30 04:48:17 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm 2012-09-05 14:30:23 +0000 @@ -49,25 +49,12 @@ - - - - - - - - - + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientIdentifierTypeForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientIdentifierTypeForm.vm 2012-06-14 06:37:44 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientIdentifierTypeForm.vm 2012-09-05 14:30:23 +0000 @@ -59,28 +59,14 @@ - - - - - - - - - - - - - - - - + + + + + + + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm 2012-08-06 09:34:34 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm 2012-09-05 14:30:23 +0000 @@ -65,16 +65,57 @@ - - - - - - - - - + + + + + + + + + + + + + + + + + + +
$i18n.getString( "available_identifiers_and_attributes" )$i18n.getString( "select_identifiers_and_attributes" ) + + +
+ + +
+
+
+ +
+
+ + + + + + + +
$i18n.getString( "identifiers_and_attributes" )$i18n.getString( "displayed_in_list" )
+
+
+ + +
\ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramForm.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramForm.js 2012-03-27 07:20:28 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramForm.js 2012-09-05 14:30:23 +0000 @@ -1,9 +1,25 @@ jQuery(document).ready( function(){ - validation( 'addProgramForm', function( form ){ + + validation( 'addProgramForm', function( form ){ enable('dateOfEnrollmentDescription'); enable('dateOfIncidentDescription'); form.submit(); - }); + }, function(){ + var selectedPropertyIds = jQuery( "#selectedPropertyIds" ); + selectedPropertyIds.empty(); + var personDisplayNames = jQuery( "#personDisplayNames" ); + personDisplayNames.empty(); + + jQuery("#selectedList").find("tr").each( function( i, item ){ + + selectedPropertyIds.append( "" ); + + var displayed = jQuery( item ).find( "input[name='displayed']:first"); + var checked = displayed.attr('checked') ? true : false; + personDisplayNames.append( "" ); + }); + }); + checkValueIsExist( "name", "validateProgram.action"); }); \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js 2012-08-07 08:14:58 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js 2012-09-05 14:30:23 +0000 @@ -63,3 +63,100 @@ } } } + +// ----------------------------------------------------------------------------- +// select identifiers / attributes +// ----------------------------------------------------------------------------- + +function selectProperties() +{ + var selectedList = jQuery("#selectedList"); + jQuery("#availablePropertyIds").children().each(function(i, item){ + if( item.selected ){ + html = "" + item.text + ""; + html += "" + item.text + ""; + html += "" + item.find("td:first").text() + "" ); + item.remove(); + } + }); +} + + +function unSelectAllProperties() +{ + var availableList = jQuery("#availablePropertyIds"); + jQuery("#selectedList").find("tr").each( function( i, item ){ + item = jQuery(item); + availableList.append( "" ); + item.remove(); + }); +} + +function select( event, element ) +{ + if ( !getKeyCode( event ) )// Ctrl + { + jQuery("#selectedList .selected").removeClass( 'selected' ); + } + + element = jQuery( element ).parent(); + if( element.hasClass( 'selected') ) element.removeClass( 'selected' ); + else element.addClass( 'selected' ); +} + +function getKeyCode(e) +{ + var ctrlPressed=0; + + if (parseInt(navigator.appVersion)>3) { + + var evt = e ? e:window.event; + + if (document.layers && navigator.appName=="Netscape" + && parseInt(navigator.appVersion)==4) { + // NETSCAPE 4 CODE + var mString =(e.modifiers+32).toString(2).substring(3,6); + ctrlPressed =(mString.charAt(1)=="1"); + } + else { + // NEWER BROWSERS [CROSS-PLATFORM] + ctrlPressed=evt.ctrlKey; + } + } + return ctrlPressed; +} \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramForm.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramForm.js 2012-03-27 07:20:28 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramForm.js 2012-09-05 14:30:23 +0000 @@ -1,9 +1,24 @@ jQuery(document).ready( function(){ + validation( 'updateProgramForm', function( form ){ enable('dateOfEnrollmentDescription'); enable('dateOfIncidentDescription'); - form.submit(); - }); + form.submit(); + }, function(){ + var selectedPropertyIds = jQuery( "#selectedPropertyIds" ); + selectedPropertyIds.empty(); + var personDisplayNames = jQuery( "#personDisplayNames" ); + personDisplayNames.empty(); + + jQuery("#selectedList").find("tr").each( function( i, item ){ + + selectedPropertyIds.append( "" ); + + var displayed = jQuery( item ).find( "input[name='displayed']:first"); + var checked = displayed.attr('checked') ? true : false; + personDisplayNames.append( "" ); + }); + }); checkValueIsExist( "name", "validateProgram.action", {id:getFieldValue('id')}); }); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm 2012-07-30 04:48:17 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm 2012-09-05 14:30:23 +0000 @@ -59,19 +59,6 @@ - - - - - - - - @@ -81,7 +68,7 @@ - +