← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12554: made form loading in anonymous registration more robust, add back 'complete and add new' function...

 

------------------------------------------------------------
revno: 12554
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-10-10 13:07:46 +0200
message:
  made form loading in anonymous registration more robust, add back 'complete and add new' functionality
modified:
  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/entry.js


--
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/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2013-10-10 10:30:43 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2013-10-10 11:07:46 +0000
@@ -1041,16 +1041,16 @@
 
                         programStageInstanceId = "local"+i;
 
-                        setFieldValue( 'programStageInstanceId', programStageInstanceId );
-                        $( "#executionDate" ).css( 'background-color', SUCCESS_COLOR );
-                        showUpdateEvent( programStageInstanceId );
-
                         var data = {};
                         data.id = programStageInstanceId;
                         data.executionDate = createExecutionDate(programId, programStageInstanceId, executionDate, organisationUnitId);
                         data.executionDate.completed = 'false';
 
-                        this.set( 'dataValues', data );
+                        this.set( 'dataValues', data).done(function() {
+                            setFieldValue( 'programStageInstanceId', programStageInstanceId );
+                            $( "#executionDate" ).css( 'background-color', SUCCESS_COLOR );
+                            showUpdateEvent( programStageInstanceId );
+                        });
                     });
                 } else {
                     // if we have a programStageInstanceId, just reuse that one

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2013-10-10 09:22:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2013-10-10 11:07:46 +0000
@@ -500,7 +500,7 @@
 		});
 
 		$("#loading-bar").siblings(".ui-dialog-titlebar").hide();
-		
+
 		$.get( 'validateProgram.action').done(function(html){
             $("#loading-bar").dialog("close");
             $('#validateProgramDiv').html(html);
@@ -621,21 +621,22 @@
                             }
 
                             obj.executionDate.completed = 'true';
-                            DAO.store.set('dataValues', obj);
+
+                            DAO.store.set('dataValues', obj).done(function() {
+                                var blocked = $('#entryFormContainer [id=blockEntryForm]').val();
+
+                                if( blocked == 'true' ) {
+                                    blockEntryForm();
+                                }
+
+                                disableCompletedButton(true);
+                                hideLoader();
+
+                                if( isCreateEvent ) {
+                                    showAddEventForm(isCreateEvent);
+                                }
+                            });
                         });
-
-                        var blocked = $('#entryFormContainer [id=blockEntryForm]').val();
-
-                        if( blocked == 'true' ) {
-                            blockEntryForm();
-                        }
-
-                        disableCompletedButton(true);
-                        hideLoader();
-
-                        if( isCreateEvent ) {
-                            showAddEventForm(isCreateEvent);
-                        }
                     }
                 }
             });