dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #22113
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10610: Add a new function to allow disabled all fields in patient registration form by adding a new prop...
------------------------------------------------------------
revno: 10610
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-04-18 13:45:36 +0700
message:
Add a new function to allow disabled all fields in patient registration form by adding a new property in program to manage this. When a person register into this program, they only need fill some identifiers which are required by user when to design custom entry form.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageService.java
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/program/DefaultProgramStageService.java
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/ProgramStage.hbm.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/AddPatientAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm
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/patientRegistrationList.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgram.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ViewPatientRegistrationFormAction.java
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/UpdateProgramAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/GetProgramStageListAction.java
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/org/hisp/dhis/patient/i18n_module.properties
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/addProgramStageForm.vm
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/viewPatientRegistationForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.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/program/Program.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2013-04-10 08:45:43 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2013-04-18 06:45:36 +0000
@@ -121,7 +121,9 @@
private Boolean remindCompleted = false;
private Set<PatientReminder> patientReminders = new HashSet<PatientReminder>();
-
+
+ private Boolean disableRegistrationFields = false;
+
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@@ -503,4 +505,14 @@
this.patientReminders = patientReminders;
}
+ public Boolean getDisableRegistrationFields()
+ {
+ return disableRegistrationFields;
+ }
+
+ public void setDisableRegistrationFields( Boolean disableRegistrationFields )
+ {
+ this.disableRegistrationFields = disableRegistrationFields;
+ }
+
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageService.java 2013-04-08 08:33:27 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageService.java 2013-04-18 06:45:36 +0000
@@ -40,22 +40,21 @@
// -------------------------------------------------------------------------
// ProgramStage
// -------------------------------------------------------------------------
-
+
int saveProgramStage( ProgramStage programStage );
-
+
void deleteProgramStage( ProgramStage programStage );
-
+
void updateProgramStage( ProgramStage programStage );
-
+
ProgramStage getProgramStage( int id );
-
+
ProgramStage getProgramStage( String uid );
-
+
List<ProgramStage> getProgramStageByName( String name );
-
+
ProgramStage getProgramStageByName( String name, Program program );
-
+
Collection<ProgramStage> getAllProgramStages();
-
- Collection<ProgramStage> getProgramStages( Program program );
+
}
=== 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-04-11 08:30:45 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2013-04-18 06:45:36 +0000
@@ -209,6 +209,9 @@
updateUidInDataEntryFrom();
updateProgramInstanceStatus();
+
+ executeSql( "UPDATE program SET disableRegistrationFields=false where disableRegistrationFields is null" );
+ executeSql( "ALTER TABLE programstage DROP CONSTRAINT \"programstage_name_key\"");
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageService.java 2013-04-08 08:33:27 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageService.java 2013-04-18 06:45:36 +0000
@@ -104,8 +104,4 @@
return i18n( i18nService, programStageStore.getAll() );
}
- public Collection<ProgramStage> getProgramStages( Program program )
- {
- return i18n( i18nService, program.getProgramStages() );
- }
}
=== 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 2013-04-10 08:45:43 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml 2013-04-18 06:45:36 +0000
@@ -81,6 +81,8 @@
<one-to-many class="org.hisp.dhis.patient.PatientReminder" />
</set>
+ <property name="disableRegistrationFields" />
+
<!-- Access properties -->
<many-to-one name="user" class="org.hisp.dhis.user.User" column="userid" foreign-key="fk_program_userid" />
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStage.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStage.hbm.xml 2013-03-01 14:09:05 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStage.hbm.xml 2013-04-18 06:45:36 +0000
@@ -13,7 +13,7 @@
</id>
&identifiableProperties;
- <property name="name" column="name" not-null="true" unique="true" length="230" />
+ <property name="name" column="name" not-null="true" length="230" />
<property name="description" />
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/AddPatientAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/AddPatientAction.java 2013-02-01 08:40:49 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/AddPatientAction.java 2013-04-18 06:45:36 +0000
@@ -29,6 +29,7 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
@@ -135,40 +136,41 @@
Patient patient = new Patient();
- verified = (verified == null) ? false : verified;
-
// ---------------------------------------------------------------------
// Set FirstName, MiddleName, LastName by FullName
// ---------------------------------------------------------------------
- fullName = fullName.trim();
-
- int startIndex = fullName.indexOf( ' ' );
- int endIndex = fullName.lastIndexOf( ' ' );
-
- String firstName = fullName.toString();
- String middleName = "";
- String lastName = "";
-
- if ( fullName.indexOf( ' ' ) != -1 )
+ if ( fullName != null )
{
- firstName = fullName.substring( 0, startIndex );
- if ( startIndex == endIndex )
- {
- middleName = "";
- lastName = fullName.substring( startIndex + 1, fullName.length() );
- }
- else
- {
- middleName = fullName.substring( startIndex + 1, endIndex );
- lastName = fullName.substring( endIndex + 1, fullName.length() );
- }
+ fullName = fullName.trim();
+
+ int startIndex = fullName.indexOf( ' ' );
+ int endIndex = fullName.lastIndexOf( ' ' );
+
+ String firstName = fullName.toString();
+ String middleName = "";
+ String lastName = "";
+
+ if ( fullName.indexOf( ' ' ) != -1 )
+ {
+ firstName = fullName.substring( 0, startIndex );
+ if ( startIndex == endIndex )
+ {
+ middleName = "";
+ lastName = fullName.substring( startIndex + 1, fullName.length() );
+ }
+ else
+ {
+ middleName = fullName.substring( startIndex + 1, endIndex );
+ lastName = fullName.substring( endIndex + 1, fullName.length() );
+ }
+ }
+
+ patient.setFirstName( firstName );
+ patient.setMiddleName( middleName );
+ patient.setLastName( lastName );
}
- patient.setFirstName( firstName );
- patient.setMiddleName( middleName );
- patient.setLastName( lastName );
-
// ---------------------------------------------------------------------
// Set Other information for patient
// ---------------------------------------------------------------------
@@ -184,33 +186,51 @@
deathDate = deathDate.trim();
patient.setDeathDate( format.parseDate( deathDate ) );
}
-
+
if ( healthWorker != null )
{
patient.setHealthWorker( userService.getUser( healthWorker ) );
}
- Character dobType = (verified) ? 'V' : 'D';
-
- if ( !verified && age != null )
+ Date _birthDate = new Date();
+ if ( verified != null )
{
- dobType = 'A';
+ verified = (verified == null) ? false : verified;
+
+ Character dobType = (verified) ? 'V' : 'D';
+
+ if ( !verified && age != null )
+ {
+ dobType = 'A';
+ }
+
+ if ( dobType == Patient.DOB_TYPE_VERIFIED || dobType == Patient.DOB_TYPE_DECLARED )
+ {
+ birthDate = birthDate.trim();
+ patient.setBirthDate( format.parseDate( birthDate ) );
+ }
+ else
+ {
+ patient.setBirthDateFromAge( age.intValue(), Patient.AGE_TYPE_YEAR );
+ }
+
+ _birthDate = patient.getBirthDate();
+ patient.setDobType( dobType );
}
- if ( dobType == Patient.DOB_TYPE_VERIFIED || dobType == Patient.DOB_TYPE_DECLARED )
+ // -----------------------------------------------------------------------------
+ // Registration Date
+ // -----------------------------------------------------------------------------
+
+ if ( registrationDate == null )
{
- birthDate = birthDate.trim();
- patient.setBirthDate( format.parseDate( birthDate ) );
+ patient.setRegistrationDate( new Date() );
}
else
{
- patient.setBirthDateFromAge( age.intValue(), Patient.AGE_TYPE_YEAR );
+ patient.setRegistrationDate( format.parseDate( registrationDate ) );
}
- patient.setDobType( dobType );
-
- patient.setRegistrationDate( format.parseDate( registrationDate ) );
-
// -----------------------------------------------------------------------------
// Prepare Patient Identifiers
// -----------------------------------------------------------------------------
@@ -247,7 +267,11 @@
// PatientIdentifierType will be null
// --------------------------------------------------------------------------------
- String identifier = PatientIdentifierGenerator.getNewIdentifier( patient.getBirthDate(), patient.getGender() );
+ if ( gender == null )
+ {
+ gender = Patient.FEMALE;
+ }
+ String identifier = PatientIdentifierGenerator.getNewIdentifier( _birthDate, gender );
PatientIdentifier systemGenerateIdentifier = patientIdentifierService.get( null, identifier );
while ( systemGenerateIdentifier != null )
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm 2013-03-14 07:36:22 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addPatientForm.vm 2013-04-18 06:45:36 +0000
@@ -10,7 +10,7 @@
,errorElement:"span"
,submitHandler: function(form)
{
- validateAddPatient(isContinue);
+ validateAddPatient(isContinue, '$!program.disableRegistrationFields');
}
,beforeValidateHandler: function(form)
{
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js 2013-04-15 07:46:11 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js 2013-04-18 06:45:36 +0000
@@ -109,18 +109,25 @@
}
-function validateAddPatient( isContinue )
+function validateAddPatient( isContinue, disableRegistrationFields )
{
- $("#patientForm :input").attr("disabled", true);
- $("#patientForm").find("select").attr("disabled", true);
- $.ajax({
- type: "POST",
- url: 'validatePatient.action',
- data: getParamsForDiv('patientForm'),
- success: function(data){
- addValidationCompleted(data,isContinue);
- }
- });
+ if( disableRegistrationFields=='' || disableRegistrationFields=='false' )
+ {
+ $("#patientForm :input").attr("disabled", true);
+ $("#patientForm").find("select").attr("disabled", true);
+ $.ajax({
+ type: "POST",
+ url: 'validatePatient.action',
+ data: getParamsForDiv('patientForm'),
+ success: function(data){
+ addValidationCompleted(data,isContinue);
+ }
+ });
+ }
+ else
+ {
+ addPatient( isContinue );
+ }
}
function addValidationCompleted( data, isContinue )
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm 2013-04-17 09:20:46 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm 2013-04-18 06:45:36 +0000
@@ -18,22 +18,28 @@
</p>
<div class="contentProviderTable">
<table>
+ #if( $!patient.getFullName()!='' )
<tr>
<td>$i18n.getString("full_name")</td>
<td>$encoder.htmlEncode($!patient.getFullName())</td>
</tr>
+ #end
<tr>
<td>$i18n.getString("location")</td>
<td>$encoder.htmlEncode($!patient.organisationUnit.name)</td>
</tr>
+ #if( $!patient.gender )
<tr>
<td>$i18n.getString("gender")</td>
<td>$i18n.getString($!patient.gender)</td>
</tr>
+ #end
+ #if( $!patient.birthDate )
<tr>
<td>$i18n.getString("date_of_birth")</td>
<td>$format.formatDate( $!patient.birthDate) ($!patient.getAge())</td>
</tr>
+ #end
<tr>
<td>$i18n.getString("phone_number")</td>
<td>
=== 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 2013-04-08 05:43:06 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm 2013-04-18 06:45:36 +0000
@@ -10,6 +10,9 @@
#end
#end
+#if($!program && $program.disableRegistrationFields )
+
+#else
<tr id='registrationDateTR'>
<td class='text-column'><label for="registration_date">$i18n.getString( "registration_date" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td class="input-column" colspan='2'>
@@ -118,21 +121,23 @@
<tr><td> </td></tr>
- #if( $identifierTypes.size() > 0)
- <!--IDENTIFIERS -->
- <tr><th colspan="2" class="heading-column">$i18n.getString("patient_identifiers")</th></tr>
- #foreach ($identifierType in $identifierTypes)
- #if( $identifierType.program )
- #else
- #set( $identifier = '' )
- #set( $identifier = $identiferMap.get( $identifierType.id ) )
- <tr>
- <td class='text-column'><label>$encoder.htmlEncode($identifierType.displayName) #if($identifierType.mandatory) <em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
- <td class="input-column"><input type="text" id="iden$identifierType.id" name="iden$identifierType.id" value="$!identifier" data="{related:$identifierType.related}" #if($identifierType.related && $!patient.underAge) disabled="disabled" #end class="{validate:{required:$identifierType.mandatory, #if($!identifierType.noChars) maxlength:$identifierType.noChars, #end #if($identifierType.type=='number') number:true #elseif($!identifierType.type=='letter') lettersonly:true #end }}" /></td>
- </tr>
- #end
+#end
+
+#if( $identifierTypes.size() > 0)
+ <!--IDENTIFIERS -->
+ <tr><th colspan="2" class="heading-column">$i18n.getString("patient_identifiers")</th></tr>
+ #foreach ($identifierType in $identifierTypes)
+ #if( $identifierType.program )
+ #else
+ #set( $identifier = '' )
+ #set( $identifier = $identiferMap.get( $identifierType.id ) )
+ <tr>
+ <td class='text-column'><label>$encoder.htmlEncode($identifierType.displayName) #if($identifierType.mandatory) <em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
+ <td class="input-column"><input type="text" id="iden$identifierType.id" name="iden$identifierType.id" value="$!identifier" data="{related:$identifierType.related}" #if($identifierType.related && $!patient.underAge) disabled="disabled" #end class="{validate:{required:$identifierType.mandatory, #if($!identifierType.noChars) maxlength:$identifierType.noChars, #end #if($identifierType.type=='number') number:true #elseif($!identifierType.type=='letter') lettersonly:true #end }}" /></td>
+ </tr>
#end
#end
+#end
<!-- ATTRIBUTES IN GROUPS -->
=== 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 2013-04-10 04:35:21 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm 2013-04-18 06:45:36 +0000
@@ -98,20 +98,32 @@
#if($identifier.identifierType.id==$identifierType.id)
#set($value=$identifier.identifier)
#end
- #end
- #end
- #if($value=="")
- #set($value=$patient.getFullName())
+ #if($!identifier.identifierType)
+ #else
+ #set($systemId=$identifier.identifier)
+ #end
+ #end
+ #end
+ #if($value=="")
+ #set($value=$!patient.getFullName())
+ #end
+ #if($value=="")
+ #foreach( $identifier in $patient.identifiers)
+ #if($!identifier.identifierType)
+ #else
+ #set($value=$identifier.identifier)
+ #end
+ #end
#end
<td style="cursor:pointer;" onclick="javascript:isDashboard=true;showPatientDashboardForm( '$patient.id' )">
<a>$encoder.htmlEncode($value)</a>
</td>
- <td>$i18n.getString($!patient.gender)</td>
-
- <td>$format.formatDate( $!patient.birthDate)</td>
-
- <td>$!patient.getAge()</td>
+ <td>#if($!patient.gender) $i18n.getString($!patient.gender) #end</td>
+
+ <td>#if($!patient.birthDate) $format.formatDate( $!patient.birthDate) #end</td>
+
+ <td>#if($!patient.birthDate) $!patient.getAge() #end</td>
<td>$!patient.phoneNumber</td>
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgram.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgram.vm 2013-04-10 04:22:14 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgram.vm 2013-04-18 06:45:36 +0000
@@ -15,6 +15,7 @@
"noIdentifierTypes": "$!program.patientIdentifierTypes.size()",
"blockEntryForm": "$!program.blockEntryForm",
"onlyEnrollOnce": "$!program.onlyEnrollOnce",
- "remindCompleted": "$!program.remindCompleted"
+ "remindCompleted": "$!program.remindCompleted",
+ "disableRegistrationFields": "$!program.disableRegistrationFields"
}
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ViewPatientRegistrationFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ViewPatientRegistrationFormAction.java 2013-04-05 07:46:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ViewPatientRegistrationFormAction.java 2013-04-18 06:45:36 +0000
@@ -117,11 +117,6 @@
this.programId = programId;
}
- public Integer getProgramId()
- {
- return programId;
- }
-
private Collection<PatientAttribute> attributes = new HashSet<PatientAttribute>();
private Collection<PatientIdentifierType> identifierTypes = new HashSet<PatientIdentifierType>();
=== 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 2013-04-11 03:23:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java 2013-04-18 06:45:36 +0000
@@ -221,6 +221,13 @@
this.datesToCompare = datesToCompare;
}
+ private Boolean disableRegistrationFields;
+
+ public void setDisableRegistrationFields( Boolean disableRegistrationFields )
+ {
+ this.disableRegistrationFields = disableRegistrationFields;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -235,6 +242,7 @@
blockEntryForm = (blockEntryForm == null) ? false : blockEntryForm;
onlyEnrollOnce = (onlyEnrollOnce == null) ? false : onlyEnrollOnce;
remindCompleted = (remindCompleted == null) ? false : remindCompleted;
+ disableRegistrationFields = (disableRegistrationFields == null) ? false : disableRegistrationFields;
Program program = new Program();
@@ -249,6 +257,7 @@
program.setBlockEntryForm( blockEntryForm );
program.setOnlyEnrollOnce( onlyEnrollOnce );
program.setRemindCompleted( remindCompleted );
+ program.setDisableRegistrationFields( disableRegistrationFields );
if ( type == Program.MULTIPLE_EVENTS_WITH_REGISTRATION )
{
@@ -297,7 +306,7 @@
{
PatientReminder reminder = new PatientReminder( "", daysAllowedSendMessages.get( i ),
templateMessages.get( i ) );
- reminder.setDateToCompare(datesToCompare.get( i ));
+ reminder.setDateToCompare( datesToCompare.get( i ) );
patientReminders.add( reminder );
}
program.setPatientReminders( patientReminders );
=== 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 2013-04-11 03:23:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java 2013-04-18 06:45:36 +0000
@@ -217,6 +217,13 @@
this.datesToCompare = datesToCompare;
}
+ private Boolean disableRegistrationFields;
+
+ public void setDisableRegistrationFields( Boolean disableRegistrationFields )
+ {
+ this.disableRegistrationFields = disableRegistrationFields;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -230,6 +237,7 @@
ignoreOverdueEvents = (ignoreOverdueEvents == null) ? false : ignoreOverdueEvents;
blockEntryForm = (blockEntryForm == null) ? false : blockEntryForm;
remindCompleted = (remindCompleted == null) ? false : remindCompleted;
+ disableRegistrationFields = (disableRegistrationFields == null) ? false : disableRegistrationFields;
Program program = programService.getProgram( id );
program.setName( name );
@@ -243,6 +251,7 @@
program.setBlockEntryForm( blockEntryForm );
program.setOnlyEnrollOnce( onlyEnrollOnce );
program.setRemindCompleted( remindCompleted );
+ program.setDisableRegistrationFields( disableRegistrationFields );
if ( type == Program.MULTIPLE_EVENTS_WITH_REGISTRATION )
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/GetProgramStageListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/GetProgramStageListAction.java 2013-01-23 10:27:28 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/GetProgramStageListAction.java 2013-04-18 06:45:36 +0000
@@ -33,7 +33,6 @@
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
import org.hisp.dhis.program.ProgramStage;
-import org.hisp.dhis.program.ProgramStageService;
import com.opensymphony.xwork2.Action;
@@ -55,13 +54,6 @@
this.programService = programService;
}
- private ProgramStageService programStageService;
-
- public void setProgramStageService( ProgramStageService programStageService )
- {
- this.programStageService = programStageService;
- }
-
// -------------------------------------------------------------------------
// Input/Output
// -------------------------------------------------------------------------
@@ -106,7 +98,7 @@
{
program = programService.getProgram( id );
- associations = new ArrayList<ProgramStage>( programStageService.getProgramStages( program ) );
+ associations = new ArrayList<ProgramStage>( program.getProgramStages() );
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 2013-04-17 07:58:14 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2013-04-18 06:45:36 +0000
@@ -274,7 +274,6 @@
class="org.hisp.dhis.patient.action.programstage.GetProgramStageListAction"
scope="prototype">
<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
- <property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
</bean>
<bean id="org.hisp.dhis.patient.action.programstage.GetProgramStageAction"
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2013-04-17 07:58:14 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2013-04-18 06:45:36 +0000
@@ -387,4 +387,5 @@
program_indicator_details = Program indicator details
date_for_calculating = Date for calculating
create_new_program_indicator = Create new program indicator
-update_program_indicator = Edit program indicator
\ No newline at end of file
+update_program_indicator = Edit program indicator
+disable_registration_fields = Disable registration fields
\ 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/addProgramForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm 2013-04-11 03:23:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm 2013-04-18 06:45:36 +0000
@@ -113,6 +113,12 @@
</tr>
<tr name='nonAnonymous'>
+ <td><label>$i18n.getString( "disable_registration_fields" )</label></td>
+ <td><input type="checkbox" id="disableRegistrationFields" name="disableRegistrationFields" value='true' ></td>
+ <td></td>
+ </tr>
+
+ <tr name='nonAnonymous'>
<td><label>$i18n.getString( "generated_events_by_enrollment_date" )</label></td>
<td><input type="checkbox" id="generatedByEnrollmentDate" name="generatedByEnrollmentDate" value='true'></td>
<td></td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm 2013-04-12 12:06:21 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm 2013-04-18 06:45:36 +0000
@@ -4,8 +4,9 @@
<h4>$program.displayName</h4>
-<form id="addProgramStageForm" name="addProgramStageForm" action="addProgramStage.action" method="post">
+<form id="addProgramStageForm" name="addProgramStageForm" action="addProgramStage.action" method="get">
<input type="hidden" id="programId" name="programId" value="$program.id"/>
+ <input type='hidden' id="id" name="id" value="$program.id"/>
<select id='daysAllowedSendMessages' name="daysAllowedSendMessages" multiple="multiple" class="hidden"></select>
<select id='templateMessages' name="templateMessages" multiple="multiple" class="hidden"></select>
<table>
=== 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 2013-04-11 03:23:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js 2013-04-18 06:45:36 +0000
@@ -38,6 +38,9 @@
var remindCompleted = ( json.program.remindCompleted == 'true') ? i18n_yes : i18n_no;
setInnerHTML( 'remindCompletedField', remindCompleted );
+ var disableRegistrationFields = ( json.program.disableRegistrationFields == 'true') ? i18n_yes : i18n_no;
+ setInnerHTML( 'disableRegistrationFieldsField', disableRegistrationFields );
+
setInnerHTML( 'dateOfEnrollmentDescriptionField', json.program.dateOfEnrollmentDescription );
setInnerHTML( 'dateOfIncidentDescriptionField', json.program.dateOfIncidentDescription );
setInnerHTML( 'programStageCountField', json.program.programStageCount );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewPatientRegistationForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewPatientRegistationForm.js 2013-04-09 02:22:46 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewPatientRegistationForm.js 2013-04-18 06:45:36 +0000
@@ -121,59 +121,61 @@
function getRequiredFields()
{
var requiredFields = {};
-
- requiredFields['fixedattributeid=registrationDate'] = i18n_registration_date;
- requiredFields['fixedattributeid=fullName'] = i18n_full_name;
- requiredFields['fixedattributeid=gender'] = i18n_gender;
- requiredFields['fixedattributeid=birthDate'] = i18n_date_of_birth;
+ if( getFieldValue("disableRegistrationFields")=='false' )
+ {
+ requiredFields['fixedattributeid=registrationDate'] = i18n_registration_date;
+ requiredFields['fixedattributeid=fullName'] = i18n_full_name;
+ requiredFields['fixedattributeid=gender'] = i18n_gender;
+ requiredFields['fixedattributeid=birthDate'] = i18n_date_of_birth;
+
+ jQuery('#identifiersSelector option').each(function() {
+ var item = jQuery(this);
+ if( item.attr('mandatory')=='true'){
+ requiredFields['identifierid=' + item.val()] = item.text();
+ }
+ });
+
+ jQuery('#attributesSelector option').each(function() {
+ var item = jQuery(this);
+ if( item.attr('mandatory')=='true'){
+ requiredFields['attributeid=' + item.val()] = item.text();
+ }
+ });
- jQuery('#identifiersSelector option').each(function() {
- var item = jQuery(this);
- if( item.attr('mandatory')=='true'){
- requiredFields['identifierid=' + item.val()] = item.text();
- }
- });
-
- jQuery('#attributesSelector option').each(function() {
- var item = jQuery(this);
- if( item.attr('mandatory')=='true'){
- requiredFields['attributeid=' + item.val()] = item.text();
- }
- });
-
- var html = jQuery("#designTextarea").ckeditorGet().getData();
- var input = jQuery( html ).find("input");
- if( input.length > 0 )
- {
- input.each( function(i, item){
- var key = "";
- var inputKey = jQuery(item).attr('fixedattributeid');
- if( inputKey!=undefined)
- {
- key = 'fixedattributeid=' + inputKey
- }
- else if( jQuery(item).attr('identifierid')!=undefined ){
- inputKey = jQuery(item).attr('identifierid');
- key = 'identifierid=' + inputKey
- }
- else if( jQuery(item).attr('attributeid')!=undefined ){
- inputKey = jQuery(item).attr('attributeid');
- key = 'attributeid=' + inputKey
- }
- else if( jQuery(item).attr('programid')!=undefined ){
- inputKey = jQuery(item).attr('programid');
- key = 'programid=' + inputKey
- }
-
- for (var idx in requiredFields){
- if( key == idx)
+ var html = jQuery("#designTextarea").ckeditorGet().getData();
+ var input = jQuery( html ).find("input");
+ if( input.length > 0 )
+ {
+ input.each( function(i, item){
+ var key = "";
+ var inputKey = jQuery(item).attr('fixedattributeid');
+ if( inputKey!=undefined)
{
- delete requiredFields[idx];
- }
- }
- });
+ key = 'fixedattributeid=' + inputKey
+ }
+ else if( jQuery(item).attr('identifierid')!=undefined ){
+ inputKey = jQuery(item).attr('identifierid');
+ key = 'identifierid=' + inputKey
+ }
+ else if( jQuery(item).attr('attributeid')!=undefined ){
+ inputKey = jQuery(item).attr('attributeid');
+ key = 'attributeid=' + inputKey
+ }
+ else if( jQuery(item).attr('programid')!=undefined ){
+ inputKey = jQuery(item).attr('programid');
+ key = 'programid=' + inputKey
+ }
+
+ for (var idx in requiredFields){
+ if( key == idx)
+ {
+ delete requiredFields[idx];
+ }
+ }
+ });
+ }
+
}
-
return requiredFields;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm 2013-04-17 08:20:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm 2013-04-18 06:45:36 +0000
@@ -85,11 +85,19 @@
<a href="javascript:hideDetails()" title="$i18n.getString( "hide_details" )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"></a>
</div>
<p><label class="bold">$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
- <p><label class="bold">$i18n.getString( "code" ):</label><br><span id="codeField"></span></p>
<p><label class="bold">$i18n.getString( "description" ):</label><br><span id="descriptionField"></span></p>
- <p><label class="bold">$i18n.getString( "valueType" ):</label><br><span id="valueTypeField"></span></p>
- <p><label class="bold">$i18n.getString( "rootDate" ):</label><br><span id="rootDateField"></span></p>
- <p><label class="bold">$i18n.getString( "expression" ):</label><br><span id="expressionField"></span></p>
+ <p><label class="bold">$i18n.getString( "type" ):</label><br><span id="typeField"></span></p>
+ <p><label class="bold">$i18n.getString( "display_provided_other_facility_column" ):</label><br><span id="displayProvidedOtherFacilityField"></span></p>
+ <p><label class="bold">$i18n.getString( "display_date_of_incident" ):</label><br><span id="displayIncidentDateField"></span></p> <p><label class="bold">$i18n.getString( "generated_events_by_enrollment_date" ):</label><br><span id="generatedByEnrollmentDateField"></span></p>
+ <p><label class="bold">$i18n.getString( "ignore_to_generate_overdue_events" ):</label><br><span id="ignoreOverdueEventsField"></span></p>
+ <p><label class="bold">$i18n.getString( "only_enroll_once" ):</label><br><span id="onlyEnrollOnceField"></span></p>
+ <p><label class="bold">$i18n.getString( "block_entry_form_after_completed" ):</label><br><span id="blockEntryFormField"></span></p>
+ <p><label class="bold">$i18n.getString( "remind_completing_program_after_program_stage_completed" ):</label><br><span id="remindCompletedField"></span></p>
+ <p><label class="bold">$i18n.getString( "disable_registration_fields" ):</label><br><span id="disableRegistrationFieldsField"></span></p>
+ <p><label class="bold">$i18n.getString( "date_of_enrollment_description" ):</label><br><span id="dateOfEnrollmentDescriptionField"></span></p>
+ <p><label class="bold">$i18n.getString( "date_of_incident_description" ):</label><br><span id="dateOfIncidentDescriptionField"></span></p>
+ <p><label class="bold">$i18n.getString( "number_of_attributes" ):</label><br><span id="noAttributesField"></span></p>
+ <p><label class="bold">$i18n.getString( "number_of_identifier_types" ):</label><br><span id="noIdentifierTypesField"></span></p>
</div>
</td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm 2013-04-11 03:23:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm 2013-04-18 06:45:36 +0000
@@ -118,6 +118,12 @@
</tr>
<tr name='nonAnonymous'>
+ <td><label>$i18n.getString( "disable_registration_fields" )</label></td>
+ <td><input type="checkbox" id="disableRegistrationFields" name="disableRegistrationFields" value='true' #if($program.disableRegistrationFields=='true') checked #end #if( $program.type=='3' ) disabled #end ></td>
+ <td></td>
+ </tr>
+
+ <tr name='nonAnonymous'>
<td><label>$i18n.getString( "generated_events_by_enrollment_date" )</label></td>
<td><input type="checkbox" id="generatedByEnrollmentDate" name="generatedByEnrollmentDate" value='true' #if($program.generatedByEnrollmentDate=='true') checked #end #if( $program.type!='1' ) disabled #end ></td>
<td></td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.vm 2013-04-09 02:22:46 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.vm 2013-04-18 06:45:36 +0000
@@ -20,7 +20,7 @@
jQuery("#designTextarea").ckeditorGet().setData('$encoder.jsEscape( $!registrationForm.dataEntryForm.htmlCode, "'" )');
#end
- checkValueIsExist( "name", "validateDataEntryForm.action", { dataEntryFormId: '$!registrationForm.dataEntryForm.id' } );
+ checkValueIsExist( "name", "validateDataEntryForm.action", { dataEntryFormId: getFieldValue('dataEntryFormId') } );
});
var i18n_dataelement_is_inserted = '$encoder.jsEscape( $i18n.getString( "dataelement_is_inserted" ) , "'" )';
@@ -54,7 +54,8 @@
<form id="saveDataEntryForm" name="saveDataEntryForm" action="savePatientRegistrationForm.action" method="post" onsubmit="return validateForm();">
<input type="hidden" name="id" id="id" value="$!registrationForm.id"/>
-<input type="hidden" name="programId" id="programId" value="$!programId"/>
+<input type="hidden" name="programId" id="programId" value="$!program.id"/>
+<input type="hidden" name="disableRegistrationFields" id="disableRegistrationFields" value="$program.disableRegistrationFields"/>
<input type="hidden" name="dataEntryFormId" id="dataEntryFormId" value="$!registrationForm.dataEntryForm.id"/>
<h3>$i18n.getString( "add_patient_registration_form" )</h3>
@@ -187,9 +188,9 @@
<tr>
<td>
<select id="programAttrSelector" multiple="multiple" style="width:450px;height:270px" ondblclick="insertElement( 'prg' )">
- <option value="enrollmentDate">$encoder.htmlEncode($program.dateOfEnrollmentDescription)</option>
+ <option value="enrollmentDate" class="bold">$encoder.htmlEncode($program.dateOfEnrollmentDescription)</option>
#if($program.displayIncidentDate=='true')
- <option value="dateOfIncident">$encoder.htmlEncode($program.dateOfIncidentDescription)</option>
+ <option value="dateOfIncident" class="bold">$encoder.htmlEncode($program.dateOfIncidentDescription)</option>
#end
</select>
</td>