← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13832: Removed Search by identifer field from Person management form.

 

------------------------------------------------------------
revno: 13832
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-01-24 00:00:21 +0700
message:
  Removed Search by identifer field from Person management form.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java
  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/startup/TableAlteror.java
  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/SearchPatientAction.java
  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/webapp/dhis-web-caseentry/app/app.js
  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/jsonProgramAttributes.vm
  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/singleDataEntryForm.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== 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<PatientAttribute> getPatientAttributesWithoutProgram()
     {
-        Collection<PatientAttribute> patientAttributes = patientAttributeStore.getAll();
+        Collection<PatientAttribute> result = patientAttributeStore.getAll();
 
-        Collection<PatientAttribute> programAttributes = new HashSet<PatientAttribute>();
         Collection<Program> programs = programService.getAllPrograms();
         for ( Program program : programs )
         {
-            programAttributes.addAll( program.getAttributes() );
+            result.removeAll( program.getAttributes() );
         }
-
-        patientAttributes.removeAll( programAttributes );
         
-        return patientAttributes;
+        return result;
     }
 
     public Collection<PatientAttribute> 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<PatientAttribute>( patientAttributeService.getPatientAttributesDisplayed( true ) );
+            Collection<PatientAttribute> _attributes = patientAttributeService.getPatientAttributesWithoutProgram();
+            _attributes.addAll( patientAttributeService.getPatientAttributesDisplayed( true ) );
+            attributes = new ArrayList<PatientAttribute>( _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<OrganisationUnit> orgunits = new HashSet<OrganisationUnit>();
 
+        if ( programId != null )
+        {
+            program = programService.getProgram( programId );
+        }
+        else
+        {
+            attributes = new ArrayList<PatientAttribute>( 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<PatientAttribute>( 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<PatientAttribute>(
-            patientAttributeService.getPatientAttributesWithoutProgram() );
-        patientAttributes.addAll( patientAttributeService.getPatientAttributesDisplayed( true ) );
+
+        Collection<PatientAttribute> _attributes = patientAttributeService.getPatientAttributesWithoutProgram();
+        _attributes.addAll( patientAttributeService.getPatientAttributesDisplayed( true ) );
+        
+        patientAttributes = new ArrayList<PatientAttribute>( _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('<option value="iden">' + i18n_search_by_identifier + '</option>');
+			clearListById('searchObjectId');
 			jQuery('#searchObjectId').append('<option value="pi_enrollmentDate">' + i18n_enrollment_date + '</option>');
 			for ( var i in json.attributes ) {
 				jQuery('#searchObjectId').append('<option value="'+json.attributes[i].id+'">'+json.attributes[i].name+'</option>');
@@ -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 @@
 		</td>
 		<td id='listPatientBtnTD'>
 			<input type="button" id='listPatientBtn' value="$i18n.getString( 'list_all_patients' )" onclick="listAllPatient();">
-			<input type="button" id='advancedSearchBtn' class='hidden' value='$i18n.getString( "advanced_search" )' onclick="advancedSearchOnclick();">
+			<input type="button" id='advancedSearchBtn' value='$i18n.getString( "advanced_search" )' onclick="advancedSearchOnclick();">
 		</td>
 	</tr>
 	<tr id='scheduleVisitTR' class='hidden'>
@@ -69,15 +69,6 @@
 			<input type='checkbox' id='followup' name='followup' />
 		</td>
 	</tr>
-	<tr id='searchByIdTR' class='hidden'>
-		<td colspan='2'>
-			<input type='text' id='searchPatientByIds' name='searchPatientByIds' onchange='searchByIdsOnclick();' style='width:350px;' placeholder='$i18n.getString("search_by_identifier")' />
-		</td>
-		<td>
-			<input type='button' value='$i18n.getString("search")' onclick='searchByIdsOnclick();'>
-			<input type="button" id='advancedSearchBtn' value='$i18n.getString( "advanced_search" )' onclick="advancedSearchOnclick();">
-		</td>
-	</tr>
 	
 </table>
 
@@ -125,9 +116,8 @@
 		<tr>
 			<td id='searchingAttributeIdTD' class="hidden">
 			  <select class='search-field' id="searchObjectId" name="searchObjectId" #if( $patientAttributes.size() == 0 ) disabled="disabled" #end onchange="searchObjectOnChange(this)">
+				<option value="pi_enrollmentDate">$i18n.getString( "enrollment_date" )</option>
 				#if( $auth.hasAccess( "dhis-web-caseentry", "accessPatientAttributes" ) )
-					<option value="iden">$i18n.getString( "search_by_identifier" )</option>
-					<option value="pi_enrollmentDate">$i18n.getString( "enrollment_date" )</option>
 					#foreach( $attribute in $patientAttributes )
 						<option value="attr_$attribute.id" valueType='$attribute.valueType'>$encoder.htmlEncode( $attribute.displayName )</option>
 					#end
@@ -140,9 +130,8 @@
 			<tr id='advSearchBox0'>	       
 				<td>
 				  <select class='search-field' id="searchObjectId" name="searchObjectId" #if( $patientAttributes.size() == 0 ) disabled="disabled" #end onchange="searchObjectOnChange(this)">
+					<option value="pi_enrollmentDate">$i18n.getString( "enrollment_date" )</option>
 					#if( $auth.hasAccess( "dhis-web-caseentry", "accessPatientAttributes" ) )
-						<option value="iden">$i18n.getString( "search_by_identifier" )</option>
-						<option value="pi_enrollmentDate">$i18n.getString( "enrollment_date" )</option>
 						#foreach( $attribute in $patientAttributes )
 							<option value="attr_$attribute.id" valueType='$attribute.valueType'>$encoder.htmlEncode( $attribute.displayName )</option>
 						#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")