What is the allowDecimal field in ConceptNumeric used for?

public class ConceptNumeric extends Concept implements java.io.Serializable { private Boolean allowDecimal = false;

allowDecimal is a field in ConceptNumeric which stores a default value as false. Earlier this field was named as precision.

Going by the name allowDecimal = true/false it means that we are allowing/not-allowing a decimal value to be stored.

But then I do not see any validation for this field.

Is the field meant to do what I am understanding or is there a different purpose for this field?

Thank You!

@ysachinta108 are you looking for this? https://github.com/openmrs/openmrs-core/blob/master/api/src/main/java/org/openmrs/validator/ObsValidator.java#L173

Thanks @dkayiwa for pointing to the link.

Looking through the code, it seems that when we save Observations through ObsService, then the ObsValidator gets triggered.

But if we create an Encounter and put the Observations in the encounter. Then we save the Encounter through EncounterService, the Obs also gets saved becuase of the hibernate cascade. But the validation (ObsValidator) doesn’t get triggered in this case

Most of our observations gets saved through EncounterService and therefore this validation doesn’t get triggered. We needed this validation to get triggered also when we saved Obs directly through and encounter save

@ysachinta108 that is strange because the encounter service saves all obs one by one using the ObsService which in turn calls the ObsValidator as you can see starting from this line: https://github.com/openmrs/openmrs-core/blob/master/api/src/main/java/org/openmrs/api/impl/EncounterServiceImpl.java#L205

Do you have a unit test reproducing your problem?

@dkayiwa Looks like that piece of code was added newly. It is just present in 2.0.x and master.

Whereas the older version 1.12.x doesn’t have that piece of implementation.

After the encounter save there is just order save. The obs saving which is happening after that is newly added as in your link

We are using 1.12 of Openmrs. Therefore we are facing that issue

Can this implementation be back-ported to 1.12.x so we can get that validation?

@ysachinta108 you are correct. It was fixed with TRUNK-50 but never got back ported. I personally feel that back porting to 1.12.x is fine. What do others think? @wyclif @darius @burke It is a huge commit though! :smile:

It is up to @bharatak (as release manager for Platform 1.12) to decide whether he wants this bugfix backported to the 1.12.x branch.

Since Platform 1.12.0 has not been released yet, it’s still okay to backport new features to that branch (as long as it’s also in Platform 2.0). The issue in question is a bugfix, not a new feature, so it is technically okay to backport even in a maintenance release. Though, with the size of the change I would definitely prefer to do it in a .0 vs a .1.

So, @ysachinta108, if Bahmni wants/needs this bugfix backported, you should ask @bharatak (wearing his OpenMRS Release Manager hat) to approve that backporting.

I dont think we should go with the bugfix backported at this time when we are about to release 1.12 considering the size of the change. Spoke with @ysachinta108 and he is fine with it. So, we are not doing it in 1.12.0. If it is required, we may consider doing it in .1 as @darius suggested.