You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "karthikchundi-commits (via GitHub)" <gi...@apache.org> on 2026/08/26 10:27:30 UTC

[PR] Reject party/role combinations the party does not hold for BudgetRole (OFBIZ-12371) [ofbiz-framework]

karthikchundi-commits opened a new pull request, #1736:
URL: https://github.com/apache/ofbiz-framework/pull/1736

   ### Jira ticket
   https://issues.apache.org/jira/browse/OFBIZ-12371
   
   ### Depends on #1727
   
   **This PR depends on #1727 and should be reviewed/merged after it.** It builds directly on top of that branch, which adds the `checkPartyRoleExists` service this PR wires up for `createBudgetRole`. Without #1727, the `checkPartyRoleExists` service referenced here doesn't exist yet.
   
   ### Purpose and Description
   
   Same bug shape as OFBIZ-12370/12372/12373 (fixed in #1727), one ticket over in the same family Pierre Smits filed: `createBudgetRole` has an unconditional `ensurePartyRole` `invoke` eca that silently fabricates a `PartyRole` record for whatever `roleTypeId`/`partyId` is submitted on the Budget Role page, with no validation that the party actually holds (or should hold) that role.
   
   This wires the `checkPartyRoleExists` service added in #1727 as an `in-validate` eca on `createBudgetRole`, mirroring the exact same pattern already used there for `createInvoiceRole`/`createBillingAccountRole`/`createFinAccountRole`. Since `in-validate` runs before `invoke`, an invalid party/role combination is rejected before the existing `ensurePartyRole` eca ever fires - that eca is left untouched and becomes reachable only for combinations that are already valid.
   
   ### Changes 🏗️
   
   - `applications/accounting/servicedef/secas.xml`: adds an `in-validate` eca on `createBudgetRole` calling `checkPartyRoleExists`, right before the existing `invoke` eca.
   - `applications/accounting/src/test/groovy/org/apache/ofbiz/accounting/accounting/AutoAcctgBudgetTests.groovy`: adds a positive-case test (`DEMO_COMPANY` + `INTERNAL_ORGANIZATIO`, a role the test party already legitimately holds per `AccountingTestsData.xml`) and a negative-case test (`DEMO_COMPANY` + `CARRIER`, a role it does not hold - must now be rejected, and must not fabricate a spurious `PartyRole`), following the exact pattern used for the other three role types in #1727.
   
   ### Testing
   
   - Verified `applications/accounting/servicedef/secas.xml` against the real `service-eca.xsd` schema via `xmllint --schema` - validates cleanly.
   - Ran `gradle compileTestGroovy` (JDK 21) - compiles clean, including the new test methods.
   - This repo's pre-push hook (`checkstyleMain checkstyleTest codenarcMain codenarcTest`) ran clean on push - no violations.
   - I don't have a running OFBiz instance with a live database in this environment, so I could not execute the Groovy test suite itself end-to-end (only compile it) - same disclosed limitation as #1727.
   
   ### Checklist
   - [x] My code follows the code style of this project
   - [ ] I have updated the documentation accordingly (n/a - no user-facing docs for this internal validation)
   - [x] I have read the CONTRIBUTING document
   - [x] I have added tests to cover my changes


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ofbiz.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Reject party/role combinations the party does not hold for BudgetRole (OFBIZ-12371) [ofbiz-framework]

Posted by "karthikchundi-commits (via GitHub)" <gi...@apache.org>.
karthikchundi-commits commented on PR #1736:
URL: https://github.com/apache/ofbiz-framework/pull/1736#issuecomment-5548698385

   Following up on this one too — it depends on #1727 (which I just pinged), so flagging both together in case that's useful context for review order. Happy to make any changes needed. Thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ofbiz.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org