dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19367
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8417: Don't update patient-identifiers and attributes in program enrollment form
------------------------------------------------------------
revno: 8417
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2012-10-07 12:32:03 +0700
message:
Don't update patient-identifiers and attributes in program enrollment form
modified:
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/webapp/dhis-web-caseentry/anonymousRegistration.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.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/programEnrollmentForm.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-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-10-01 04:36:31 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java 2012-10-07 05:32:03 +0000
@@ -92,9 +92,7 @@
private Boolean hasDataEntry;
- private Map<Integer, Integer> statusMap = new HashMap<Integer, Integer>();
-
- private Map<PatientAttributeGroup, Collection<PatientAttribute>> attributeGroupsMap = new HashMap<PatientAttributeGroup, Collection<PatientAttribute>>();
+ private List<PatientAttribute> patientAttributes;
// -------------------------------------------------------------------------
// Getters/Setters
@@ -119,7 +117,7 @@
{
return patientAttributeValueMap;
}
-
+
public void setPatientAttributeValueService( PatientAttributeValueService patientAttributeValueService )
{
this.patientAttributeValueService = patientAttributeValueService;
@@ -169,15 +167,10 @@
{
return hasDataEntry;
}
-
- public Map<PatientAttributeGroup, Collection<PatientAttribute>> getAttributeGroupsMap()
- {
- return attributeGroupsMap;
- }
- public Map<Integer, Integer> getStatusMap()
+ public List<PatientAttribute> getPatientAttributes()
{
- return statusMap;
+ return patientAttributes;
}
// -------------------------------------------------------------------------
@@ -195,14 +188,6 @@
programInstance = programInstanceService.getProgramInstance( programInstanceId );
- programStageInstances = programInstance.getProgramStageInstances();
-
- if ( programInstance.getProgram().isRegistration() && programInstance.getProgramStageInstances() != null )
- {
- statusMap = programStageInstanceService.statusProgramStageInstances( programInstance
- .getProgramStageInstances() );
- }
-
loadIdentifierTypes( programInstance );
loadPatientAttributes( programInstance );
@@ -243,38 +228,21 @@
// Load patient-attributes of the selected program
// ---------------------------------------------------------------------
- Collection<PatientAttribute> patientAttributes = programInstance.getProgram().getPatientAttributes();
-
- for ( PatientAttribute patientAttribute : patientAttributes )
- {
- PatientAttributeGroup attributeGroup = patientAttribute.getPatientAttributeGroup();
- if ( attributeGroup != null )
- {
- if ( attributeGroupsMap.containsKey( attributeGroup ) )
- {
- Collection<PatientAttribute> attributes = attributeGroupsMap.get( attributeGroup );
- attributes.add( patientAttribute );
- }
- else
- {
- Collection<PatientAttribute> attributes = new HashSet<PatientAttribute>();
- attributes.add( patientAttribute );
- attributeGroupsMap.put( attributeGroup, attributes );
- }
- }
- else
- {
- noGroupAttributes.add( patientAttribute );
- }
- }
-
- Collection<PatientAttributeValue> patientAttributeValues = patientAttributeValueService
- .getPatientAttributeValues( programInstance.getPatient() );
-
- for ( PatientAttributeValue patientAttributeValue : patientAttributeValues )
- {
- patientAttributeValueMap.put( patientAttributeValue.getPatientAttribute().getId(),
- patientAttributeValue.getValue() );
+ patientAttributes = programInstance.getProgram().getPatientAttributes();
+
+ if ( patientAttributes != null )
+ {
+ Collection<PatientAttributeValue> patientAttributeValues = patientAttributeValueService
+ .getPatientAttributeValues( programInstance.getPatient() );
+
+ for ( PatientAttributeValue patientAttributeValue : patientAttributeValues )
+ {
+ if ( patientAttributes.contains( patientAttributeValue.getPatientAttribute() ) )
+ {
+ patientAttributeValueMap.put( patientAttributeValue.getPatientAttribute().getId(),
+ patientAttributeValue.getValue() );
+ }
+ }
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm 2012-10-07 04:42:04 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm 2012-10-07 05:32:03 +0000
@@ -60,16 +60,6 @@
<col/>
<col width="180"/>
<tr>
- <td>$i18n.getString('show_hierachy_from_level')</td>
- <td>
- <select id="level" name="level">
- #foreach( $level in $levels )
- <option value="${level.level}">$level.name</option>
- #end
- </select>
- </td>
- </tr>
- <tr>
<td><span id="reportDateDescriptionField">$i18n.getString('report_date')</span> $i18n.getString('from_to')</td>
<td>
<input type="text" id='startDate' name='startDate' style='width:105px'>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js 2012-10-07 04:42:04 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js 2012-10-07 05:32:03 +0000
@@ -194,7 +194,6 @@
if(listAll){
params += '&startDate=';
params += '&endDate=';
- params += '&level=0';
jQuery( '#compulsoryDE option' ).each( function( i, item ){
var input = jQuery( item );
params += '&searchingValues=de_' + input.val() + '_false_';
@@ -204,7 +203,6 @@
else{
params += '&startDate=' + getFieldValue('startDate');
params += '&endDate=' + getFieldValue('endDate');
- params += '&level=' + $('select[id=level]').val();
var value = '';
var searchingValue = '';
jQuery( '#advancedSearchTB tr' ).each( function(){
@@ -230,6 +228,7 @@
}
params += '&facilityLB=selected';
+ params += '&level=0';
params += '&orgunitIds=' + getFieldValue('orgunitId');
params += '&programStageId=' + jQuery('#programId option:selected').attr('psid');
params += '&orderByOrgunitAsc=false';
=== 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-10-06 13:46:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2012-10-07 05:32:03 +0000
@@ -1459,8 +1459,8 @@
function loadActiveProgramStageRecords(programInstanceId, activeProgramStageInstanceId)
{
+ hideById('programEnrollmentDiv');
if( programInstanceId == "") return;
-
jQuery('#loaderDiv').show();
jQuery('#programEnrollmentDiv').load('enrollmentform.action',
{
=== 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-10-05 08:56:56 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm 2012-10-07 05:32:03 +0000
@@ -44,12 +44,6 @@
#if( ( $!noIden && $!noIden > 0) || ( $!noOtherGroup && $!noOtherGroup > 0) || ( $!noGroup && $!noGroup > 0 ) )
<!-- IDENTIFIERS -->
<table id='enrollmentInforDiv' name='enrollmentInforDiv' class='mainPageTable' >
- #if( $!noIden && $noIden > 0 )
- <tr>
- <th colspan='2'>$i18n.getString( "identifier" )</th>
- </tr>
- #end
-
#set( $mark = false )
#foreach ($identifierType in $identifierTypes)
#set( $identifier = '')
@@ -64,41 +58,35 @@
#end
<!-- ATTRIBUTES IN GROUPS -->
- #foreach ($attributeGroup in $attributeGroupsMap.keySet() )
- <tr><td> </td></tr>
- <tr><th colspan="2" class="heading-column">$attributeGroup.name</th></tr>
- #set( $mark = false )
- #set($attributes = $attributeGroupsMap.get($attributeGroup))
- #foreach($attribute in $attributes )
- #set( $attributeValue = $!patientAttributeValueMap.get( $attribute.id ) )
- <tr #alternate( $mark )>
- <td class='text-column'><label>$attribute.name #if($attribute.mandatory)<em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
- <td class="input-column" >
- #if( $attribute.valueType == "YES/NO" )
- <select id="attr$attribute.id" name="attr$attribute.id" >
- <option value="">[$i18n.getString( "please_select" )]</option>
- <option value="true" #if( $attributeValue=='true') selected="selected" #end>$i18n.getString( "yes" )</option>
- <option value="false" #if( $attributeValue=='false') selected="selected" #end>$i18n.getString( "no" )</option>
- </select>
- #elseif( $attribute.valueType == "DATE" )
- <input type="text" id="attr$attribute.id" name="attr$attribute.id" value="$!attributeValue" objectId='$attribute.id' objectType='attr' class=' #validate( "default" $attribute.mandatory )' >
- <script type="text/javascript">
- datePickerValid( 'attr$attribute.id' );
- </script>
- #elseif( $attribute.valueType == "COMBO" )
- <select id="attr$attribute.id" name="attr$attribute.id" class=' #validate( "default" $attribute.mandatory )' >
- <option value="">[$i18n.getString( "please_select" )]</option>
- #foreach ($option in $attribute.attributeOptions )
- <option value="$option.id" #if($attributeValue == $option.name) selected="selected" #end>$option.name</option>
- #end
- </select>
- #else
- <input type="text" id="attr$attribute.id" name="attr$attribute.id" value="$!attributeValue" class="{validate:{required:$attribute.mandatory #if($!attribute.noChars),maxlength:$attribute.noChars #end #if($attribute.valueType=='NUMBER'),number:true #end }}" >
- #end
- </td>
- </tr>
- #set( $mark = !$mark )
- #end
+ #foreach($attribute in $patientAttributes )
+ #set( $attributeValue = $!patientAttributeValueMap.get( $attribute.id ) )
+ <tr #alternate( $mark )>
+ <td class='text-column'><label>$attribute.name #if($attribute.mandatory)<em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
+ <td class="input-column" >
+ #if( $attribute.valueType == "YES/NO" )
+ <select id="attr$attribute.id" name="attr$attribute.id" >
+ <option value="">[$i18n.getString( "please_select" )]</option>
+ <option value="true" #if( $attributeValue=='true') selected="selected" #end>$i18n.getString( "yes" )</option>
+ <option value="false" #if( $attributeValue=='false') selected="selected" #end>$i18n.getString( "no" )</option>
+ </select>
+ #elseif( $attribute.valueType == "DATE" )
+ <input type="text" id="attr$attribute.id" name="attr$attribute.id" value="$!attributeValue" objectId='$attribute.id' objectType='attr' class=' #validate( "default" $attribute.mandatory )' >
+ <script type="text/javascript">
+ datePickerValid( 'attr$attribute.id' );
+ </script>
+ #elseif( $attribute.valueType == "COMBO" )
+ <select id="attr$attribute.id" name="attr$attribute.id" class=' #validate( "default" $attribute.mandatory )' >
+ <option value="">[$i18n.getString( "please_select" )]</option>
+ #foreach ($option in $attribute.attributeOptions )
+ <option value="$option.id" #if($attributeValue == $option.name) selected="selected" #end>$option.name</option>
+ #end
+ </select>
+ #else
+ <input type="text" id="attr$attribute.id" name="attr$attribute.id" value="$!attributeValue" class="{validate:{required:$attribute.mandatory #if($!attribute.noChars),maxlength:$attribute.noChars #end #if($attribute.valueType=='NUMBER'),number:true #end }}" >
+ #end
+ </td>
+ </tr>
+ #set( $mark = !$mark )
#end
<tr><td> </td></tr>
<tr>
@@ -129,7 +117,7 @@
jQuery("#programEnrollmentInforForm").ready( function(){
validation( 'programEnrollmentInforForm', function(form){
- saveIdentifierAndAttribute(programInstance.patient.id,$programInstance.program.id,'programEnrollmentInforForm');
+ saveIdentifierAndAttribute( $programInstance.patient.id, $programInstance.program.id, 'programEnrollmentInforForm' );
});
#if( $programInstance.completed)