ofbiz-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacques Le Roux (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (OFBIZ-5261) Party contact expiration and its hidden problems
Date Sat, 13 Dec 2014 10:22:13 GMT

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

Jacques Le Roux edited comment on OFBIZ-5261 at 12/13/14 10:21 AM:

Another commit has been done in trunk: r1626463

r1626462 has been backported in R13.07 at r1626469 (r1626463 not needed)

I will backport to R12.04 despite conflicts, they are not hard to resolve

Then I will apply OFBIZ-5869

was (Author: jacques.le.roux):
This was only committed in trunk and another commit has been done: r1626463

> Party contact expiration and its hidden problems
> ------------------------------------------------
>                 Key: OFBIZ-5261
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5261
>             Project: OFBiz
>          Issue Type: Bug
>          Components: accounting, order, party
>    Affects Versions: Release 09.04, Release 09.04.01, Release 10.04, Release Branch 11.04,
>            Reporter: Sergei Biletnikov
>            Assignee: Ashish Vijaywargiya
>             Fix For: Release Branch 11.04, Upcoming Branch
>         Attachments: OFBIZ-5261.patch
> I found a problem which can appear when you add new contact like postal address and expiry
old one, the old contact is still used by some code.
> The cause of the problem is easy and clear. 
> To make it more clear, let me remind you that OFBiz has a smart contacts data model,
where each contact represents the contact data like address, phone number and etc and contact
purposes, which is responsible for the how to apply the contact.
> Regarding parties, the main entities here:
> PartyContactMech   (contact)
> and
> PartyContactMechPurpose   (purpose)
> All looks good.
> However, both PartyContactMech and PartyContactMechPurpose have from and thru date creterias,i.e.
can be expired!
> If you add a purpose to the contanct and after that you remove it, the purpose will be
expired (not deleted), that is ok for auditing.
> RE: PartyContactMech, if you expire the contact,it means this contact mechanism must
be out from the game and not be visisble on the profile page. The state of its purposes do
not matter anymore, it must be not used.
> But there is a problem here, some code takes into account  PartyContactMechPurpose and
use date filter but ignores PartyContactMech expiration state. This follows to the error:
the contact is expired, the purposes not, but the contact is still used!!!
> Example:
> \applications\order\webapp\ordermgr\WEB-INF\actions\order\CompanyHeader.groovy
> addresses = delegator.findByAnd("PartyContactMechPurpose", [partyId : partyId, contactMechPurposeTypeId
> selAddresses = EntityUtil.filterByDate(addresses, nowTimestamp, "fromDate", "thruDate",
> ........
> phones = delegator.findByAnd("PartyContactMechPurpose", [partyId : partyId, contactMechPurposeTypeId
> ...........
> only PartyContactMechPurpose  ??? and it ignores that PartyContactMech is already expired!
The result : I see the expired contact on the order page.
> \applications\accounting\src\org\ofbiz\accounting\payment\PaymentMethodServices.java
> try {
>                 List<GenericValue> allPCMPs = EntityUtil.filterByDate(delegator.findByAnd("PartyContactMechPurpose",
>                         UtilMisc.toMap("partyId", partyId, "contactMechId", contactMechId,
"contactMechPurposeTypeId", contactMechPurposeTypeId), null), true);
>                 tempVal = EntityUtil.getFirst(allPCMPs);
>             } catch (GenericEntityException e) {
>                 Debug.logWarning(e.getMessage(), module);
>                 tempVal = null;
>             }
> .....
> and again, we are interested only in PartyContactMechPurpose. The potential problem is
> I did not check the all code of OFBiz, it is just my fast search attempts.
> How to solve the problem???
> In my opinion, the data model looks ok, and it is ok when PartyContactMech is expired,
but its purposes are not. It does not break a sense and good for auditing.
> The good solution is to correct code and rely on both parties to find the necessary contact/purpose,
for example the PartyContactWithPurpose can be used with contactFromDate, contactThruDate,
purposeFromDate, purposeThruDate accordingly. However, I do not know how is big the effort
to do that in the existing code.
> The fast and easy solution is expiring all purposes for the expired contact mechanisms,
in this case we can rely only on PartyContactMechPurpose.

This message was sent by Atlassian JIRA

View raw message