← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2866: Add audit when changing datavalue.

 

------------------------------------------------------------
revno: 2866
committer: Quang <Quang@Quang-PC>
branch nick: trunk
timestamp: Thu 2011-02-17 23:53:18 +0700
message:
  Add audit when changing datavalue.
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueService.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties


--
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-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueService.java	2010-11-15 18:02:43 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueService.java	2011-02-17 16:53:18 +0000
@@ -30,6 +30,7 @@
 import static org.hisp.dhis.dataelement.DataElement.AGGREGATION_OPERATOR_AVERAGE;
 
 import java.util.Collection;
+import java.util.Date;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -90,6 +91,12 @@
         }
         else if ( isSignificant( dataValue ) )
         {
+            String oldValue = dataValueStore.getValue( dataValue.getDataElement().getId(), dataValue.getPeriod().getId(), dataValue.getSource().getId(), dataValue.getOptionCombo().getId() );
+            
+            DataValueAudit audit = new DataValueAudit(dataValue, dataValue.getValue(), dataValue.getStoredBy(), new Date(), oldValue);
+            
+            dataValueAuditService.addDataValueAudit( audit );
+            
             dataValueStore.updateDataValue( dataValue );
         }
     }

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties	2011-02-15 20:05:26 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties	2011-02-17 16:53:18 +0000
@@ -118,4 +118,7 @@
 prev 								= Prev
 select_from_tree					= Select from tree on the left side
 select_data_set						= Select data set
-select_period						= Select period
\ No newline at end of file
+select_period						= Select period
+change_from							= change from
+to									= to
+on									= On
\ No newline at end of file