[jira] [Commented] (OFBIZ-10396) All party contact mech should be deleted before creating new one

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

[jira] [Commented] (OFBIZ-10396) All party contact mech should be deleted before creating new one

Nicolas Malin (Jira)

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

Pierre Smits commented on OFBIZ-10396:
--------------------------------------

Unfortunately, the name of the service is misleading as it does not delete the party contact mech purpose record but expires it by setting the thruDate on the record. Renaming the service (and all references) would reduce confusion.

The deletePartyContactMechPurposeIfExists service invokes the deletePartyContactMechPurpose service, which sets the thruDate value.
[https://ofbiz-vm2.apache.org:8443/webtools/control/FindGeneric?entityName=PartyContactMechPurpose] shows the current demo data set (no duplicates).

The entity definition [http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/datamodel/entitydef/party-entitymodel.xml?view=markup] shows that the primary keys are:
{code:java}
<prim-key field="partyId"/>
<prim-key field="contactMechId"/>
<prim-key field="contactMechPurposeTypeId"/>
<prim-key field="fromDate"/>{code}
So it is *not* be possible to have duplicate records with an open-end life span (no thruDate set). However it is possible to have multiple records in the rdbms with everything being the same *except* the fromDate value.

If that is the case the root-cause of that needs to be investigated, as it may be so that:
 * multiple records were created without using the functions of OFBiz (e.g. direct import into the rdbms)
 * somewhere in the OFBiz code there is a missing invocation of the deletePartyContactMechPurposeIfExists, as it should *not* be possible to inject a new open-end life span record with the same parameters (partyId, contactMechId, contactMechPurposeTypeId)  as an existing one without expiring the old one.

 

 

> All party contact mech should be deleted before creating new one
> ----------------------------------------------------------------
>
>                 Key: OFBIZ-10396
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-10396
>             Project: OFBiz
>          Issue Type: Improvement
>            Reporter: Suraj Khurana
>            Assignee: Suraj Khurana
>            Priority: Major
>         Attachments: OFBIZ-10396.patch
>
>
> Currently, everywhere in code base, before creating new party contact mech record, we use 
> deletePartyContactMechPurposeIfExists service to delete old records. But, problem is 
> <first-from-list is used everywhere which only deletes first fetched record.
> All previous records should also gets deleted before creating new party contact mech purpose for a specific purpose type.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)