dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24276
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11867: Fixed bug - Check validate criteria in Register new person form.
------------------------------------------------------------
revno: 11867
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-09-03 01:49:20 +0700
message:
Fixed bug - Check validate criteria in Register new person form.
modified:
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/ValidatePatientAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addValidationCriteria.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateValidationCriteria.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-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 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2013-09-02 18:49:20 +0000
@@ -224,6 +224,7 @@
executeSql( "update program set useBirthDateAsEnrollmentDate = false where useBirthDateAsEnrollmentDate is null");
executeSql( "update program set selectEnrollmentDatesInFuture = true where selectEnrollmentDatesInFuture is null");
executeSql( "update programstage set relatedPatient = false where relatedPatient is null");
+ executeSql( "update validationcriteria set description = name where description is null or description='' ");
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ValidatePatientAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ValidatePatientAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ValidatePatientAction.java 2013-09-02 18:49:20 +0000
@@ -85,8 +85,6 @@
private String birthDate;
- private char ageType;
-
private Integer age;
private String gender;
@@ -248,7 +246,7 @@
p.setGender( gender );
}
- if ( birthDate != null )
+ if ( birthDate != null && !birthDate.isEmpty() )
{
birthDate = birthDate.trim();
p.setBirthDate( format.parseDate( birthDate ) );
@@ -256,7 +254,7 @@
}
else if ( age != null )
{
- p.setBirthDateFromAge( age.intValue(), ageType );
+ p.setBirthDateFromAge( age.intValue(), Patient.AGE_TYPE_YEAR );
}
if ( programId != null )
@@ -267,30 +265,7 @@
if ( criteria != null )
{
message = i18n.getString( "patient_could_not_be_enrolled_due_to_following_enrollment_criteria" ) + ": "
- + i18n.getString( criteria.getProperty() );
-
- switch ( criteria.getOperator() )
- {
- case ValidationCriteria.OPERATOR_EQUAL_TO:
- message += " = ";
- break;
- case ValidationCriteria.OPERATOR_GREATER_THAN:
- message += " > ";
- break;
- default:
- message += " < ";
- break;
- }
-
- if ( criteria.getProperty() == "birthDate" )
- {
- message += " " + format.formatValue( criteria.getValue() );
- }
- else
- {
- message += " " + criteria.getValue().toString();
- }
-
+ + criteria.getDescription();
return INPUT;
}
}
@@ -412,9 +387,4 @@
{
this.relationshipTypeId = relationshipTypeId;
}
-
- public void setAgeType( char ageType )
- {
- this.ageType = ageType;
- }
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2013-08-27 08:37:17 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2013-09-02 18:49:20 +0000
@@ -33,6 +33,7 @@
{
jQuery('#' + container + ' [id=age]').rules("remove");
jQuery('#' + container + ' [id=age]').css("display","none");
+ jQuery('#' + container + ' [id=age]').val("");
jQuery('#' + container + ' [id=birthDate]').rules("add",{required:true});
datePickerValid( container + ' [id=birthDate]' );
@@ -43,6 +44,7 @@
jQuery('#' + container + ' [id=age]').rules("add",{required:true, number: true});
jQuery('#' + container + ' [id=age]').css("display","");
+ jQuery('#' + container + ' [id=birthDate]').val("");
jQuery('#' + container + ' [id=birthDate]').rules("remove","required");
$('#' + container+ ' [id=birthDate]').datepicker("destroy");
jQuery('#' + container + ' [id=birthDate]').css("display","none");
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addValidationCriteria.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addValidationCriteria.vm 2013-03-05 14:39:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addValidationCriteria.vm 2013-09-02 18:49:20 +0000
@@ -5,12 +5,12 @@
<table>
<tr><th colspan="3">$i18n.getString('validation_criteria_details')</th></tr>
<tr>
- <td><label>$i18n.getString('name')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><label>$i18n.getString('name') <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td colspan="2"><input type='text' id='name' name='name' style='width: 40em' class="{validate:{required:true,rangelength:[2,160]}}"/></td>
</tr>
<tr>
- <td><label>$i18n.getString('description')</label></td>
- <td colspan="2"><input type='text' id='description' name='description' style='width: 40em'></td>
+ <td><label>$i18n.getString('description') <em title="$i18n.getString( 'required' )" class="required">*</em></label></label></td>
+ <td colspan="2"><input type='text' id='description' name='description' style='width: 40em' class="{validate:{required:true,rangelength:[2,160]}}"></td>
</tr>
<tr>
<td><label>$i18n.getString('criteria')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateValidationCriteria.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateValidationCriteria.vm 2013-03-05 14:39:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateValidationCriteria.vm 2013-09-02 18:49:20 +0000
@@ -9,12 +9,12 @@
<th colspan="3">$i18n.getString('validation_criteria_details')</th>
</tr>
<tr>
- <td><label>$i18n.getString('name')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><label>$i18n.getString('name') <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td colspan="2"><input type='text' id='name' name='name' style='width: 40em' value="$validationCriteria.name" class="{validate:{required:true,rangelength:[2,160]}}"/></td>
</tr>
<tr>
- <td><label>$i18n.getString('description')</label></td>
- <td colspan="2"><input type='text' id='description' name='description' style='width: 40em' value="$validationCriteria.description"/></td>
+ <td><label>$i18n.getString('description') <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td colspan="2"><input type='text' id='description' name='description' style='width: 40em' value="$validationCriteria.description" class="{validate:{required:true,rangelength:[2,160]}}" /></td>
</tr>
<tr>
<td><label>$i18n.getString('criteria')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>