Merge lp:~sis-ma/dhis2/SISMA-362 into lp:dhis2

Proposed by Leandro Soares
Status: Merged
Merged at revision: 12483
Proposed branch: lp:~sis-ma/dhis2/SISMA-362
Merge into: lp:dhis2
Diff against target: 899 lines (+201/-10)
56 files modified
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java (+2/-0)
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/DefaultInputValidationService.java (+7/-0)
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataValueConverter.java (+2/-1)
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/MathUtils.java (+16/-0)
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java (+7/-1)
dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/MathUtilsTest.java (+19/-0)
dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ValidationUtilsTest.java (+6/-0)
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/FormUtils.java (+4/-0)
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/InputType.java (+1/-0)
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties (+1/-0)
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module_pt.properties (+1/-0)
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module_pt_BR.properties (+1/-0)
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm (+1/-0)
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm (+1/-0)
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js (+2/-2)
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js (+8/-1)
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm (+1/-0)
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm (+1/-0)
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm (+1/-0)
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipPatients.vm (+1/-0)
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm (+1/-0)
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm (+1/-0)
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleDataEntryForm.vm (+4/-0)
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm (+1/-0)
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js (+10/-0)
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.ext.js (+4/-0)
dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties (+1/-0)
dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module_pt.properties (+1/-0)
dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module_pt_BR.properties (+1/-0)
dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js (+5/-1)
dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm (+1/-0)
dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties (+1/-0)
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java (+10/-0)
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/FormUtils.java (+25/-0)
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/NamebasedUtils.java (+7/-0)
dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties (+1/-0)
dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module_pt.properties (+1/-0)
dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module_pt_BR.properties (+1/-0)
dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntrySection.vm (+2/-0)
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties (+1/-0)
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module_pt.properties (+1/-0)
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module_pt_BR.properties (+1/-0)
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementForm.vm (+1/-0)
dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/data-entry.vm (+2/-0)
dhis-2/dhis-web/dhis-web-sms/src/main/webapp/dhis-web-sms/dataEntrySection.vm (+2/-0)
dhis-2/dhis-web/dhis-web-sms/src/main/webapp/dhis-web-sms/patientRegistrationList.vm (+1/-0)
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentList_1.vm (+1/-0)
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/loadFacilityDataEntryForm.vm (+5/-1)
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/selectEquipment.vm (+1/-0)
local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/equipmentList.vm (+1/-0)
local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/selectEquipment.vm (+1/-0)
local/tz/dhis-web-hrentry/src/main/webapp/dhis-web-hrentry/javascript/dataEntry.js (+10/-1)
local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/javascript/entry.js (+5/-1)
local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/select.vm (+1/-0)
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/dataentry/entry.js (+5/-1)
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/dataentry/select.vm (+1/-0)
To merge this branch: bzr merge lp:~sis-ma/dhis2/SISMA-362
Reviewer Review Type Date Requested Status
DHIS 2 core developers Pending
Review via email: mp+187168@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java'
2--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2013-09-11 15:26:20 +0000
3+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2013-09-30 13:51:54 +0000
4@@ -85,6 +85,8 @@
5 public static final String VALUE_TYPE_INT = "int";
6 public static final String VALUE_TYPE_NUMBER = "number";
7 public static final String VALUE_TYPE_USER_NAME = "username";
8+
9+ public static final String VALUE_TYPE_ZERO_OR_POSITIVE_INT = "zeroPositiveInt";
10 public static final String VALUE_TYPE_POSITIVE_INT = "positiveNumber";
11 public static final String VALUE_TYPE_NEGATIVE_INT = "negativeNumber";
12 public static final String VALUE_TYPE_TRUE_ONLY = "trueOnly";
13
14=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/DefaultInputValidationService.java'
15--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/DefaultInputValidationService.java 2013-09-23 07:28:36 +0000
16+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/DefaultInputValidationService.java 2013-09-30 13:51:54 +0000
17@@ -178,6 +178,13 @@
18 return new Status( false, value + " is not a valid negative integer." );
19 }
20 }
21+ else if ( dataElement.getNumberType().equals( DataElement.VALUE_TYPE_ZERO_OR_POSITIVE_INT) )
22+ {
23+ if ( !MathUtils.isPositiveOrZeroInteger( value ) )
24+ {
25+ return new Status( false, value + " is not a valid zero or positive integer." );
26+ }
27+ }
28 }
29
30 return new Status();
31
32=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataValueConverter.java'
33--- 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
34+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/xml/converter/DataValueConverter.java 2013-09-30 13:51:54 +0000
35@@ -326,7 +326,8 @@
36 else if ( dataElementType.equals( DataElement.VALUE_TYPE_NUMBER )
37 || dataElementType.equals( DataElement.VALUE_TYPE_INT )
38 || dataElementType.equals( DataElement.VALUE_TYPE_NEGATIVE_INT )
39- || dataElementType.equals( DataElement.VALUE_TYPE_POSITIVE_INT ) )
40+ || dataElementType.equals( DataElement.VALUE_TYPE_POSITIVE_INT )
41+ || dataElementType.equals( DataElement.VALUE_TYPE_ZERO_OR_POSITIVE_INT) )
42 {
43 out.write( SEPARATOR_B );
44 out.write( SEPARATOR_B );
45
46=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/MathUtils.java'
47--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/MathUtils.java 2013-08-23 16:05:01 +0000
48+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/MathUtils.java 2013-09-30 13:51:54 +0000
49@@ -54,6 +54,7 @@
50 private static final Pattern NUMERIC_LENIENT_PATTERN = Pattern.compile( NUMERIC_LENIENT_REGEXP );
51 private static final Pattern INT_PATTERN = Pattern.compile( "^(0|-?[1-9]\\d*)$" );
52 private static final Pattern POSITIVE_INT_PATTERN = Pattern.compile( "^[1-9]\\d*$" );
53+ private static final Pattern POSITIVE_OR_ZERO_INT_PATTERN = Pattern.compile( "(^0$)|(^[1-9]\\d*$)" );
54 private static final Pattern NEGATIVE_INT_PATTERN = Pattern.compile( "^-[1-9]\\d*$" );
55 private static final Pattern ZERO_PATTERN = Pattern.compile( "^0(\\.0*)?$" );
56
57@@ -280,6 +281,21 @@
58 {
59 return value != null && POSITIVE_INT_PATTERN.matcher( value ).matches();
60 }
61+
62+
63+ /**
64+ * Returns true if the provided string argument is to be considered a positive
65+ * or zero integer.
66+ *
67+ * @param value the value.
68+ * @return true if the provided string argument is to be considered a positive
69+ * integer.
70+ */
71+ public static boolean isPositiveOrZeroInteger( String value )
72+ {
73+ return value != null && POSITIVE_OR_ZERO_INT_PATTERN.matcher( value ).matches();
74+ }
75+
76
77 /**
78 * Returns true if the provided string argument is to be considered a negative
79
80=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java'
81--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java 2013-08-23 16:05:01 +0000
82+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java 2013-09-30 13:51:54 +0000
83@@ -243,7 +243,8 @@
84 return "data_element_or_type_null_or_empty";
85 }
86
87- List<String> types = Arrays.asList( VALUE_TYPE_STRING, VALUE_TYPE_INT, VALUE_TYPE_NUMBER, VALUE_TYPE_POSITIVE_INT, VALUE_TYPE_NEGATIVE_INT );
88+ List<String> types = Arrays.asList( VALUE_TYPE_STRING, VALUE_TYPE_INT, VALUE_TYPE_NUMBER, VALUE_TYPE_POSITIVE_INT, VALUE_TYPE_NEGATIVE_INT,
89+ VALUE_TYPE_ZERO_OR_POSITIVE_INT);
90
91 String type = dataElement.getDetailedNumberType();
92
93@@ -271,6 +272,11 @@
94 {
95 return "value_not_negative_integer";
96 }
97+
98+ if ( VALUE_TYPE_ZERO_OR_POSITIVE_INT.equals( type ) && !MathUtils.isPositiveOrZeroInteger( value ) )
99+ {
100+ return "value_not_zero_or_positive_integer";
101+ }
102
103 if ( VALUE_TYPE_INT.equals( dataElement.getType() ) && MathUtils.isZero( value ) &&
104 !dataElement.isZeroIsSignificant() && !AGGREGATION_OPERATOR_AVERAGE.equals( dataElement.getAggregationOperator() ) )
105
106=== modified file 'dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/MathUtilsTest.java'
107--- dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/MathUtilsTest.java 2013-08-23 16:05:01 +0000
108+++ dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/MathUtilsTest.java 2013-09-30 13:51:54 +0000
109@@ -224,6 +224,25 @@
110 assertFalse( MathUtils.isNegativeInteger( "2 " ) );
111 assertFalse( MathUtils.isNegativeInteger( "6.1345" ) );
112 }
113+
114+
115+ @Test
116+ public void testIsZeroOrPositiveInteger()
117+ {
118+ assertTrue( MathUtils.isPositiveInteger( "0" ) );
119+ assertTrue( MathUtils.isPositiveInteger( "123" ) );
120+
121+ assertFalse( MathUtils.isPositiveInteger( "012" ) );
122+ assertFalse( MathUtils.isPositiveInteger( "+20" ) );
123+ assertFalse( MathUtils.isPositiveInteger( "-2" ) );
124+ assertFalse( MathUtils.isPositiveInteger( "-2232" ) );
125+ assertFalse( MathUtils.isPositiveInteger( "-2.17" ) );
126+ assertFalse( MathUtils.isPositiveInteger( "1.1" ) );
127+ assertFalse( MathUtils.isPositiveInteger( "-0" ) );
128+ assertFalse( MathUtils.isPositiveInteger( "Hey" ) );
129+ assertFalse( MathUtils.isPositiveInteger( "1 " ) );
130+ assertFalse( MathUtils.isPositiveInteger( "1.2345" ) );
131+ }
132
133 @Test
134 public void testIsZero()
135
136=== modified file 'dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ValidationUtilsTest.java'
137--- dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ValidationUtilsTest.java 2013-08-23 16:05:01 +0000
138+++ dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ValidationUtilsTest.java 2013-09-30 13:51:54 +0000
139@@ -130,6 +130,12 @@
140
141 assertNull( dataValueIsValid( "3", de ) );
142 assertNotNull( dataValueIsValid( "-4", de ) );
143+
144+ de.setNumberType( DataElement.VALUE_TYPE_ZERO_OR_POSITIVE_INT );
145+
146+ assertNull( dataValueIsValid( "3", de ) );
147+ assertNotNull( dataValueIsValid( "-4", de ) );
148+
149
150 de.setNumberType( DataElement.VALUE_TYPE_NEGATIVE_INT );
151
152
153=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/FormUtils.java'
154--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/FormUtils.java 2013-09-05 13:09:59 +0000
155+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/FormUtils.java 2013-09-30 13:51:54 +0000
156@@ -253,6 +253,10 @@
157 {
158 return InputType.INTEGER_POSITIVE;
159 }
160+ else if ( DataElement.VALUE_TYPE_ZERO_OR_POSITIVE_INT.equals( dataElement.getNumberType() ) )
161+ {
162+ return InputType.INTEGER_ZERO_OR_POSITIVE;
163+ }
164 else if ( DataElement.VALUE_TYPE_NEGATIVE_INT.equals( dataElement.getNumberType() ) )
165 {
166 return InputType.INTEGER_NEGATIVE;
167
168=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/InputType.java'
169--- 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
170+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/form/InputType.java 2013-09-30 13:51:54 +0000
171@@ -42,5 +42,6 @@
172 INTEGER,
173 INTEGER_POSITIVE,
174 INTEGER_NEGATIVE,
175+ INTEGER_ZERO_OR_POSITIVE,
176 NEGATIVE_INTEGER
177 }
178
179=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties'
180--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2013-09-23 07:25:48 +0000
181+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2013-09-30 13:51:54 +0000
182@@ -69,6 +69,7 @@
183 to=To
184 value_must_number=Value must be an number
185 value_must_positive_integer=Value must be a positive integer
186+value_must_zero_or_positive_integer=Value must be a positive integer or zero.
187 value_must_negative_integer=Value must be a negative integer
188 days=days
189 please_select=Please select
190
191=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module_pt.properties'
192--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module_pt.properties 2013-08-19 08:12:56 +0000
193+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module_pt.properties 2013-09-30 13:51:54 +0000
194@@ -481,6 +481,7 @@
195 right_value=Valor correcto
196 specfiy_birth_date_or_age=Especifique a data de nascimento ou a idade
197 value_must_positive_integer=Valor deve ser um inteiro positivo
198+value_must_zero_or_positive_integer=Valor deve ser um inteiro positivo ou zero
199 longitude=Longitude
200 selected_orgunit_no_have_any_child=Unidade de organizacional selecionado n\u00E3o t\u00EAm qualquer filho
201 report_unit=Unidade de relat\u00F3rio
202
203=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module_pt_BR.properties'
204--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module_pt_BR.properties 2013-05-01 12:55:57 +0000
205+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module_pt_BR.properties 2013-09-30 13:51:54 +0000
206@@ -481,6 +481,7 @@
207 right_value=Valor correcto
208 specfiy_birth_date_or_age=Especifique a data de nascimento ou a idade
209 value_must_positive_integer=Valor deve ser um inteiro positivo
210+value_must_zero_or_positive_integer=Valor deve ser um inteiro positivo ou zero
211 longitude=Longitude
212 selected_orgunit_no_have_any_child=Unidade de organizacional selecionado n\u00E3o t\u00EAm qualquer filho
213 report_unit=Unidade de relat\u00F3rio
214
215=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm'
216--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm 2013-08-06 07:12:39 +0000
217+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm 2013-09-30 13:51:54 +0000
218@@ -150,6 +150,7 @@
219 var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
220 var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
221 var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
222+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
223 var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
224 var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n "
225 + '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '"
226
227=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm'
228--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm 2013-07-16 04:04:23 +0000
229+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm 2013-09-30 13:51:54 +0000
230@@ -184,6 +184,7 @@
231 var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
232 var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
233 var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
234+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
235 var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n "
236 + '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '"
237 + dateFormat.replace('yy', 'yyyy') + " '" ;
238
239=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js'
240--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2013-09-30 12:50:31 +0000
241+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2013-09-30 13:51:54 +0000
242@@ -2707,7 +2707,7 @@
243 {
244 return 'float';
245 }
246- if( type == 'int' || type == 'positiveNumber' || type == 'negativeNumber' )
247+ if( type == 'int' || type == 'positiveNumber' || type == 'negativeNumber' || type == 'zeroPositiveInt' )
248 {
249 return 'numeric';
250 }
251@@ -2727,7 +2727,7 @@
252 {
253 return 'datefield';
254 }
255- if( type == 'number' || type == 'int' || type == 'positiveNumber' || type == 'negativeNumber' )
256+ if( type == 'number' || type == 'int' || type == 'positiveNumber' || type == 'negativeNumber' || type == 'zeroPositiveInt' )
257 {
258 return 'numberfield';
259 }
260
261=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js'
262--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js 2013-09-19 03:16:23 +0000
263+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js 2013-09-30 13:51:54 +0000
264@@ -31,7 +31,7 @@
265 field.style.backgroundColor = SAVING_COLOR;
266
267 if ( fieldValue != '' ) {
268- if ( type == 'int' || type == 'number' || type == 'positiveNumber' || type == 'negativeNumber' ) {
269+ if ( type == 'int' || type == 'number' || type == 'positiveNumber' || type == 'negativeNumber' || type == 'zeroPositiveInt') {
270 if ( type == 'int' && !isInt( fieldValue ) ) {
271 field.style.backgroundColor = '#ffcc00';
272
273@@ -62,6 +62,13 @@
274
275 return;
276 }
277+ else if ( type == 'zeroPositiveInt' && !isZeroOrPositiveInt( fieldValue ) ) {
278+ field.style.backgroundColor = '#ffcc00';
279+ window.alert( i18n_value_must_zero_or_positive_integer + '\n\n' + dataElementName );
280+ field.focus();
281+
282+ return;
283+ }
284 }
285 else if ( type == 'date' ) {
286 field.focus();
287
288=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm'
289--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm 2013-05-28 07:32:37 +0000
290+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm 2013-09-30 13:51:54 +0000
291@@ -54,6 +54,7 @@
292 var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
293 var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
294 var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
295+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
296 var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
297 var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")';
298 var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
299
300=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm'
301--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm 2013-09-23 03:15:40 +0000
302+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm 2013-09-30 13:51:54 +0000
303@@ -209,6 +209,7 @@
304 var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
305 var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
306 var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
307+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
308 var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
309 var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n " + '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '" + dateFormat.replace('yy', 'yyyy') + " '" ;
310 var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
311
312=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm'
313--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm 2013-06-12 03:54:02 +0000
314+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm 2013-09-30 13:51:54 +0000
315@@ -140,6 +140,7 @@
316 var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
317 var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
318 var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
319+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
320 var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
321 var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n "
322 + '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '"
323
324=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipPatients.vm'
325--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipPatients.vm 2013-09-23 03:15:40 +0000
326+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipPatients.vm 2013-09-30 13:51:54 +0000
327@@ -81,6 +81,7 @@
328 var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
329 var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
330 var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
331+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
332 var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n " + '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '" + dateFormat.replace('yy', 'yyyy') + " '" ;
333 var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
334 var i18n_saving_value_failed_error_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_error_code" ) , "'")';
335
336=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm'
337--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm 2013-09-23 03:15:40 +0000
338+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm 2013-09-30 13:51:54 +0000
339@@ -80,6 +80,7 @@
340 var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
341 var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
342 var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
343+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
344 var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
345 var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n "
346 + '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '"
347
348=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm'
349--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm 2013-09-11 16:02:06 +0000
350+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm 2013-09-30 13:51:54 +0000
351@@ -72,6 +72,7 @@
352 var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
353 var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
354 var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
355+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
356 var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
357 var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n "
358 + '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '"
359
360=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleDataEntryForm.vm'
361--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleDataEntryForm.vm 2013-09-06 09:06:36 +0000
362+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleDataEntryForm.vm 2013-09-30 13:51:54 +0000
363@@ -91,6 +91,8 @@
364 #set($validate="positive_integer:true")
365 #elseif( $type=='negativeNumber' )
366 #set($validate="negative_integer:true")
367+ #elseif( $type=='zeroPositiveInt' )
368+ #set($validate="zeroPositiveInt:true")
369 #elseif( $type=='int' )
370 #set($validate="integer:true")
371 #end
372@@ -194,6 +196,8 @@
373 #set($validate="positive_integer:true")
374 #elseif( $type=='negativeNumber' )
375 #set($validate="negative_integer:true")
376+ #elseif( $type=='zeroPositiveInt' )
377+ #set($validate="zeroPositiveInt:true")
378 #elseif( $type=='int' )
379 #set($validate="integer:true")
380 #end
381
382=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm'
383--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm 2013-05-28 03:10:26 +0000
384+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm 2013-09-30 13:51:54 +0000
385@@ -111,6 +111,7 @@
386 var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
387 var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
388 var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
389+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
390 var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
391 var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n "
392 var i18n_reenrollment_confirm_message = '$encoder.jsEscape( $i18n.getString( "reenrollment_confirm_message" ) , "'")';
393
394=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js'
395--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2013-09-05 09:24:48 +0000
396+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2013-09-30 13:51:54 +0000
397@@ -1671,6 +1671,16 @@
398 }
399
400 /**
401+ * Allow only zero or positive integers, no thousands seperators
402+ */
403+function isZeroOrPositiveInt( value )
404+{
405+ var regex = /(^0$)|(^[1-9]\d*$)/;
406+ return regex.test( value );
407+}
408+
409+
410+/**
411 * Allow only negative integers, not Zero and no thousands seperators
412 */
413 function isNegativeInt( value )
414
415=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.ext.js'
416--- 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
417+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.ext.js 2013-09-30 13:51:54 +0000
418@@ -432,6 +432,10 @@
419 return this.optional(element) || isNegativeInt(value);
420 });
421
422+jQuery.validator.addMethod("zero_positive_int", function(value, element, param) {
423+ return this.optional(element) || isZeroOrPositiveInt(value);
424+});
425+
426 // Support method for date
427 //Parse a string and convert it to a Date object.
428 //If string cannot be parsed, return null.
429
430=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties'
431--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties 2013-07-08 09:46:51 +0000
432+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties 2013-09-30 13:51:54 +0000
433@@ -63,6 +63,7 @@
434 value_must_number=Value must be an number
435 value_must_positive_integer=Value must be an positive integer
436 value_must_negative_integer=Value must be an negative integer
437+value_must_zero_or_positive_integer=Value must be zero or positive integer
438 value_is_too_long=Value is too long
439 field_unallowed_save_zero=This element does not permit 0 values. The original value will not be affected.
440 datavalue_history=Data value history
441
442=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module_pt.properties'
443--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module_pt.properties 2013-07-02 15:58:13 +0000
444+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module_pt.properties 2013-09-30 13:51:54 +0000
445@@ -74,6 +74,7 @@
446 see_details=Veja detalhes
447 at=em
448 value_must_positive_integer=Valor deve ser um numero positivo inteiro
449+value_must_zero_or_positive_integer=Valor deve ser um inteiro positivo ou zero
450 timestamp=Tempo
451 select_from_tree=Seleccione a partir da \u00E1rvore do lado esquerdo
452 incomplete=Incompleto
453
454=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module_pt_BR.properties'
455--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module_pt_BR.properties 2013-05-01 12:55:57 +0000
456+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module_pt_BR.properties 2013-09-30 13:51:54 +0000
457@@ -74,6 +74,7 @@
458 see_details=Veja detalhes
459 at=em
460 value_must_positive_integer=Valor deve ser um numero positivo inteiro
461+value_must_zero_or_positive_integer=Valor deve ser um inteiro positivo ou zero
462 timestamp=Tempo
463 select_from_tree=Seleccione a partir da \u00E1rvore do lado esquerdo
464 incomplete=Incompleto
465
466=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js'
467--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js 2013-08-16 11:10:51 +0000
468+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js 2013-09-30 13:51:54 +0000
469@@ -138,7 +138,7 @@
470
471 if ( value != '' )
472 {
473- if ( type == 'string' || type == 'int' || type == 'number' || type == 'positiveNumber' || type == 'negativeNumber' )
474+ if ( type == 'string' || type == 'int' || type == 'number' || type == 'positiveNumber' || type == 'negativeNumber' || type == 'zeroPositiveInt' )
475 {
476 if ( value.length > 255 )
477 {
478@@ -160,6 +160,10 @@
479 {
480 return alertField( fieldId, i18n_value_must_negative_integer + ': ' + dataElementName );
481 }
482+ if ( type == 'zeroPositiveInt' && !isZeroOrPositiveInt( value ) )
483+ {
484+ return alertField( fieldId, i18n_value_must_zero_or_positive_integer + ': ' + dataElementName );
485+ }
486 if ( isValidZeroNumber( value ) )
487 {
488 // If value = 0 and zero not significant for data element, skip
489
490=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm'
491--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm 2013-07-18 10:10:22 +0000
492+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm 2013-09-30 13:51:54 +0000
493@@ -10,6 +10,7 @@
494 var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
495 var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
496 var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
497+var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
498 var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
499 var i18n_field_unallowed_save_zero = '$encoder.jsEscape( $i18n.getString( "field_unallowed_save_zero" ) , "'")';
500 var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
501
502=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties'
503--- dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties 2013-09-26 14:59:56 +0000
504+++ dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties 2013-09-30 13:51:54 +0000
505@@ -339,4 +339,5 @@
506 value_not_positive_integer=Value is not a valid positive integer
507 value_not_negative_integer=Value is not a valid negative integer
508 value_is_zero_and_not_zero_significant=Value is zero and not zero-significant
509+value_not_zero_or_positive_integer=Value is not a valid zero or positive integer
510 comment_too_long=Comment is too long
511\ No newline at end of file
512
513=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java'
514--- 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
515+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java 2013-09-30 13:51:54 +0000
516@@ -382,6 +382,16 @@
517 "\"" + value + "\"" + " " + i18n.getString( "is_invalid_negative_integer" ) );
518 }
519 }
520+ else if ( type.equals( DataElement.VALUE_TYPE_INT)
521+ && numberType.equals( DataElement.VALUE_TYPE_ZERO_OR_POSITIVE_INT ) )
522+ {
523+ if ( !FormUtils.isZeroOrPositiveInteger( value ) )
524+ {
525+ correctType = false;
526+ typeViolations.put( key,
527+ "\"" + value + "\"" + " " + i18n.getString( "is_invalid_zero_or_positive_integer" ) );
528+ }
529+ }
530 }
531
532 // nothing entered
533
534=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/FormUtils.java'
535--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/FormUtils.java 2013-08-23 16:05:01 +0000
536+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/FormUtils.java 2013-09-30 13:51:54 +0000
537@@ -331,6 +331,11 @@
538 {
539 return valueHigher( value, 0 );
540 }
541+
542+ public static boolean isZeroOrPositiveInteger( String value )
543+ {
544+ return valueHigherOrEqual( value, 0 );
545+ }
546
547 public static boolean isNegativeInteger( String value )
548 {
549@@ -356,6 +361,26 @@
550
551 return false;
552 }
553+
554+ public static boolean valueHigherOrEqual( String value, int max )
555+ {
556+ int integerValue;
557+
558+ try
559+ {
560+ integerValue = Integer.parseInt( value );
561+
562+ if ( integerValue >= max )
563+ {
564+ return true;
565+ }
566+ }
567+ catch ( NumberFormatException ignored )
568+ {
569+ }
570+
571+ return false;
572+ }
573
574 public static boolean valueLower( String value, int min )
575 {
576
577=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/NamebasedUtils.java'
578--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/NamebasedUtils.java 2013-08-23 16:05:01 +0000
579+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/NamebasedUtils.java 2013-09-30 13:51:54 +0000
580@@ -138,6 +138,13 @@
581 return "is_invalid_negative_integer";
582 }
583 }
584+ else if ( type.equals( DataElement.VALUE_TYPE_INT ) && numberType.equals( DataElement.VALUE_TYPE_ZERO_OR_POSITIVE_INT ) )
585+ {
586+ if ( !FormUtils.isZeroOrPositiveInteger( value ) )
587+ {
588+ return "is_invalid_zero_or_positive_integer";
589+ }
590+ }
591 return null;
592 }
593
594
595=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties'
596--- dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties 2013-04-15 09:36:45 +0000
597+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties 2013-09-30 13:51:54 +0000
598@@ -28,6 +28,7 @@
599 is_invalid_number=is not a valid number
600 is_invalid_integer=is not a valid integer
601 is_invalid_positive_integer=is not a valid positive integer
602+is_invalid_zero_or_positive_integer=is not a valid zero or positive integer
603 is_invalid_negative_integer=is not a valid negative integer
604 is_invalid_name=is not a valid name
605 is_invalid_name_length=needs to be 7 or more characters
606
607=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module_pt.properties'
608--- dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module_pt.properties 2013-07-02 15:58:13 +0000
609+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module_pt.properties 2013-09-30 13:51:54 +0000
610@@ -91,6 +91,7 @@
611 search_user=Pesquisar utilizador por nome
612 full_name=Nome Completo
613 is_invalid_positive_integer=n\u00E3o \u00E9 um inteiro positivo v\u00E1lido
614+is_invalid_zero_or_positive_integer=n\u00E3o \u00E9 um inteiro positivo v\u00E1lido ou zero
615 change=Alterar
616 beneficiary_enrollment=Inscri
617 enrolled_programs=Programas inscritos
618
619=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module_pt_BR.properties'
620--- dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module_pt_BR.properties 2013-05-01 12:55:57 +0000
621+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module_pt_BR.properties 2013-09-30 13:51:54 +0000
622@@ -91,6 +91,7 @@
623 search_user=Pesquisar utilizador por nome
624 full_name=Nome Completo
625 is_invalid_positive_integer=n\u00E3o \u00E9 um inteiro positivo v\u00E1lido
626+is_invalid_zero_or_positive_integer=n\u00E3o \u00E9 um inteiro positivo v\u00E1lido ou zero
627 change=Alterar
628 beneficiary_enrollment=Inscri
629 enrolled_programs=Programas inscritos
630
631=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntrySection.vm'
632--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntrySection.vm 2013-08-08 12:00:17 +0000
633+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntrySection.vm 2013-09-30 13:51:54 +0000
634@@ -84,6 +84,8 @@
635 <input type="text" maxlength="255" size="24" name="$key" value="$!dataValues.get($key)" />
636 #elseif( $dataElement.type == "int" && $dataElement.numberType == "negativeNumber" )
637 <input type="text" maxlength="255" size="24" name="$key" value="$!dataValues.get($key)" />
638+ #elseif( $dataElement.type == "int" && $dataElement.numberType == "zeroPositiveInt" )
639+ <input type="text" maxlength="255" size="24" name="$key" value="$!dataValues.get($key)" />
640 #elseif($dataElement.type=="trueOnly")
641 <input name="$key" type="checkbox" #if($!dataValues.get($key) == "on" ) checked #end/>
642 #end
643
644=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties'
645--- 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
646+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties 2013-09-30 13:51:54 +0000
647@@ -183,6 +183,7 @@
648 number_value_type=Number type
649 int=Integer
650 positiveNumber=Positive Integer
651+zeroPositiveInt=Positive or Zero Integer
652 negativeNumber=Negative Integer
653 view_1=View 1
654 view_2=View 2
655
656=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module_pt.properties'
657--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module_pt.properties 2013-07-02 15:58:13 +0000
658+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module_pt.properties 2013-09-30 13:51:54 +0000
659@@ -203,5 +203,6 @@
660 intro_data_element=Criar, modificar, exibir e excluir elementos de dados. Elementos de dados s\u00E3o fen\u00F4menos para os quais ser\u00E3o capturados e analisados.
661 data_element=Elemento de Dados
662 positiveNumber=Inteiro posetivo
663+zeroPositiveInt=Inteiro posetivo ou zero
664 available_aggregation_levels=N\u00EDveis de agrega\u00E7\u00E3o dispon\u00EDvel
665 indicator_group_set=Conjunto de grupo de indicador
666
667=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module_pt_BR.properties'
668--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module_pt_BR.properties 2013-05-01 12:55:57 +0000
669+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module_pt_BR.properties 2013-09-30 13:51:54 +0000
670@@ -203,5 +203,6 @@
671 intro_data_element=Criar, modificar, exibir e excluir elementos de dados. Elementos de dados s\u00E3o fen\u00F4menos para os quais ser\u00E3o capturados e analisados.
672 data_element=Elemento de Dados
673 positiveNumber=Inteiro posetivo
674+zeroPositiveInt=Inteiro posetivo ou zero
675 available_aggregation_levels=N\u00EDveis de agrega\u00E7\u00E3o dispon\u00EDvel
676 indicator_group_set=Conjunto de grupo de indicador
677
678=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementForm.vm'
679--- 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
680+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementForm.vm 2013-09-30 13:51:54 +0000
681@@ -125,6 +125,7 @@
682 <option value="int" #if( $!dataElement.numberType == 'int' ) selected="selected" #end>$i18n.getString( "int" )</option>
683 <option value="positiveNumber" #if( $!dataElement.numberType == 'positiveNumber' ) selected="selected" #end>$i18n.getString( "positiveNumber" )</option>
684 <option value="negativeNumber" #if( $!dataElement.numberType == 'negativeNumber' ) selected="selected" #end>$i18n.getString( "negativeNumber" )</option>
685+ <option value="zeroPositiveInt" #if( $!dataElement.numberType == 'zeroPositiveInt' ) selected="selected" #end>$i18n.getString( "zeroPositiveInt" )</option>
686 </select>
687 <script>
688 </script>
689
690=== modified file 'dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/data-entry.vm'
691--- 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
692+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/data-entry.vm 2013-09-30 13:51:54 +0000
693@@ -346,6 +346,8 @@
694 <input type="number" id='<%= fieldId %>' name='<%= fieldId %>' data-dataElement='<%= field.dataElement %>' data-categoryOptionCombo='<%= field.categoryOptionCombo %>' maxlength="255" value="<%= value %>" />
695 <% } else if( field.type == 'INTEGER_NEGATIVE' ) { %>
696 <input type="number" id='<%= fieldId %>' name='<%= fieldId %>' data-dataElement='<%= field.dataElement %>' data-categoryOptionCombo='<%= field.categoryOptionCombo %>' maxlength="255" value="<%= value %>" />
697+ <% } else if( field.type == 'INTEGER_ZERO_OR_POSITIVE' ) { %>
698+ <input type="number" id='<%= fieldId %>' name='<%= fieldId %>' data-dataElement='<%= field.dataElement %>' data-categoryOptionCombo='<%= field.categoryOptionCombo %>' maxlength="255" value="<%= value %>" />
699 <% } else if( field.type == 'NUMBER' ) { %>
700 <input type="number" id='<%= fieldId %>' name='<%= fieldId %>' data-dataElement='<%= field.dataElement %>' data-categoryOptionCombo='<%= field.categoryOptionCombo %>' maxlength="255" value="<%= value %>" />
701 <% } %>
702
703=== modified file 'dhis-2/dhis-web/dhis-web-sms/src/main/webapp/dhis-web-sms/dataEntrySection.vm'
704--- dhis-2/dhis-web/dhis-web-sms/src/main/webapp/dhis-web-sms/dataEntrySection.vm 2013-02-03 10:13:17 +0000
705+++ dhis-2/dhis-web/dhis-web-sms/src/main/webapp/dhis-web-sms/dataEntrySection.vm 2013-09-30 13:51:54 +0000
706@@ -91,6 +91,8 @@
707 <input type="text" maxlength="255" size="24" name="$key" value="$!dataValues.get($key)" />
708 #elseif( $dataElement.type == "int" && $dataElement.numberType == "positiveNumber" )
709 <input type="text" maxlength="255" size="24" name="$key" value="$!dataValues.get($key)" />
710+ #elseif( $dataElement.type == "int" && $dataElement.numberType == "zeroPositiveInt" )
711+ <input type="text" maxlength="255" size="24" name="$key" value="$!dataValues.get($key)" />
712 #elseif( $dataElement.type == "int" && $dataElement.numberType == "negativeNumber" )
713 <input type="text" maxlength="255" size="24" name="$key" value="$!dataValues.get($key)" />
714 #end
715
716=== modified file 'dhis-2/dhis-web/dhis-web-sms/src/main/webapp/dhis-web-sms/patientRegistrationList.vm'
717--- dhis-2/dhis-web/dhis-web-sms/src/main/webapp/dhis-web-sms/patientRegistrationList.vm 2013-09-12 08:40:07 +0000
718+++ dhis-2/dhis-web/dhis-web-sms/src/main/webapp/dhis-web-sms/patientRegistrationList.vm 2013-09-30 13:51:54 +0000
719@@ -151,6 +151,7 @@
720 var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
721 var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
722 var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
723+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
724 var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
725 var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n " + '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '" + dateFormat.replace('yy', 'yyyy') + " '" ;
726 var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
727
728=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentList_1.vm'
729--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentList_1.vm 2013-09-05 11:11:36 +0000
730+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentList_1.vm 2013-09-30 13:51:54 +0000
731@@ -110,6 +110,7 @@
732 var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
733 var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
734 var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
735+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
736 var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n " + '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '" + dateFormat.replace('yy', 'yyyy') + " '" ;
737 var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
738 var i18n_saving_value_failed_error_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_error_code" ) , "'")';
739
740=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/loadFacilityDataEntryForm.vm'
741--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/loadFacilityDataEntryForm.vm 2013-08-13 12:40:46 +0000
742+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/loadFacilityDataEntryForm.vm 2013-09-30 13:51:54 +0000
743@@ -12,6 +12,10 @@
744
745 #elseif( $type == "negativeNumber" )
746 {validate:{ negative_integer:true #if($require), required:true #end }}
747+
748+ #elseif( $type == "zeroPositiveInt" )
749+ {validate:{ zero_positive_int:true #if($require), required:true #end }}
750+
751
752
753 #elseif( $require )
754@@ -62,7 +66,7 @@
755
756 #else
757 <!--<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 }}"/>-->
758- <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/>
759+ <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/>
760 <!--<input type="text" id="attr$attribute.id" name="attr$attribute.id" class="{validate:{required: #if($dataElement.type=='int'),number:true #end }}" />-->
761
762 #end
763
764=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/selectEquipment.vm'
765--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/selectEquipment.vm 2013-09-05 11:11:36 +0000
766+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/selectEquipment.vm 2013-09-30 13:51:54 +0000
767@@ -122,6 +122,7 @@
768 var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
769 var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
770 var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
771+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
772 var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n "
773 + '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '"
774 + dateFormat.replace('yy', 'yyyy') + " '" ;
775
776=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/equipmentList.vm'
777--- local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/equipmentList.vm 2013-09-05 11:11:36 +0000
778+++ local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/equipmentList.vm 2013-09-30 13:51:54 +0000
779@@ -110,6 +110,7 @@
780 var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
781 var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
782 var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
783+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
784 var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n " + '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '" + dateFormat.replace('yy', 'yyyy') + " '" ;
785 var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
786 var i18n_saving_value_failed_error_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_error_code" ) , "'")';
787
788=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/selectEquipment.vm'
789--- local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/selectEquipment.vm 2013-09-05 11:11:36 +0000
790+++ local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/selectEquipment.vm 2013-09-30 13:51:54 +0000
791@@ -122,6 +122,7 @@
792 var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
793 var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
794 var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
795+ var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
796 var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n "
797 + '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '"
798 + dateFormat.replace('yy', 'yyyy') + " '" ;
799
800=== modified file 'local/tz/dhis-web-hrentry/src/main/webapp/dhis-web-hrentry/javascript/dataEntry.js'
801--- local/tz/dhis-web-hrentry/src/main/webapp/dhis-web-hrentry/javascript/dataEntry.js 2011-07-05 07:41:01 +0000
802+++ local/tz/dhis-web-hrentry/src/main/webapp/dhis-web-hrentry/javascript/dataEntry.js 2013-09-30 13:51:54 +0000
803@@ -522,7 +522,7 @@
804
805 if( field.value != '' )
806 {
807- if ( type == 'int' || type == 'number' || type == 'positiveNumber' || type == 'negativeNumber' )
808+ if ( type == 'int' || type == 'number' || type == 'positiveNumber' || type == 'negativeNumber' || type == 'zeroPositiveInt')
809 {
810 if ( type == 'int' && !isInt( field.value ))
811 {
812@@ -562,6 +562,15 @@
813
814 return;
815 }
816+ else if ( type == 'zeroPositiveInt' && !isZeroOrPositiveInt( field.value ))
817+ {
818+ field.style.backgroundColor = '#ffcc00';
819+ window.alert( i18n_value_must_zero_or_positive_integer + '\n\n' + dataElementName );
820+ field.select();
821+ field.focus();
822+
823+ return;
824+ }
825 }
826
827 }
828
829=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/javascript/entry.js'
830--- local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/javascript/entry.js 2012-05-23 09:36:45 +0000
831+++ local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/javascript/entry.js 2013-09-30 13:51:54 +0000
832@@ -130,7 +130,7 @@
833
834 if ( value != '' )
835 {
836- if ( type == 'int' || type == 'number' || type == 'positiveNumber' || type == 'negativeNumber' )
837+ if ( type == 'int' || type == 'number' || type == 'positiveNumber' || type == 'negativeNumber' || type == 'zeroPositiveInt' )
838 {
839 if ( value.length > 255 )
840 {
841@@ -152,6 +152,10 @@
842 {
843 return alertField( fieldId, i18n_value_must_negative_integer + ': ' + dataElementName );
844 }
845+ if ( type == 'zeroPositiveInt' && !isZeroOrPositiveInt( value ) )
846+ {
847+ return alertField( fieldId, i18n_value_must_zero_or_positive_integer + ': ' + dataElementName );
848+ }
849 if ( isValidZeroNumber( value ) )
850 {
851 // If value = 0 and zero not significant for data element, skip
852
853=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/select.vm'
854--- local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/select.vm 2012-09-06 11:47:37 +0000
855+++ local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/select.vm 2013-09-30 13:51:54 +0000
856@@ -129,6 +129,7 @@
857 var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
858 var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
859 var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
860+var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
861 var i18n_field_unallowed_save_zero = '$encoder.jsEscape( $i18n.getString( "field_unallowed_save_zero" ) , "'")';
862 var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
863 var i18n_saving_value_failed_dataset_is_locked = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_dataset_is_locked" ) , "'")';
864
865=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/dataentry/entry.js'
866--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/dataentry/entry.js 2013-01-08 10:03:19 +0000
867+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/dataentry/entry.js 2013-09-30 13:51:54 +0000
868@@ -143,7 +143,7 @@
869
870 if ( value != '' )
871 {
872- if ( type == 'string' || type == 'int' || type == 'number' || type == 'positiveNumber' || type == 'negativeNumber' )
873+ if ( type == 'string' || type == 'int' || type == 'number' || type == 'positiveNumber' || type == 'negativeNumber' || type == 'zeroPositiveInt' )
874 {
875 if ( value.length > 255 )
876 {
877@@ -165,6 +165,10 @@
878 {
879 return alertField( fieldId, i18n_value_must_negative_integer + ': ' + dataElementName );
880 }
881+ if ( type == 'zeroPositiveInt' && !isZeroOrPositiveInt( value ) )
882+ {
883+ return alertField( fieldId, i18n_value_must_zero_or_positive_integer + ': ' + dataElementName );
884+ }
885 if ( isValidZeroNumber( value ) )
886 {
887 // If value = 0 and zero not significant for data element, skip
888
889=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/dataentry/select.vm'
890--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/dataentry/select.vm 2013-01-08 10:03:19 +0000
891+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/dataentry/select.vm 2013-09-30 13:51:54 +0000
892@@ -11,6 +11,7 @@
893 var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
894 var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
895 var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
896+var i18n_value_must_zero_or_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_zero_or_positive_integer" ) , "'")';
897 var i18n_field_unallowed_save_zero = '$encoder.jsEscape( $i18n.getString( "field_unallowed_save_zero" ) , "'")';
898 var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
899 var i18n_saving_value_failed_dataset_is_locked = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_dataset_is_locked" ) , "'")';