dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #30696
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15606: Fixed bug - Adding new representative function doesn't work.
------------------------------------------------------------
revno: 15606
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-06-10 15:41:19 +0800
message:
Fixed bug - Adding new representative function doesn't work.
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/AddRepresentativeAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ShowAddTrackedEntityInstanceFormAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addTrackedEntityInstanceForm.vm
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/underage.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectTrackedEntityInstance.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.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/trackedentity/AddRepresentativeAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/AddRepresentativeAction.java 2014-04-12 12:12:30 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/AddRepresentativeAction.java 2014-06-10 07:41:19 +0000
@@ -95,7 +95,7 @@
// ---------------------------------------------------------------------
HttpServletRequest request = ServletActionContext.getRequest();
-
+ System.out.println( "\n\n === \n attributeService : " + attributeService );
Collection<TrackedEntityAttribute> attributes = attributeService.getAllTrackedEntityAttributes();
Set<TrackedEntityAttributeValue> entityInstanceAttributeValues = new HashSet<TrackedEntityAttributeValue>();
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ShowAddTrackedEntityInstanceFormAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ShowAddTrackedEntityInstanceFormAction.java 2014-06-09 12:47:03 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ShowAddTrackedEntityInstanceFormAction.java 2014-06-10 07:41:19 +0000
@@ -277,6 +277,13 @@
return mandatoryMap;
}
+ private List<TrackedEntityAttribute> attributes = new ArrayList<TrackedEntityAttribute>();
+
+ public List<TrackedEntityAttribute> getAttributes()
+ {
+ return attributes;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -334,8 +341,6 @@
}
}
- List<TrackedEntityAttribute> attributes = new ArrayList<TrackedEntityAttribute>();
-
if ( customRegistrationForm == null )
{
attributeGroups = new ArrayList<TrackedEntityAttributeGroup>(
@@ -347,7 +352,7 @@
attributes = new ArrayList<TrackedEntityAttribute>(
attributeService.getTrackedEntityAttributesDisplayInList() );
Collections.sort( attributes, new TrackedEntityAttributeSortOrderInListNoProgramComparator() );
-
+
for ( TrackedEntityAttribute attribute : attributes )
{
mandatoryMap.put( attribute.getId(), false );
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2014-05-29 15:19:07 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2014-06-10 07:41:19 +0000
@@ -456,9 +456,11 @@
<bean id="org.hisp.dhis.caseentry.action.trackedentity.AddRepresentativeAction"
class="org.hisp.dhis.caseentry.action.trackedentity.AddRepresentativeAction"
scope="prototype">
+ <property name="entityInstanceService" ref="org.hisp.dhis.trackedentity.TrackedEntityInstanceService" />
<property name="selectionManager"
ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
- <property name="entityInstanceService" ref="org.hisp.dhis.trackedentity.TrackedEntityInstanceService" />
+ <property name="attributeService"
+ ref="org.hisp.dhis.trackedentity.TrackedEntityAttributeService" />
</bean>
<bean id="org.hisp.dhis.caseentry.action.trackedentity.GetTrackedEntityInstanceHistoryAction"
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2014-05-27 14:29:29 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2014-06-10 07:41:19 +0000
@@ -687,4 +687,5 @@
all_statuses = All statuses
event_date = Event date
duplicate_value_of = Duplicate value of
-data_values = Data values
\ No newline at end of file
+data_values = Data values
+add_tracked_entity_instance_successfully = Add tracked entity instance successfully
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2014-05-25 10:52:53 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2014-06-10 07:41:19 +0000
@@ -498,7 +498,7 @@
</action>
<action name="showAddRepresentative"
- class="org.hisp.dhis.caseentry.action.trackedentity.ShowAddRepresentativeAction">
+ class="org.hisp.dhis.caseentry.action.trackedentity.ShowAddTrackedEntityInstanceFormAction">
<result name="success" type="velocity">/content.vm</result>
<param name="page">/dhis-web-caseentry/underAgeForm.vm</param>
<param name="javascripts">javascript/underage.js,
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm 2014-06-01 14:48:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm 2014-06-10 07:41:19 +0000
@@ -46,7 +46,7 @@
<script>
var i18n_error_connect_to_server = '$encoder.jsEscape( $i18n.getString( "error_connect_to_server" ) , "'" )';
- var i18n_add_person_successfully = '$encoder.jsEscape( $i18n.getString( "add_person_successfully" ) , "'" )';
+ var i18n_add_tracked_entity_instance_successfully = '$encoder.jsEscape( $i18n.getString( "add_tracked_entity_instance_successfully" ) , "'" )';
setInnerHTML('entryName', jQuery('#program option:selected').text() );
setFieldValue("programStageId", getFieldValue("program"));
</script>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addTrackedEntityInstanceForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addTrackedEntityInstanceForm.vm 2014-04-21 16:30:29 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addTrackedEntityInstanceForm.vm 2014-06-10 07:41:19 +0000
@@ -90,6 +90,6 @@
<script>
var i18n_error_connect_to_server = '$encoder.jsEscape( $i18n.getString( "error_connect_to_server" ) , "'" )';
- var i18n_add_person_successfully = '$encoder.jsEscape( $i18n.getString( "add_person_successfully" ) , "'" )';
+ var i18n_add_tracked_entity_instance_successfully = '$encoder.jsEscape( $i18n.getString( "add_tracked_entity_instance_successfully" ) , "'" )';
var i18n_error_connect_to_server = '$encoder.jsEscape( $i18n.getString( "error_connect_to_server" ) , "'" )';
</script>
\ No newline at end of file
=== 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-05-29 14:28:10 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2014-06-10 07:41:19 +0000
@@ -994,23 +994,25 @@
// -----------------------------------------------------------------------------
// Show representative form
// -----------------------------------------------------------------------------
+
function toggleUnderAge(this_) {
if ($(this_).is(":checked")) {
$('#representativeDiv').dialog('destroy').remove();
$('<div id="representativeDiv">').load('showAddRepresentative.action',
- {}, function() {
- }).dialog({
- title : i18n_tracker_associate,
- maximize : true,
- closable : true,
- modal : true,
- overlay : {
- background : '#000000',
- opacity : 0.1
- },
- width : 800,
- height : 450
- });
+ {
+ related:true
+ }, function() {}).dialog({
+ title : i18n_tracker_associate,
+ maximize : true,
+ closable : true,
+ modal : true,
+ overlay : {
+ background : '#000000',
+ opacity : 0.1
+ },
+ width : 800,
+ height : 450
+ });
} else {
$("#representativeDiv :input.idfield").each(function() {
if ($(this).is(":disabled")) {
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/underage.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/underage.js 2014-05-25 14:36:40 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/underage.js 2014-06-10 07:41:19 +0000
@@ -4,53 +4,28 @@
function validateAddRepresentative()
{
- $.postUTF8("validateTrackedEntityInstance.action?" + getIdentifierTypeIdParams(),
- {
- }, addValidationRepresentativeCompleted, "xml" );
-}
-
-function addValidationRepresentativeCompleted( messageElement )
-{
- var type = $(messageElement).find('message').attr('type');
- var message = $(messageElement).find('message').text();
-
- if ( type == 'success' )
- {
- if( message == 0 ){
- jQuery.ajax({
- type: "POST"
- ,url: "addRepresentative.action"
- ,data: jQuery("#addRepresentativeForm").serialize()
- ,dataType : "xml"
- ,success: function(xml){
- autoChooseTEI( xml );
- }
- ,error: function()
- {
- alert(i18n_error_connect_to_server);
- }
- });
- }
- else if( message == 1 ){
- showErrorMessage( i18n_adding_tracked_entity_instance_failed + ':' + '\n' + i18n_duplicate_identifier );
- }
- else if( message == 2 ){
- showErrorMessage( i18n_adding_tracked_entity_instance_failed + ':' + '\n' + i18n_this_tracked_entity_instance_could_not_be_enrolled_please_check_validation_criteria );
- }
- }
- else if ( type == 'error' )
- {
- showErrorMessage( i18n_adding_tracked_entity_instance_failed + ':' + '\n' + message );
- }
- else if ( type == 'input' )
- {
- showWarningMessage( message );
- }
- else if( type == 'duplicate' )
- {
- jQuery("#formContainer").hide();
- showTEIs("listPersonsDuplicate", messageElement);
- }
+ $.postJSON("validateTrackedEntityInstance.action?" + getIdentifierTypeIdParams()
+ ,{}
+ , function(json){
+ if( json.message.length == 0 ){
+ jQuery.ajax({
+ type: "POST"
+ ,url: "addRepresentative.action"
+ ,data: jQuery("#addRepresentativeForm").serialize()
+ ,dataType : "xml"
+ ,success: function(xml){
+ autoChooseTEI( xml );
+ }
+ ,error: function()
+ {
+ alert(i18n_error_connect_to_server);
+ }
+ });
+ }
+ else{
+ showErrorMessage( json.message );
+ }
+ });
}
//get and build a param String of all the identifierType id and its value
@@ -58,7 +33,7 @@
function getIdentifierTypeIdParams()
{
var params = "";
- jQuery("#addRepresentativeForm :input.idfield").each(
+ jQuery("#addRepresentativeForm :input").each(
function()
{
if( jQuery(this).val() && !jQuery(this).is(":disabled") )
@@ -161,7 +136,7 @@
// Will be call after save new TEI successfully
function autoChooseTEI( xmlElement )
{
- jQuery("#tab-2").html("<center><span class='bold'>" + i18n_add_person_successfully + "</span></center>");
+ jQuery("#tab-2").html("<center><span class='bold'>" + i18n_add_tracked_entity_instance_successfully + "</span></center>");
var root = jQuery(xmlElement);
jQuery("#entityInstanceForm [id=representativeId]").val( root.find("id").text() );
jQuery("#entityInstanceForm [id=relationshipTypeId]").val( root.find("relationshipTypeId").text() );
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm 2014-05-25 09:27:50 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm 2014-06-10 07:41:19 +0000
@@ -153,7 +153,7 @@
var i18n_error_required_field = '$encoder.jsEscape( $i18n.getString( "error_required_field" ) , "'")';
var i18n_violate_validation = '$encoder.jsEscape( $i18n.getString( "violate_validation" ) , "'")';
var i18n_date_is_greater_then_or_equals_due_date = '$encoder.jsEscape( $i18n.getString( "date_is_greater_then_or_equals_due_date" ) , "'")';
- var i18n_add_person_successfully = '$encoder.jsEscape( $i18n.getString( "add_person_successfully" ) , "'")';
+ var i18n_add_tracked_entity_instance_successfully = '$encoder.jsEscape( $i18n.getString( "add_tracked_entity_instance_successfully" ) , "'")';
var i18n_please_select_relationship_type = '$encoder.jsEscape( $i18n.getString( "please_select_relationship_type" ) , "'")';
var i18n_please_select_a_tracked_entity_instance_for_setting_relationship = '$encoder.jsEscape( $i18n.getString( "please_select_a_tracked_entity_instance_for_setting_relationship" ) , "'")';
var i18n_update_tracked_entity_instance = '$encoder.jsEscape( $i18n.getString( "update_tracked_entity_instance" ) , "'")';
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectTrackedEntityInstance.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectTrackedEntityInstance.vm 2014-04-24 16:30:48 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectTrackedEntityInstance.vm 2014-06-10 07:41:19 +0000
@@ -91,7 +91,7 @@
var i18n_error_required_field = '$encoder.jsEscape( $i18n.getString( "error_required_field" ) , "'")';
var i18n_violate_validation = '$encoder.jsEscape( $i18n.getString( "violate_validation" ) , "'")';
var i18n_date_is_greater_then_or_equals_due_date = '$encoder.jsEscape( $i18n.getString( "date_is_greater_then_or_equals_due_date" ) , "'")';
- var i18n_add_person_successfully = '$encoder.jsEscape( $i18n.getString( "add_person_successfully" ) , "'")';
+ var i18n_add_tracked_entity_instance_successfully = '$encoder.jsEscape( $i18n.getString( "add_tracked_entity_instance_successfully" ) , "'")';
var i18n_please_select_relationship_type = '$encoder.jsEscape( $i18n.getString( "please_select_relationship_type" ) , "'")';
var i18n_please_select_a_tracked_entity_instance_for_setting_relationship = '$encoder.jsEscape( $i18n.getString( "please_select_a_tracked_entity_instance_for_setting_relationship" ) , "'")';
var i18n_update_tracked_entity_instance = '$encoder.jsEscape( $i18n.getString( "update_tracked_entity_instance" ) , "'")';
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm 2014-05-25 04:29:18 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm 2014-06-10 07:41:19 +0000
@@ -124,7 +124,7 @@
var i18n_search_result = '$encoder.jsEscape( $i18n.getString( "search_result" ) , "'")';
var i18n_show_data_entry = '$encoder.jsEscape( $i18n.getString( "show_data_entry" ) , "'")';
var i18n_color_quick_help = '$encoder.jsEscape( $i18n.getString( "color_quick_help" ) , "'")';
- var i18n_add_person_successfully = '$encoder.jsEscape( $i18n.getString( "add_person_successfully" ) , "'")';
+ var i18n_add_tracked_entity_instance_successfully = '$encoder.jsEscape( $i18n.getString( "add_tracked_entity_instance_successfully" ) , "'")';
var i18n_please_select_relationship_type = '$encoder.jsEscape( $i18n.getString( "please_select_relationship_type" ) , "'")';
var i18n_please_select_a_tracked_entity_instance_for_setting_relationship = '$encoder.jsEscape( $i18n.getString( "please_select_a_tracked_entity_instance_for_setting_relationship" ) , "'")';
var i18n_update_tracked_entity_instance = '$encoder.jsEscape( $i18n.getString( "update_tracked_entity_instance" ) , "'")';