dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #38573
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19648: bug fix in validating zero during zero or positive integer data entry
------------------------------------------------------------
revno: 19648
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-07-14 20:31:13 +0200
message:
bug fix in validating zero during zero or positive integer data entry
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.validations.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-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.validations.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.validations.js 2015-06-15 11:04:20 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.validations.js 2015-07-14 18:31:13 +0000
@@ -7,27 +7,32 @@
function setValidity(numberType, isRequired){
if(numberType === 'number'){
- ngModel.$validators.number = function(value) {
+ ngModel.$validators.number = function(value) {
+ value = value === 0 ? value.toString(): value;
return value === 'null' || !value ? !isRequired : dhis2.validation.isNumber(value);
};
}
else if(numberType === 'posInt'){
- ngModel.$validators.posInt = function(value) {
+ ngModel.$validators.posInt = function(value) {
+ value = value === 0 ? value.toString(): value;
return value === 'null' || !value ? !isRequired : dhis2.validation.isPositiveInt(value);
};
}
else if(numberType === 'negInt'){
ngModel.$validators.negInt = function(value) {
+ value = value === 0 ? value.toString(): value;
return value === 'null' || !value ? !isRequired : dhis2.validation.isNegativeInt(value);
};
}
else if(numberType === 'zeroPositiveInt'){
- ngModel.$validators.zeroPositiveInt = function(value) {
+ ngModel.$validators.zeroPositiveInt = function(value) {
+ value = value === 0 ? value.toString(): value;
return value === 'null' || !value ? !isRequired : dhis2.validation.isZeroOrPositiveInt(value);
};
}
else if(numberType === 'int'){
ngModel.$validators.int = function(value) {
+ value = value === 0 ? value.toString(): value;
return value === 'null' || !value ? !isRequired : dhis2.validation.isInt(value);
};
}