You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Mridul Pathak (Jira)" <ji...@apache.org> on 2026/10/08 07:25:00 UTC
[jira] [Updated] (OFBIZ-13659) Fix regressions in CategoryServicesScript.groovy introduced by the mini-lang conversion
[ https://issues.apache.org/jira/browse/OFBIZ-13659?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mridul Pathak updated OFBIZ-13659:
----------------------------------
Component/s: product/catalog
(was: product)
> Fix regressions in CategoryServicesScript.groovy introduced by the mini-lang conversion
> ---------------------------------------------------------------------------------------
>
> Key: OFBIZ-13659
> URL: https://issues.apache.org/jira/browse/OFBIZ-13659
> Project: OFBiz
> Issue Type: Bug
> Components: product/catalog
> Affects Versions: Upcoming Branch, 24.09.07
> Reporter: Mridul Pathak
> Assignee: Mridul Pathak
> Priority: Major
>
> Re-audit of {{CategoryServicesScript.groovy}} against the original {{CategoryServices.xml}} (conversion {{5588618e0f}}) found the following regressions. All permission guards match the mini-lang.
> *1. {{copyCategoryProductMembers}} copies nothing.* The assignment is reversed: {{parameters.productCategoryIdTo = newProductCategoryMember.productCategoryId}} instead of setting the clone's {{productCategoryId}} from {{productCategoryIdTo}}. The clones are re-stored unchanged and {{productCategoryIdTo}} is overwritten with the source id, so the recursive calls also copy onto themselves while the service returns success.
> *2. The {{validDate}} filter is ignored* in {{copyCategoryProductMembers}} and {{copyCategoryEntities}}. {{filterByDate()}} is called without the moment, so it filters on "now" instead of {{validDate}}.
> *3. {{createProductInCategory}} fails whenever a feature is chosen.* The loop {{for (Map entry : parameters.productFeatureIdByType.entrySet())}} declares each element a {{Map}} but the elements are {{Map.Entry}}, which throws {{GroovyCastException}} (the mini-lang used {{iterate-map}}). The following {{update('Product').where(parameters).set([isVirtual: 'Y'])}} also looks up by the caller's {{parameters.productId}}, which is blank when the id is auto-sequenced; it needs the local {{productId}}.
> *4. {{createProductInCategory}} skips a zero price.* {{if (parameters.defaultPrice)}} and {{if (parameters.averageCost)}} treat BigDecimal 0 as missing; the mini-lang used {{if-not-empty}}.
> *5. {{createProductCategoryLink}} discards every field the caller supplies.* It builds an empty {{ProductCategoryLink}} and sets only {{productCategoryId}}, the sequence id and {{fromDate}}; {{titleText}}, {{detailText}}, {{imageUrl}}, {{linkTypeEnumId}}, {{sequenceNum}}, {{thruDate}} etc. are lost (the mini-lang used {{set-pk-fields}} and {{set-nonpk-fields}}). A caller-supplied {{linkSeqId}} is also dropped.
> *6. {{addProductCategoryToCategories}} checks the literal string {{'parameters.categories'}}* in the single-category branch instead of {{parameters.categories}}, so a CATALOG_ROLE_CREATE user is always denied (fails closed).
> *7. {{updateProductCategory}} silently succeeds for a nonexistent category* because of {{.ifExists()}}; the mini-lang returned an error.
> *8. {{checkCategoryPermissionWithViewPurchaseAllow}} builds a wrong failMessage.* The label key {{CommmonCallingMethodPermissionError}} is misspelled, and the purchase branch passes a List to a label that uses named placeholders. Denial is unaffected.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)