Incorrect usage of "Indicator" entity model field type

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Incorrect usage of "Indicator" entity model field type

Bob Morley
My believe is that the "Indicator" field type in Ofbiz is supposed to be used as a boolean (persisted as a char(1) with values Y|N).  If this is true, then I believe the following fields: fraudScore, processMode, authMode, gender, and maritalStatus are incorrectly using "Indicator" and should be changed to enumerations (ie. genderEnumId).

If my assumption is wrong, then I believe our "auto-fields" construct in Forms has a bug in it where it uses code that makes the assumption that an "Indicator" is boolean and have values of Y|N.  Here is the code ...

ModelFormField.java (line 534)
            } else if ("indicator".equals(modelField.getType())) {
                ModelFormField.DropDownField dropDownField = new ModelFormField.DropDownField(ModelFormField.FieldInfo.SOURCE_AUTO_ENTITY, this);
                dropDownField.setAllowEmpty(false);
                dropDownField.addOptionSource(new ModelFormField.SingleOption("Y", null, dropDownField));
                dropDownField.addOptionSource(new ModelFormField.SingleOption("N", null, dropDownField));
                this.setFieldInfo(dropDownField);

Any objection to starting a process to migrate the fields listed above and leveraging enumeration for them (assuming my assumption is correct) ?
Reply | Threaded
Open this post in threaded view
|

Re: Incorrect usage of "Indicator" entity model field type

Jacques Le Roux
Administrator
Hi Bob,

Not sure for fraudScore, does not seem to be any longer used anyway...

I agree for processMode, authMode (description are clear), gender and maritalStatus

Thanks

Jacques

From: "Bob Morley" <[hidden email]>

> My believe is that the "Indicator" field type in Ofbiz is supposed to be used
> as a boolean (persisted as a char(1) with values Y|N).  If this is true,
> then I believe the following fields: fraudScore, processMode, authMode,
> gender, and maritalStatus are incorrectly using "Indicator" and should be
> changed to enumerations (ie. genderEnumId).
>
> If my assumption is wrong, then I believe our "auto-fields" construct in
> Forms has a bug in it where it uses code that makes the assumption that an
> "Indicator" is boolean and have values of Y|N.  Here is the code ...
>
> ModelFormField.java (line 534)
>            } else if ("indicator".equals(modelField.getType())) {
>                ModelFormField.DropDownField dropDownField = new
> ModelFormField.DropDownField(ModelFormField.FieldInfo.SOURCE_AUTO_ENTITY,
> this);
>                dropDownField.setAllowEmpty(false);
>                dropDownField.addOptionSource(new
> ModelFormField.SingleOption("Y", null, dropDownField));
>                dropDownField.addOptionSource(new
> ModelFormField.SingleOption("N", null, dropDownField));
>                this.setFieldInfo(dropDownField);
>
> Any objection to starting a process to migrate the fields listed above and
> leveraging enumeration for them (assuming my assumption is correct) ?
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/Incorrect-usage-of-Indicator-entity-model-field-type-tp2200823p2200823.html
> Sent from the OFBiz - Dev mailing list archive at Nabble.com.
>