[jira] [Commented] (OFBIZ-5396) Add ability to set <drop-down>, <radio>, <check> form widget field key values manually

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

[jira] [Commented] (OFBIZ-5396) Add ability to set <drop-down>, <radio>, <check> form widget field key values manually

Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13825044#comment-13825044 ]

Christian Carlow commented on OFBIZ-5396:
-----------------------------------------

So I was able to provide the equivalent functionality by adding to <view-entity entity-name="CarrierAndShipmentMethod"> :

      <alias name="carrierShipmentMethod">
      <complex-alias operator="||">
      <complex-alias-field entity-alias="CS" field="shipmentMethodTypeId"/>
      <complex-alias-field value="'@'"/>
      <complex-alias-field entity-alias="CS" field="partyId"/>
      </complex-alias>
      </alias>

Then using the carrierShipmentMethod field to provide key field for the select, radio, checkbox, and lookup fields.

Form widgets should be able to be used in place of FTL at all times if desired and adding support for multi-key entities would contribute to that end.

I guess the main question is if this should be considered the solution to the problem.  One of the problems is that regular entities would have to be recreated as view-entities specifically for multi-key creation such as the OrderItem entity mentioned above.  For CarrierAndShipmentMethod, adding a concatenated primary key field was easy because it already existed as a view-entity, but depending on how often multi-key entities are used for lookups it could become inconvenient to have to recreate new view-entities for them just for a primary key concatenation.

> Add ability to set <drop-down>, <radio>, <check> form widget field key values manually
> --------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-5396
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5396
>             Project: OFBiz
>          Issue Type: New Feature
>    Affects Versions: SVN trunk
>            Reporter: Christian Carlow
>
> OFBiz should allow for the ability set <drop-down>, <radio>, and <check> form widget fields key values manually for <list-options> and <entity-options>.  Currently the key-field-name attribute of <entity-options> and <list-options> is the only way it can be set and the value must be set to the name of a single entity or list field.  
> I am trying to improve the order entry shipment settings forms and wanted to create a <drop-down> form widget field to replace the list of radio options with values ${shipmentMethodTypeId}@${partyId} on the Ship Options page of Order Entry.  The problem is that the key-field-name attribute mentioned above is insufficient for handling such a "multi-key" value.
> Adding something such as a "key-value" attribute could allow for manual assignment of the <option> value attributes.  
> Lookup fields are also weak when it comes to multi-key entities.  A while back I posted about not being able to create a lookup for order items because of the OrderId, OrderItemSeqId multi-key: OFBIZ-5356
> As work around to this problem I create a view-entity of an entity with the primary key being set to a concatenated string of the primary keys.  For example, to allow for a lookup field that provides a list of OrderItems I would create:
> <view-entity entity-name="OrderItemOnePrimKey" package-name="org.ofbiz.order.order">
>     <member-entity entity-alias="OI" entity-name="OrderItem"></member-entity>
>     <alias-all entity-alias="OI" />
>     <alias name="orderItemId" prim-key="orderItemId">
>     <complex-alias operator="||">
>        <complex-alias-field entity-alias="OI" field="orderId" />
>        <complex-alias-field value="'_pk_'"/>
>        <complex-alias-field entity-alias="OI" field="orderItemSeqId"/>
>     </complex-alias>
>     </alias>
> </view-entity>
> Having to do this for every entity with more than one key is redundant.  The keys should be able to be set manually if need be.



--
This message was sent by Atlassian JIRA
(v6.1#6144)