dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24824
[Merge] lp:~sis-ma/dhis2/SISMA-362 into lp:dhis2
Leandro Soares has proposed merging lp:~sis-ma/dhis2/SISMA-362 into lp:dhis2.
Requested reviews:
DHIS 2 core developers (dhis2-devs-core)
For more details, see:
https://code.launchpad.net/~sis-ma/dhis2/SISMA-362/+merge/187168
--
https://code.launchpad.net/~sis-ma/dhis2/SISMA-362/+merge/187168
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2013-09-11 15:26:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2013-09-24 08:49:40 +0000
@@ -85,6 +85,8 @@
public static final String VALUE_TYPE_INT = "int";
public static final String VALUE_TYPE_NUMBER = "number";
public static final String VALUE_TYPE_USER_NAME = "username";
+
+ public static final String VALUE_TYPE_ZERO_OR_POSITIVE_INT = "zeroPositiveInt";
public static final String VALUE_TYPE_POSITIVE_INT = "positiveNumber";
public static final String VALUE_TYPE_NEGATIVE_INT = "negativeNumber";
public static final String VALUE_TYPE_TRUE_ONLY = "trueOnly";
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/DefaultInputValidationService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/DefaultInputValidationService.java 2013-09-23 07:28:36 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/DefaultInputValidationService.java 2013-09-24 08:49:40 +0000
@@ -178,6 +178,13 @@
return new Status( false, value + " is not a valid negative integer." );
}
}
+ else if ( dataElement.getNumberType().equals( DataElement.VALUE_TYPE_ZERO_OR_POSITIVE_INT) )
+ {
+ if ( !MathUtils.isPositiveOrZeroInteger( value ) )
+ {
+ return new Status( false, value + " is not a valid zero or positive integer." );
+ }
+ }
}
return new Status();
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataValueConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataValueConverter.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataValueConverter.java 2013-09-24 08:49:40 +0000
@@ -326,7 +326,8 @@
else if ( dataElementType.equals( DataElement.VALUE_TYPE_NUMBER )
|| dataElementType.equals( DataElement.VALUE_TYPE_INT )
|| dataElementType.equals( DataElement.VALUE_TYPE_NEGATIVE_INT )
- || dataElementType.equals( DataElement.VALUE_TYPE_POSITIVE_INT ) )
+ || dataElementType.equals( DataElement.VALUE_TYPE_POSITIVE_INT )
+ || dataElementType.equals( DataElement.VALUE_TYPE_ZERO_OR_POSITIVE_INT) )
{
out.write( SEPARATOR_B );
out.write( SEPARATOR_B );
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/MathUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/MathUtils.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/MathUtils.java 2013-09-24 08:49:40 +0000
@@ -54,6 +54,7 @@
private static final Pattern NUMERIC_LENIENT_PATTERN = Pattern.compile( NUMERIC_LENIENT_REGEXP );
private static final Pattern INT_PATTERN = Pattern.compile( "^(0|-?[1-9]\\d*)$" );
private static final Pattern POSITIVE_INT_PATTERN = Pattern.compile( "^[1-9]\\d*$" );
+ private static final Pattern POSITIVE_OR_ZERO_INT_PATTERN = Pattern.compile( "(^0$)|(^[1-9]\\d*$)" );
private static final Pattern NEGATIVE_INT_PATTERN = Pattern.compile( "^-[1-9]\\d*$" );
private static final Pattern ZERO_PATTERN = Pattern.compile( "^0(\\.0*)?$" );
@@ -280,6 +281,21 @@
{
return value != null && POSITIVE_INT_PATTERN.matcher( value ).matches();
}
+
+
+ /**
+ * Returns true if the provided string argument is to be considered a positive
+ * or zero integer.
+ *
+ * @param value the value.
+ * @return true if the provided string argument is to be considered a positive
+ * integer.
+ */
+ public static boolean isPositiveOrZeroInteger( String value )
+ {
+ return value != null && POSITIVE_OR_ZERO_INT_PATTERN.matcher( value ).matches();
+ }
+
/**
* Returns true if the provided string argument is to be considered a negative
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java 2013-09-24 08:49:40 +0000
@@ -243,7 +243,8 @@
return "data_element_or_type_null_or_empty";
}
- List<String> types = Arrays.asList( VALUE_TYPE_STRING, VALUE_TYPE_INT, VALUE_TYPE_NUMBER, VALUE_TYPE_POSITIVE_INT, VALUE_TYPE_NEGATIVE_INT );
+ List<String> types = Arrays.asList( VALUE_TYPE_STRING, VALUE_TYPE_INT, VALUE_TYPE_NUMBER, VALUE_TYPE_POSITIVE_INT, VALUE_TYPE_NEGATIVE_INT,
+ VALUE_TYPE_ZERO_OR_POSITIVE_INT);
String type = dataElement.getDetailedNumberType();
@@ -271,6 +272,11 @@
{
return "value_not_negative_integer";
}
+
+ if ( VALUE_TYPE_ZERO_OR_POSITIVE_INT.equals( type ) && !MathUtils.isPositiveOrZeroInteger( value ) )
+ {
+ return "value_not_zero_or_positive_integer";
+ }
if ( VALUE_TYPE_INT.equals( dataElement.getType() ) && MathUtils.isZero( value ) &&
!dataElement.isZeroIsSignificant() && !AGGREGATION_OPERATOR_AVERAGE.equals( dataElement.getAggregationOperator() ) )
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/MathUtilsTest.java'
--- dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/MathUtilsTest.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/MathUtilsTest.java 2013-09-24 08:49:40 +0000
@@ -224,6 +224,25 @@
assertFalse( MathUtils.isNegativeInteger( "2 " ) );
assertFalse( MathUtils.isNegativeInteger( "6.1345" ) );
}
+
+
+ @Test
+ public void testIsZeroOrPositiveInteger()
+ {
+ assertTrue( MathUtils.isPositiveInteger( "0" ) );
+ assertTrue( MathUtils.isPositiveInteger( "123" ) );
+
+ assertFalse( MathUtils.isPositiveInteger( "012" ) );
+ assertFalse( MathUtils.isPositiveInteger( "+20" ) );
+ assertFalse( MathUtils.isPositiveInteger( "-2" ) );
+ assertFalse( MathUtils.isPositiveInteger( "-2232" ) );
+ assertFalse( MathUtils.isPositiveInteger( "-2.17" ) );
+ assertFalse( MathUtils.isPositiveInteger( "1.1" ) );
+ assertFalse( MathUtils.isPositiveInteger( "-0" ) );
+ assertFalse( MathUtils.isPositiveInteger( "Hey" ) );
+ assertFalse( MathUtils.isPositiveInteger( "1 " ) );
+ assertFalse( MathUtils.isPositiveInteger( "1.2345" ) );
+ }
@Test
public void testIsZero()
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ValidationUtilsTest.java'
--- dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ValidationUtilsTest.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ValidationUtilsTest.java 2013-09-24 08:49:40 +0000
@@ -130,6 +130,12 @@
assertNull( dataValueIsValid( "3", de ) );
assertNotNull( dataValueIsValid( "-4", de ) );
+
+ de.setNumberType( DataElement.VALUE_TYPE_ZERO_OR_POSITIVE_INT );
+
+ assertNull( dataValueIsValid( "3", de ) );
+ assertNotNull( dataValueIsValid( "-4", de ) );
+
de.setNumberType( DataElement.VALUE_TYPE_NEGATIVE_INT );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/FormUtils.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/FormUtils.java 2013-09-05 13:09:59 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/FormUtils.java 2013-09-24 08:49:40 +0000
@@ -253,6 +253,10 @@
{
return InputType.INTEGER_POSITIVE;
}
+ else if ( DataElement.VALUE_TYPE_ZERO_OR_POSITIVE_INT.equals( dataElement.getNumberType() ) )
+ {
+ return InputType.INTEGER_ZERO_OR_POSITIVE;
+ }
else if ( DataElement.VALUE_TYPE_NEGATIVE_INT.equals( dataElement.getNumberType() ) )
{
return InputType.INTEGER_NEGATIVE;
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/InputType.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/InputType.java 2013-08-23 16:00:30 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/InputType.java 2013-09-24 08:49:40 +0000
@@ -42,5 +42,6 @@
INTEGER,
INTEGER_POSITIVE,
INTEGER_NEGATIVE,
+ INTEGER_ZERO_OR_POSITIVE,
NEGATIVE_INTEGER
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2013-09-23 07:25:48 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2013-09-24 08:49:40 +0000
@@ -69,6 +69,7 @@
to=To
value_must_number=Value must be an number
value_must_positive_integer=Value must be a positive integer
+value_must_zero_or_positive_integer=Value must be a positive integer or zero.
value_must_negative_integer=Value must be a negative integer
days=days
please_select=Please select
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm 2013-08-06 07:12:39 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm 2013-09-24 08:49:40 +0000
@@ -150,6 +150,7 @@
var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n "
+ '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '"
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm 2013-07-16 04:04:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm 2013-09-24 08:49:40 +0000
@@ -184,6 +184,7 @@
var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n "
+ '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '"
+ dateFormat.replace('yy', 'yyyy') + " '" ;
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2013-09-24 04:30:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2013-09-24 08:49:40 +0000
@@ -2747,7 +2747,7 @@
{
return 'float';
}
- if( type == 'int' || type == 'positiveNumber' || type == 'negativeNumber' )
+ if( type == 'int' || type == 'positiveNumber' || type == 'negativeNumber' || type == 'zeroPositiveInt' )
{
return 'numeric';
}
@@ -2767,7 +2767,7 @@
{
return 'datefield';
}
- if( type == 'number' || type == 'int' || type == 'positiveNumber' || type == 'negativeNumber' )
+ if( type == 'number' || type == 'int' || type == 'positiveNumber' || type == 'negativeNumber' || type == 'zeroPositiveInt' )
{
return 'numberfield';
}
=== 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-09-19 03:16:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js 2013-09-24 08:49:40 +0000
@@ -31,7 +31,7 @@
field.style.backgroundColor = SAVING_COLOR;
if ( fieldValue != '' ) {
- if ( type == 'int' || type == 'number' || type == 'positiveNumber' || type == 'negativeNumber' ) {
+ if ( type == 'int' || type == 'number' || type == 'positiveNumber' || type == 'negativeNumber' || type == 'zeroPositiveInt') {
if ( type == 'int' && !isInt( fieldValue ) ) {
field.style.backgroundColor = '#ffcc00';
@@ -62,6 +62,13 @@
return;
}
+ else if ( type == 'zeroPositiveInt' && !isZeroOrPositiveInt( fieldValue ) ) {
+ field.style.backgroundColor = '#ffcc00';
+ window.alert( i18n_value_must_zero_or_positive_integer + '\n\n' + dataElementName );
+ field.focus();
+
+ return;
+ }
}
else if ( type == 'date' ) {
field.focus();
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm 2013-05-28 07:32:37 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm 2013-09-24 08:49:40 +0000
@@ -54,6 +54,7 @@
var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")';
var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm 2013-09-23 03:15:40 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm 2013-09-24 08:49:40 +0000
@@ -209,6 +209,7 @@
var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n " + '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '" + dateFormat.replace('yy', 'yyyy') + " '" ;
var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm 2013-06-12 03:54:02 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm 2013-09-24 08:49:40 +0000
@@ -140,6 +140,7 @@
var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n "
+ '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '"
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipPatients.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipPatients.vm 2013-09-23 03:15:40 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipPatients.vm 2013-09-24 08:49:40 +0000
@@ -81,6 +81,7 @@
var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n " + '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '" + dateFormat.replace('yy', 'yyyy') + " '" ;
var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
var i18n_saving_value_failed_error_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_error_code" ) , "'")';
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm 2013-09-23 03:15:40 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm 2013-09-24 08:49:40 +0000
@@ -80,6 +80,7 @@
var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n "
+ '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '"
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm 2013-09-11 16:02:06 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm 2013-09-24 08:49:40 +0000
@@ -72,6 +72,7 @@
var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n "
+ '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '"
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleDataEntryForm.vm 2013-09-06 09:06:36 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleDataEntryForm.vm 2013-09-24 08:49:40 +0000
@@ -91,6 +91,8 @@
#set($validate="positive_integer:true")
#elseif( $type=='negativeNumber' )
#set($validate="negative_integer:true")
+ #elseif( $type=='zeroPositiveInt' )
+ #set($validate="zeroPositiveInt:true")
#elseif( $type=='int' )
#set($validate="integer:true")
#end
@@ -194,6 +196,8 @@
#set($validate="positive_integer:true")
#elseif( $type=='negativeNumber' )
#set($validate="negative_integer:true")
+ #elseif( $type=='zeroPositiveInt' )
+ #set($validate="zeroPositiveInt:true")
#elseif( $type=='int' )
#set($validate="integer:true")
#end
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm 2013-05-28 03:10:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm 2013-09-24 08:49:40 +0000
@@ -111,6 +111,7 @@
var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n "
var i18n_reenrollment_confirm_message = '$encoder.jsEscape( $i18n.getString( "reenrollment_confirm_message" ) , "'")';
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2013-09-05 09:24:48 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2013-09-24 08:49:40 +0000
@@ -1671,6 +1671,16 @@
}
/**
+ * Allow only zero or positive integers, no thousands seperators
+ */
+function isZeroOrPositiveInt( value )
+{
+ var regex = /(^0$)|(^[1-9]\d*$)/;
+ return regex.test( value );
+}
+
+
+/**
* Allow only negative integers, not Zero and no thousands seperators
*/
function isNegativeInt( value )
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.ext.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.ext.js 2013-04-26 14:46:03 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.ext.js 2013-09-24 08:49:40 +0000
@@ -432,6 +432,10 @@
return this.optional(element) || isNegativeInt(value);
});
+jQuery.validator.addMethod("zero_positive_int", function(value, element, param) {
+ return this.optional(element) || isZeroOrPositiveInt(value);
+});
+
// Support method for date
//Parse a string and convert it to a Date object.
//If string cannot be parsed, return null.
=== 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 2013-07-08 09:46:51 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties 2013-09-24 08:49:40 +0000
@@ -63,6 +63,7 @@
value_must_number=Value must be an number
value_must_positive_integer=Value must be an positive integer
value_must_negative_integer=Value must be an negative integer
+value_must_zero_or_positive_integer=Value must be zero or positive integer
value_is_too_long=Value is too long
field_unallowed_save_zero=This element does not permit 0 values. The original value will not be affected.
datavalue_history=Data value history
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js 2013-08-16 11:10:51 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js 2013-09-24 08:49:40 +0000
@@ -138,7 +138,7 @@
if ( value != '' )
{
- if ( type == 'string' || type == 'int' || type == 'number' || type == 'positiveNumber' || type == 'negativeNumber' )
+ if ( type == 'string' || type == 'int' || type == 'number' || type == 'positiveNumber' || type == 'negativeNumber' || type == 'zeroPositiveInt' )
{
if ( value.length > 255 )
{
@@ -160,6 +160,10 @@
{
return alertField( fieldId, i18n_value_must_negative_integer + ': ' + dataElementName );
}
+ if ( type == 'zeroPositiveInt' && !isZeroOrPositiveInt( value ) )
+ {
+ return alertField( fieldId, i18n_value_must_zero_or_positive_integer + ': ' + dataElementName );
+ }
if ( isValidZeroNumber( value ) )
{
// If value = 0 and zero not significant for data element, skip
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm 2013-07-18 10:10:22 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm 2013-09-24 08:49:40 +0000
@@ -10,6 +10,7 @@
var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
+var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
var i18n_field_unallowed_save_zero = '$encoder.jsEscape( $i18n.getString( "field_unallowed_save_zero" ) , "'")';
var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties 2013-09-05 13:09:59 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties 2013-09-24 08:49:40 +0000
@@ -338,4 +338,5 @@
value_not_positive_integer=Value is not a valid positive integer
value_not_negative_integer=Value is not a valid negative integer
value_is_zero_and_not_zero_significant=Value is zero and not zero-significant
+value_not_zero_or_positive_integer=Value is not a valid zero or positive integer
comment_too_long=Comment is too long
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java 2013-09-24 08:49:40 +0000
@@ -382,6 +382,16 @@
"\"" + value + "\"" + " " + i18n.getString( "is_invalid_negative_integer" ) );
}
}
+ else if ( type.equals( DataElement.VALUE_TYPE_INT)
+ && numberType.equals( DataElement.VALUE_TYPE_ZERO_OR_POSITIVE_INT ) )
+ {
+ if ( !FormUtils.isZeroOrPositiveInteger( value ) )
+ {
+ correctType = false;
+ typeViolations.put( key,
+ "\"" + value + "\"" + " " + i18n.getString( "is_invalid_zero_or_positive_integer" ) );
+ }
+ }
}
// nothing entered
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/FormUtils.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/FormUtils.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/FormUtils.java 2013-09-24 08:49:40 +0000
@@ -331,6 +331,11 @@
{
return valueHigher( value, 0 );
}
+
+ public static boolean isZeroOrPositiveInteger( String value )
+ {
+ return valueHigherOrEqual( value, 0 );
+ }
public static boolean isNegativeInteger( String value )
{
@@ -356,6 +361,26 @@
return false;
}
+
+ public static boolean valueHigherOrEqual( String value, int max )
+ {
+ int integerValue;
+
+ try
+ {
+ integerValue = Integer.parseInt( value );
+
+ if ( integerValue >= max )
+ {
+ return true;
+ }
+ }
+ catch ( NumberFormatException ignored )
+ {
+ }
+
+ return false;
+ }
public static boolean valueLower( String value, int min )
{
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/NamebasedUtils.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/NamebasedUtils.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/NamebasedUtils.java 2013-09-24 08:49:40 +0000
@@ -138,6 +138,13 @@
return "is_invalid_negative_integer";
}
}
+ else if ( type.equals( DataElement.VALUE_TYPE_INT ) && numberType.equals( DataElement.VALUE_TYPE_ZERO_OR_POSITIVE_INT ) )
+ {
+ if ( !FormUtils.isZeroOrPositiveInteger( value ) )
+ {
+ return "is_invalid_zero_or_positive_integer";
+ }
+ }
return null;
}
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties 2013-04-15 09:36:45 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties 2013-09-24 08:49:40 +0000
@@ -28,6 +28,7 @@
is_invalid_number=is not a valid number
is_invalid_integer=is not a valid integer
is_invalid_positive_integer=is not a valid positive integer
+is_invalid_zero_or_positive_integer=is not a valid zero or positive integer
is_invalid_negative_integer=is not a valid negative integer
is_invalid_name=is not a valid name
is_invalid_name_length=needs to be 7 or more characters
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntrySection.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntrySection.vm 2013-08-08 12:00:17 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntrySection.vm 2013-09-24 08:49:40 +0000
@@ -84,6 +84,8 @@
<input type="text" maxlength="255" size="24" name="$key" value="$!dataValues.get($key)" />
#elseif( $dataElement.type == "int" && $dataElement.numberType == "negativeNumber" )
<input type="text" maxlength="255" size="24" name="$key" value="$!dataValues.get($key)" />
+ #elseif( $dataElement.type == "int" && $dataElement.numberType == "zeroPositiveInt" )
+ <input type="text" maxlength="255" size="24" name="$key" value="$!dataValues.get($key)" />
#elseif($dataElement.type=="trueOnly")
<input name="$key" type="checkbox" #if($!dataValues.get($key) == "on" ) checked #end/>
#end
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties 2013-08-09 10:02:06 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties 2013-09-24 08:49:40 +0000
@@ -183,6 +183,7 @@
number_value_type=Number type
int=Integer
positiveNumber=Positive Integer
+zeroPositiveInt=Positive or Zero Integer
negativeNumber=Negative Integer
view_1=View 1
view_2=View 2
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementForm.vm 2013-07-17 16:50:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementForm.vm 2013-09-24 08:49:40 +0000
@@ -125,6 +125,7 @@
<option value="int" #if( $!dataElement.numberType == 'int' ) selected="selected" #end>$i18n.getString( "int" )</option>
<option value="positiveNumber" #if( $!dataElement.numberType == 'positiveNumber' ) selected="selected" #end>$i18n.getString( "positiveNumber" )</option>
<option value="negativeNumber" #if( $!dataElement.numberType == 'negativeNumber' ) selected="selected" #end>$i18n.getString( "negativeNumber" )</option>
+ <option value="zeroPositiveInt" #if( $!dataElement.numberType == 'zeroPositiveInt' ) selected="selected" #end>$i18n.getString( "zeroPositiveInt" )</option>
</select>
<script>
</script>
=== modified file 'dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/data-entry.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/data-entry.vm 2013-08-21 12:10:58 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/data-entry.vm 2013-09-24 08:49:40 +0000
@@ -346,6 +346,8 @@
<input type="number" id='<%= fieldId %>' name='<%= fieldId %>' data-dataElement='<%= field.dataElement %>' data-categoryOptionCombo='<%= field.categoryOptionCombo %>' maxlength="255" value="<%= value %>" />
<% } else if( field.type == 'INTEGER_NEGATIVE' ) { %>
<input type="number" id='<%= fieldId %>' name='<%= fieldId %>' data-dataElement='<%= field.dataElement %>' data-categoryOptionCombo='<%= field.categoryOptionCombo %>' maxlength="255" value="<%= value %>" />
+ <% } else if( field.type == 'INTEGER_ZERO_OR_POSITIVE' ) { %>
+ <input type="number" id='<%= fieldId %>' name='<%= fieldId %>' data-dataElement='<%= field.dataElement %>' data-categoryOptionCombo='<%= field.categoryOptionCombo %>' maxlength="255" value="<%= value %>" />
<% } else if( field.type == 'NUMBER' ) { %>
<input type="number" id='<%= fieldId %>' name='<%= fieldId %>' data-dataElement='<%= field.dataElement %>' data-categoryOptionCombo='<%= field.categoryOptionCombo %>' maxlength="255" value="<%= value %>" />
<% } %>
=== modified file 'dhis-2/dhis-web/dhis-web-sms/src/main/webapp/dhis-web-sms/dataEntrySection.vm'
--- dhis-2/dhis-web/dhis-web-sms/src/main/webapp/dhis-web-sms/dataEntrySection.vm 2013-02-03 10:13:17 +0000
+++ dhis-2/dhis-web/dhis-web-sms/src/main/webapp/dhis-web-sms/dataEntrySection.vm 2013-09-24 08:49:40 +0000
@@ -91,6 +91,8 @@
<input type="text" maxlength="255" size="24" name="$key" value="$!dataValues.get($key)" />
#elseif( $dataElement.type == "int" && $dataElement.numberType == "positiveNumber" )
<input type="text" maxlength="255" size="24" name="$key" value="$!dataValues.get($key)" />
+ #elseif( $dataElement.type == "int" && $dataElement.numberType == "zeroPositiveInt" )
+ <input type="text" maxlength="255" size="24" name="$key" value="$!dataValues.get($key)" />
#elseif( $dataElement.type == "int" && $dataElement.numberType == "negativeNumber" )
<input type="text" maxlength="255" size="24" name="$key" value="$!dataValues.get($key)" />
#end
=== modified file 'dhis-2/dhis-web/dhis-web-sms/src/main/webapp/dhis-web-sms/patientRegistrationList.vm'
--- dhis-2/dhis-web/dhis-web-sms/src/main/webapp/dhis-web-sms/patientRegistrationList.vm 2013-09-12 08:40:07 +0000
+++ dhis-2/dhis-web/dhis-web-sms/src/main/webapp/dhis-web-sms/patientRegistrationList.vm 2013-09-24 08:49:40 +0000
@@ -151,6 +151,7 @@
var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n " + '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '" + dateFormat.replace('yy', 'yyyy') + " '" ;
var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentList_1.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentList_1.vm 2013-09-05 11:11:36 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentList_1.vm 2013-09-24 08:49:40 +0000
@@ -110,6 +110,7 @@
var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n " + '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '" + dateFormat.replace('yy', 'yyyy') + " '" ;
var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
var i18n_saving_value_failed_error_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_error_code" ) , "'")';
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/loadFacilityDataEntryForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/loadFacilityDataEntryForm.vm 2013-08-13 12:40:46 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/loadFacilityDataEntryForm.vm 2013-09-24 08:49:40 +0000
@@ -12,6 +12,10 @@
#elseif( $type == "negativeNumber" )
{validate:{ negative_integer:true #if($require), required:true #end }}
+
+ #elseif( $type == "zeroPositiveInt" )
+ {validate:{ zero_positive_int:true #if($require), required:true #end }}
+
#elseif( $require )
@@ -62,7 +66,7 @@
#else
<!--<input type="text" id="dataelement$dataElement.id" name="dataelement$dataElement.id" value="$!dataValue" tabindex="$tabIndex" width="25%" class="{validate:{required: #if($dataElement.type =='int') number:true #end }}"/>-->
- <input type="text" id="dataelement$dataElement.id" name="dataelement$dataElement.id" value="$!dataValue" tabindex="$tabIndex" width="25%" #if($dataElement.type =='number') class="{validate:{number:true}}" #elseif($dataElement.type =='int') class="{validate:{integer:true}}" #elseif($dataElement.type =='positiveNumber') class="{validate:{positive_integer:true}}" #elseif($dataElement.type =='negativeNumber') class="{validate:{negative_integer:true}}" #end/>
+ <input type="text" id="dataelement$dataElement.id" name="dataelement$dataElement.id" value="$!dataValue" tabindex="$tabIndex" width="25%" #if($dataElement.type =='number') class="{validate:{number:true}}" #elseif($dataElement.type =='int') class="{validate:{integer:true}}" #elseif($dataElement.type =='positiveNumber') class="{validate:{positive_integer:true}}" #elseif($dataElement.type =='negativeNumber') class="{validate:{negative_integer:true}}" #elseif($dataElement.type =='zeroPositiveInt') class="{validate:{zero_positive_int:true}}" #end/>
<!--<input type="text" id="attr$attribute.id" name="attr$attribute.id" class="{validate:{required: #if($dataElement.type=='int'),number:true #end }}" />-->
#end
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/selectEquipment.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/selectEquipment.vm 2013-09-05 11:11:36 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/selectEquipment.vm 2013-09-24 08:49:40 +0000
@@ -122,6 +122,7 @@
var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n "
+ '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '"
+ dateFormat.replace('yy', 'yyyy') + " '" ;
=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/equipmentList.vm'
--- local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/equipmentList.vm 2013-09-05 11:11:36 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/equipmentList.vm 2013-09-24 08:49:40 +0000
@@ -110,6 +110,7 @@
var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n " + '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '" + dateFormat.replace('yy', 'yyyy') + " '" ;
var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
var i18n_saving_value_failed_error_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_error_code" ) , "'")';
=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/selectEquipment.vm'
--- local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/selectEquipment.vm 2013-09-05 11:11:36 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/selectEquipment.vm 2013-09-24 08:49:40 +0000
@@ -122,6 +122,7 @@
var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n "
+ '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '"
+ dateFormat.replace('yy', 'yyyy') + " '" ;
=== modified file 'local/tz/dhis-web-hrentry/src/main/webapp/dhis-web-hrentry/javascript/dataEntry.js'
--- local/tz/dhis-web-hrentry/src/main/webapp/dhis-web-hrentry/javascript/dataEntry.js 2011-07-05 07:41:01 +0000
+++ local/tz/dhis-web-hrentry/src/main/webapp/dhis-web-hrentry/javascript/dataEntry.js 2013-09-24 08:49:40 +0000
@@ -522,7 +522,7 @@
if( field.value != '' )
{
- if ( type == 'int' || type == 'number' || type == 'positiveNumber' || type == 'negativeNumber' )
+ if ( type == 'int' || type == 'number' || type == 'positiveNumber' || type == 'negativeNumber' || type == 'zeroPositiveInt')
{
if ( type == 'int' && !isInt( field.value ))
{
@@ -562,6 +562,15 @@
return;
}
+ else if ( type == 'zeroPositiveInt' && !isZeroOrPositiveInt( field.value ))
+ {
+ field.style.backgroundColor = '#ffcc00';
+ window.alert( i18n_value_must_zero_or_positive_integer + '\n\n' + dataElementName );
+ field.select();
+ field.focus();
+
+ return;
+ }
}
}
=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/javascript/entry.js'
--- local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/javascript/entry.js 2012-05-23 09:36:45 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/javascript/entry.js 2013-09-24 08:49:40 +0000
@@ -130,7 +130,7 @@
if ( value != '' )
{
- if ( type == 'int' || type == 'number' || type == 'positiveNumber' || type == 'negativeNumber' )
+ if ( type == 'int' || type == 'number' || type == 'positiveNumber' || type == 'negativeNumber' || type == 'zeroPositiveInt' )
{
if ( value.length > 255 )
{
@@ -152,6 +152,10 @@
{
return alertField( fieldId, i18n_value_must_negative_integer + ': ' + dataElementName );
}
+ if ( type == 'zeroPositiveInt' && !isZeroOrPositiveInt( value ) )
+ {
+ return alertField( fieldId, i18n_value_must_zero_or_positive_integer + ': ' + dataElementName );
+ }
if ( isValidZeroNumber( value ) )
{
// If value = 0 and zero not significant for data element, skip
=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/select.vm'
--- local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/select.vm 2012-09-06 11:47:37 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/select.vm 2013-09-24 08:49:40 +0000
@@ -129,6 +129,7 @@
var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
+var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
var i18n_field_unallowed_save_zero = '$encoder.jsEscape( $i18n.getString( "field_unallowed_save_zero" ) , "'")';
var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
var i18n_saving_value_failed_dataset_is_locked = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_dataset_is_locked" ) , "'")';
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/dataentry/entry.js'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/dataentry/entry.js 2013-01-08 10:03:19 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/dataentry/entry.js 2013-09-24 08:49:40 +0000
@@ -143,7 +143,7 @@
if ( value != '' )
{
- if ( type == 'string' || type == 'int' || type == 'number' || type == 'positiveNumber' || type == 'negativeNumber' )
+ if ( type == 'string' || type == 'int' || type == 'number' || type == 'positiveNumber' || type == 'negativeNumber' || type == 'zeroPositiveInt' )
{
if ( value.length > 255 )
{
@@ -165,6 +165,10 @@
{
return alertField( fieldId, i18n_value_must_negative_integer + ': ' + dataElementName );
}
+ if ( type == 'zeroPositiveInt' && !isZeroOrPositiveInt( value ) )
+ {
+ return alertField( fieldId, i18n_value_must_zero_or_positive_integer + ': ' + dataElementName );
+ }
if ( isValidZeroNumber( value ) )
{
// If value = 0 and zero not significant for data element, skip
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/dataentry/select.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/dataentry/select.vm 2013-01-08 10:03:19 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/dataentry/select.vm 2013-09-24 08:49:40 +0000
@@ -11,6 +11,7 @@
var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
+var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
var i18n_field_unallowed_save_zero = '$encoder.jsEscape( $i18n.getString( "field_unallowed_save_zero" ) , "'")';
var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
var i18n_saving_value_failed_dataset_is_locked = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_dataset_is_locked" ) , "'")';
Follow ups