dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #25349
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12553: bugfix for remove event button (inside anonymous data entry form)
------------------------------------------------------------
revno: 12553
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-10-10 12:30:43 +0200
message:
bugfix for remove event button (inside anonymous data entry form)
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.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-09 20:17:14 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js 2013-10-10 10:30:43 +0000
@@ -941,21 +941,36 @@
}
function removeCurrentEvent() {
+ var programStageInstanceId = getFieldValue( 'programStageInstanceId' );
+
+ DAO.store.get('dataValues', programStageInstanceId).done(function(obj) {
+ if(obj) {
+ if( confirm(i18n_comfirm_delete_event) ) {
+ DAO.store.delete('dataValues', programStageInstanceId).always(function() {
+ setTimeout(backEventList, 200);
+ });
+ }
+ } else {
+ removeCurrentEventFromServer();
+ }
+ });
+}
+
+function removeCurrentEventFromServer() {
var result = window.confirm( i18n_comfirm_delete_event );
+
if ( result ) {
- $.postJSON(
- "removeCurrentEncounter.action",
- {
- "id": getFieldValue( 'programStageInstanceId' )
- },
- function ( json ) {
- if ( json.response == "success" ) {
- backEventList();
- }
- else if ( json.response == "error" ) {
- showWarningMessage( json.message );
- }
- } );
+ $.postJSON( "removeCurrentEncounter.action", {
+ "id": getFieldValue( 'programStageInstanceId' )
+ },
+ function ( json ) {
+ if ( json.response == "success" ) {
+ backEventList();
+ }
+ else if ( json.response == "error" ) {
+ showWarningMessage( json.message );
+ }
+ } );
}
}