=== 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 19:44:17 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js 2013-10-09 20:03:59 +0000 @@ -207,7 +207,7 @@ data: JSON.stringify( event ), cache: false } ).done( function ( json ) { - if ( json.response == 'success' ) { + if ( json.response === 'success' ) { DAO.store.delete( 'dataValues', event.id ).done( function () { updateOfflineEvents(); searchEvents( eval( getFieldValue( 'listAll' ) ) ); @@ -271,7 +271,7 @@ promise = promise.then( loadOptionSets ); promise = promise.then( updateOfflineEvents ); promise = promise.then( checkOfflineData ); - promise = promise.then( function () { + promise.then( function () { $("#programId").removeAttr('disabled'); selection.setListenerFunction( organisationUnitSelected ); @@ -854,18 +854,19 @@ function removeEvent( programStageId ) { var s = "" + programStageId; - if( s.indexOf("local") != -1) { - if ( confirm( i18n_comfirm_delete_event ) ) { - DAO.store.delete( 'dataValues', programStageId ).always( function () { - updateOfflineEvents(); - - // needed, seemed that from time-to-time the events are updated too early, could be idb related - setTimeout(updateOfflineEvents, 400); - } ); + DAO.store.get('dataValues', programStageId).done(function(obj) { + if(obj) { + if( confirm(i18n_comfirm_delete_event) ) { + DAO.store.delete('dataValues', programStageId).always(function() { + updateOfflineEvents(); + // needed, seemed that from time-to-time the events are updated too early, could be idb related + setTimeout(updateOfflineEvents, 100); + }); + } + } else { + removeItem( programStageId, '', i18n_comfirm_delete_event, 'removeCurrentEncounter.action' ); } - } else { - removeItem( programStageId, '', i18n_comfirm_delete_event, 'removeCurrentEncounter.action' ); - } + }); } function showUpdateEvent( programStageInstanceId ) { === 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-09 19:39:35 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js 2013-10-09 20:03:59 +0000 @@ -743,8 +743,6 @@ }; function loadProgramStageInstance( programStageInstanceId, always ) { - console.log('loading: ' + programStageInstanceId); - $( "#programStageInstanceId" ).val( programStageInstanceId ); $( "#entryFormContainer input[id='programStageInstanceId']" ).val( programStageInstanceId );