[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3903: Applied patch from Hieu. 1. Changes the data element value types to number, integer, positive int...

Thanks for this. :slight_smile:

路路路

Sent from my HTC

----- Reply message -----
From: noreply@launchpad.net
Date: Tue, Jun 14, 2011 18:17
Subject: [Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 3903: Applied patch from Hieu. 1. Changes the data element value types to number, integer, positive int鈥
To: 鈥淒HIS 2 developers鈥 dhis2-devs@lists.launchpad.net


revno: 3903
committer: Lars Helge Overland larshelge@gmail.com
branch nick: dhis2
timestamp: Tue 2011-06-14 18:13:36 +0200
message:
Applied patch from Hieu. 1. Changes the data element value types to number, integer, positive integer, negative integer. Makes the validation more robust using regex. 2. Fixes issue with deletion of orgunits. Reloading tree after an orgunit is deleted. Good work.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java
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_vi_VN.properties
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.js
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/select.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js
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_vi_VN.properties
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/select.vm
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-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnit.js


lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription

Thanks to Jason for providing in nice regex :slight_smile:

路路路

On Tue, Jun 14, 2011 at 11:39 PM, jason.p.pickering@gmail.com jason.p.pickering@gmail.com wrote:

Thanks for this. :slight_smile:

Sent from my HTC

Good heath !

Dear Lars and Hieu,

I would like to suggest a few more improvements to this commit. Please find attached a suggested patch.

One thing I am a little unsure of is how to handle the situation when the number is a zero and should be stored.

The problem is here鈥

return isNumber( value ) && parseFloat( value ) == 0;

if the value is 000.0000 parseFloat will return 0, but isNumber (with the patch) will not allow multiple leading zeros. Not too sure about this one鈥

Let me know what you think.

Best regards,

Jason

dataentry_regex.diff (3.72 KB)

路路路

On Wed, Jun 15, 2011 at 4:28 AM, Hieu Dang Duy hieu.hispvietnam@gmail.com wrote:

Thanks to Jason for providing in nice regex :slight_smile:

On Tue, Jun 14, 2011 at 11:39 PM, jason.p.pickering@gmail.com jason.p.pickering@gmail.com wrote:

Thanks for this. :slight_smile:

Sent from my HTC

Good heath !

Dear Jason,

How do you feel if we combine isNumber and isRealNumber to be one only? But with the modified regex value as below:

This is your patch : var regex = /^(0(?:.0*)?|[-]?[1-9]\d*.?[0-9]*)$/;

This is my modified : var regex = /^(0(?:.0*)?|[-]?[1-9]\d*.?[0-9].+)$/;

One more thing, perhaps, you forget to place this isValidZeroNumber to some where :wink: please review then let me know.

Thank you.

路路路

2011/6/15 Jason Pickering jason.p.pickering@gmail.com

Dear Lars and Hieu,

I would like to suggest a few more improvements to this commit. Please find attached a suggested patch.

One thing I am a little unsure of is how to handle the situation when the number is a zero and should be stored.

The problem is here鈥

return isNumber( value ) && parseFloat( value ) == 0;

if the value is 000.0000 parseFloat will return 0, but isNumber (with the patch) will not allow multiple leading zeros. Not too sure about this one鈥

Let me know what you think.

Best regards,

Jason

On Wed, Jun 15, 2011 at 4:28 AM, Hieu Dang Duy hieu.hispvietnam@gmail.com wrote:

Thanks to Jason for providing in nice regex :slight_smile:

On Tue, Jun 14, 2011 at 11:39 PM, jason.p.pickering@gmail.com jason.p.pickering@gmail.com wrote:

Thanks for this. :slight_smile:

Sent from my HTC

Good heath !


Good heath !

Hi Hieu,

I have looked a bit more into it, and I am not sure either of those will work as I want. They still need a bit of tweaking. We cannot record decimal values with this regex. :frowning:

I will need to think about it a bit more.

As for the zeros, I do not see a strong use case to allow entry of 0.0 or 0.00000 but perhaps it is not really worth the effort to try and restrict people from entering it.

Personally, I think to keep it simple, if people want to enter zero, they should enter 0, and only zero, and this should be the only valid zero. I did not utilize this function yet, but wanted some comments from others to see.

Regards,

jason

路路路

On Wed, Jun 15, 2011 at 9:30 AM, Hieu Dang Duy hieu.hispvietnam@gmail.com wrote:

Dear Jason,

How do you feel if we combine isNumber and isRealNumber to be one only? But with the modified regex value as below:

This is your patch : var regex = /^(0(?:.0*)?|[-]?[1-9]\d*.?[0-9]*)$/;

This is my modified : var regex = /^(0(?:.0*)?|[-]?[1-9]\d*.?[0-9].+)$/;

One more thing, perhaps, you forget to place this isValidZeroNumber to some where :wink: please review then let me know.

Thank you.

2011/6/15 Jason Pickering jason.p.pickering@gmail.com

Dear Lars and Hieu,

I would like to suggest a few more improvements to this commit. Please find attached a suggested patch.

One thing I am a little unsure of is how to handle the situation when the number is a zero and should be stored.

The problem is here鈥

return isNumber( value ) && parseFloat( value ) == 0;

if the value is 000.0000 parseFloat will return 0, but isNumber (with the patch) will not allow multiple leading zeros. Not too sure about this one鈥

Let me know what you think.

Best regards,

Jason

On Wed, Jun 15, 2011 at 4:28 AM, Hieu Dang Duy hieu.hispvietnam@gmail.com wrote:

Thanks to Jason for providing in nice regex :slight_smile:

On Tue, Jun 14, 2011 at 11:39 PM, jason.p.pickering@gmail.com jason.p.pickering@gmail.com wrote:

Thanks for this. :slight_smile:

Sent from my HTC

Good heath !


Good heath !