dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40478
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20528: tracker-capture: centralized datavalue formatting
------------------------------------------------------------
revno: 20528
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-10-06 17:14:42 +0200
message:
tracker-capture: centralized datavalue formatting
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.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-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2015-10-06 14:56:11 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2015-10-06 15:14:42 +0000
@@ -9,6 +9,7 @@
$timeout,
$translate,
Paginator,
+ CommonUtils,
DateUtils,
EventUtils,
orderByFilter,
@@ -513,24 +514,12 @@
});
if (oldValue !== value) {
- if (value) {
- if (prStDe.dataElement.valueType === 'DATE') {
- value = DateUtils.formatFromUserToApi(value);
- }
- if (prStDe.dataElement.optionSetValue) {
- if (prStDe.dataElement.optionSet && $scope.optionSets[prStDe.dataElement.optionSet.id] && $scope.optionSets[prStDe.dataElement.optionSet.id].options) {
- value = OptionSetService.getCode($scope.optionSets[prStDe.dataElement.optionSet.id].options, value);
- }
- }
- }
-
+
+ value = CommonUtils.formatDataValue(value, prStDe.dataElement, $scope.optionSets, 'API');
+
$scope.updateSuccess = false;
- $scope.currentElement = {id: prStDe.dataElement.id, event: eventToSave.event, saved: false};
-
- if(value === false && prStDe.dataElement.valueType === "TRUE_ONLY" ) {
- value = "";
- }
+ $scope.currentElement = {id: prStDe.dataElement.id, event: eventToSave.event, saved: false};
var ev = {event: eventToSave.event,
orgUnit: eventToSave.orgUnit,