=== 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 2014-01-23 14:18:27 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java 2014-01-23 17:00:21 +0000 @@ -63,7 +63,7 @@ public static final String TYPE_STRING = "string"; public static final String TYPE_INT = "number"; - + public static final String VALUE_TYPE_LETTER = "letter"; public static final String TYPE_BOOL = "bool"; @@ -141,7 +141,7 @@ // ------------------------------------------------------------------------- // Logic // ------------------------------------------------------------------------- - + /** * Indicates whether the value type of this attribute is numeric. */ === 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 2014-01-22 12:50:38 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeService.java 2014-01-23 17:00:21 +0000 @@ -29,7 +29,6 @@ */ import java.util.Collection; -import java.util.HashSet; import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramService; @@ -132,18 +131,15 @@ public Collection getPatientAttributesWithoutProgram() { - Collection patientAttributes = patientAttributeStore.getAll(); + Collection result = patientAttributeStore.getAll(); - Collection programAttributes = new HashSet(); Collection programs = programService.getAllPrograms(); for ( Program program : programs ) { - programAttributes.addAll( program.getAttributes() ); + result.removeAll( program.getAttributes() ); } - - patientAttributes.removeAll( programAttributes ); - return patientAttributes; + return result; } public Collection getPatientAttributesDisplayed( boolean displayInListNoProgram ) === 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 2014-01-23 14:18:27 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2014-01-23 17:00:21 +0000 @@ -139,7 +139,6 @@ executeSql( "ALTER TABLE patientattribute DROP COLUMN noChars" ); executeSql( "ALTER TABLE programstageinstance ALTER executiondate TYPE date" ); - executeSql( "ALTER TABLE patientidentifier ALTER COLUMN patientid DROP NOT NULL" ); executeSql( "ALTER TABLE patient DROP COLUMN bloodgroup" ); executeSql( "ALTER TABLE patientmobilesetting DROP COLUMN bloodGroup" ); @@ -182,9 +181,6 @@ executeSql( "UPDATE program SET ignoreOverdueEvents=false WHERE ignoreOverdueEvents is null" ); executeSql( "UPDATE programstage SET displayGenerateEventBox=true WHERE displayGenerateEventBox is null" ); - executeSql( "ALTER TABLE patientidentifier DROP COLUMN preferred" ); - - executeSql( "UPDATE patientidentifiertype SET personDisplayName=false WHERE personDisplayName is null" ); executeSql( "ALTER TABLE programvalidation RENAME description TO name" ); @@ -200,7 +196,6 @@ executeSql( "UPDATE patientattribute SET valueType='number' WHERE valueType='NUMBER'" ); executeSql( "UPDATE patientattribute SET valueType='bool' WHERE valueType='YES/NO'" ); executeSql( "UPDATE patientattribute SET valueType='combo' WHERE valueType='COMBO'" ); - executeSql( "UPDATE patientidentifiertype SET type='string' WHERE type='text'" ); executeSql( "UPDATE program SET onlyEnrollOnce='false' WHERE onlyEnrollOnce is null" ); executeSql( "UPDATE programStage SET captureCoordinates=false WHERE captureCoordinates is null" ); @@ -254,9 +249,6 @@ executeSql( "update programstage set openAfterEnrollment=false where openAfterEnrollment is null" ); - executeSql( "update patientidentifiertype set orgunitScope=false where orgunitScope is null" ); - executeSql( "update patientidentifiertype set programScope=false where programScope is null" ); - executeSql( "update programstageinstance set status=0 where status is null" ); executeSql( "ALTER TABLE patienttabularreport RENAME level TO ouMode" ); executeSql( "ALTER TABLE program DROP COLUMN facilityLB" ); @@ -290,7 +282,6 @@ executeSql( "ALTER TABLE program DROP COLUMN useBirthDateAsEnrollmentDate" ); executeSql( "UPDATE patientattribute SET displayinlistnoprogram=false WHERE displayinlistnoprogram is null" ); - executeSql( "UPDATE patientidentifiertype SET displayinlistnoprogram=false WHERE displayinlistnoprogram is null" ); executeSql( "ALTER TABLE patientidentifiertype DROP COLUMN persondisplayname" ); @@ -353,7 +344,6 @@ { updateUidColumn( "patientattribute" ); updateUidColumn( "patientattributegroup" ); - updateUidColumn( "patientidentifiertype" ); updateUidColumn( "program" ); updateUidColumn( "patientattribute" ); updateUidColumn( "programstage" ); === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetAttributesByProgramAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetAttributesByProgramAction.java 2014-01-09 16:45:15 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetAttributesByProgramAction.java 2014-01-23 17:00:21 +0000 @@ -28,8 +28,11 @@ package org.hisp.dhis.caseentry.action.patient; import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; import java.util.List; +import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator; import org.hisp.dhis.patient.PatientAttribute; import org.hisp.dhis.patient.PatientAttributeService; import org.hisp.dhis.program.Program; @@ -89,9 +92,13 @@ } else { - attributes = new ArrayList( patientAttributeService.getPatientAttributesDisplayed( true ) ); + Collection _attributes = patientAttributeService.getPatientAttributesWithoutProgram(); + _attributes.addAll( patientAttributeService.getPatientAttributesDisplayed( true ) ); + attributes = new ArrayList( _attributes ); } + Collections.sort( attributes, IdentifiableObjectNameComparator.INSTANCE ); + return SUCCESS; } } === 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 2014-01-23 14:18:27 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SearchPatientAction.java 2014-01-23 17:00:21 +0000 @@ -221,6 +221,16 @@ Collection orgunits = new HashSet(); + if ( programId != null ) + { + program = programService.getProgram( programId ); + } + else + { + attributes = new ArrayList( patientAttributeService.getPatientAttributesDisplayed( true ) ); + Collections.sort( attributes, new PatientAttributeSortOrderInListNoProgramComparator() ); + } + // List all patients if ( listAll ) { @@ -283,15 +293,6 @@ } } - if ( programId != null ) - { - program = programService.getProgram( programId ); - } - else - { - attributes = new ArrayList( patientAttributeService.getPatientAttributesDisplayed( true ) ); - Collections.sort( attributes, new PatientAttributeSortOrderInListNoProgramComparator() ); - } return SUCCESS; } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SelectAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SelectAction.java 2014-01-20 13:39:57 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SelectAction.java 2014-01-23 17:00:21 +0000 @@ -29,6 +29,7 @@ */ import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.List; @@ -114,9 +115,12 @@ throws Exception { organisationUnit = selectionManager.getSelectedOrganisationUnit(); - patientAttributes = new ArrayList( - patientAttributeService.getPatientAttributesWithoutProgram() ); - patientAttributes.addAll( patientAttributeService.getPatientAttributesDisplayed( true ) ); + + Collection _attributes = patientAttributeService.getPatientAttributesWithoutProgram(); + _attributes.addAll( patientAttributeService.getPatientAttributesDisplayed( true ) ); + + patientAttributes = new ArrayList( _attributes ); + Collections.sort( patientAttributes, IdentifiableObjectNameComparator.INSTANCE ); if ( organisationUnit != null ) === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2014-01-23 14:09:55 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2014-01-23 17:00:21 +0000 @@ -2472,7 +2472,7 @@ { return 'float'; } - if( type == 'int' || type == 'posInt' || type == 'negInt' || type == 'zeroPositiveInt' ) + if( type == 'int' || type == 'positiveNumber' || type == 'negativeNumber' || type == 'zeroPositiveInt' ) { return 'numeric'; } @@ -2492,7 +2492,7 @@ { return 'datefield'; } - if( type == 'number' || type == 'int' || type == 'posInt' || type == 'negInt' || type == 'zeroPositiveInt' ) + if( type == 'number' || type == 'int' || type == 'positiveNumber' || type == 'negativeNumber' || type == 'zeroPositiveInt' ) { return 'numberfield'; } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2014-01-23 14:09:55 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2014-01-23 17:00:21 +0000 @@ -387,16 +387,15 @@ $.postJSON( "getAttributesByProgram.action", { id:programIdAddPatient }, function( json ) { - jQuery('#searchObjectId').find('option').remove() removeAttributeOption('advSearchBox0'); var attributeList = jQuery( '#searchObjectId'); jQuery('input[name=clearSearchBtn]').each(function(){ jQuery(this).click(); - }) + }); - jQuery('#searchObjectId').append(''); + clearListById('searchObjectId'); jQuery('#searchObjectId').append(''); for ( var i in json.attributes ) { jQuery('#searchObjectId').append(''); @@ -1887,12 +1886,12 @@ alert(i18n_enter_values_for_longitude_and_latitude_fields); isValid = false; } - else if(!dhis2.validation.isNumber(longitude)){ + else if(!isNumber(longitude)){ byId('longitude').style.backgroundColor = '#ffcc00'; alert(i18n_enter_a_valid_number); isValid = false; } - else if(!dhis2.validation.isNumber(latitude)){ + else if(!isNumber(latitude)){ byId('latitude').style.backgroundColor = '#ffcc00'; alert(i18n_enter_a_valid_number); isValid = false; @@ -2007,7 +2006,7 @@ params += "&facilityLB="; if( getFieldValue('programIdAddPatient') != "" ) { - params += "&programIds=" + getFieldValue('programIdAddPatient'); + params += "&programId=" + getFieldValue('programIdAddPatient'); params += "&searchTexts=prg_" + getFieldValue('programIdAddPatient'); } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramAttributes.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramAttributes.vm 2014-01-08 15:08:21 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramAttributes.vm 2014-01-23 17:00:21 +0000 @@ -1,9 +1,9 @@ -#set( $size = $program.programPatientAttributes.size() ) +#set( $size = $attributes.size() ) { "attributes": [ -#foreach( $programPatientAttribute in $program.programPatientAttributes ) +#foreach( $attribute in $attributes ) { - "id": ${programPatientAttribute.patientAttribute.id}, - "name": "$!encoder.jsonEncode( ${programPatientAttribute.patientAttribute.displayName} )" + "id": ${attribute.id}, + "name": "$!encoder.jsonEncode( ${attribute.displayName} )" }#if( $velocityCount < $size ),#end #end ] === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm 2014-01-08 15:08:21 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm 2014-01-23 17:00:21 +0000 @@ -37,7 +37,7 @@ - + @@ -69,15 +69,6 @@ - - - - - - - - - @@ -125,9 +116,8 @@ + #if( $auth.hasAccess( "dhis-web-caseentry", "accessPatientAttributes" ) ) - - #foreach( $attribute in $patientAttributes ) #end === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleDataEntryForm.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleDataEntryForm.vm 2014-01-23 14:09:55 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleDataEntryForm.vm 2014-01-23 17:00:21 +0000 @@ -87,9 +87,9 @@ #set($validate = '') #if( $type=='number' ) #set($validate="number:true") - #elseif( $type=='posInt' ) + #elseif( $type=='positiveNumber' ) #set($validate="positive_integer:true") - #elseif( $type=='negInt' ) + #elseif( $type=='negativeNumber' ) #set($validate="negative_integer:true") #elseif( $type=='zeroPositiveInt' ) #set($validate="zeroPositiveInt:true") @@ -219,9 +219,9 @@ #set($validate = '') #if( $type=='number' ) #set($validate="number:true") - #elseif( $type=='posInt' ) + #elseif( $type=='positiveNumber' ) #set($validate="positive_integer:true") - #elseif( $type=='negInt' ) + #elseif( $type=='negativeNumber' ) #set($validate="negative_integer:true") #elseif( $type=='zeroPositiveInt' ) #set($validate="zeroPositiveInt:true")