Author: surajk
Date: Sat Jul 14 05:35:44 2018
New Revision: 1835871
URL: http://svn.apache.org/viewvc?rev=1835871&view=rev
Log:
Improved: All existing party contact mechs should be deleted before creating
new one.
(OFBIZ-10396)
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.
Modified:
ofbiz/ofbiz-framework/trunk/applications/order/minilang/order/OrderServices.xml
ofbiz/ofbiz-framework/trunk/applications/party/minilang/contact/PartyContactMechServices.xml
Modified:
ofbiz/ofbiz-framework/trunk/applications/order/minilang/order/OrderServices.xml
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/minilang/order/OrderServices.xml?rev=1835871&r1=1835870&r2=1835871&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/order/minilang/order/OrderServices.xml
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/order/minilang/order/OrderServices.xml
Sat Jul 14 05:35:44 2018
@@ -890,12 +890,11 @@ under the License.
<field-map field-name="partyId"
from-field="userLogin.partyId"/>
<field-map field-name="contactMechPurposeTypeId"
value="SHIPPING_LOCATION"/>
</entity-and>
- <if-not-empty field="pcmpList">
- <first-from-list list="pcmpList" entry="pcmp"/>
+ <iterate list="pcmpList" entry="pcmp">
<set-service-fields
service-name="deletePartyContactMechPurposeIfExists" map="pcmp"
to-map="serviceInMap"/>
<call-service
service-name="deletePartyContactMechPurposeIfExists"
in-map-name="serviceInMap"/>
<clear-field field="serviceInMap"/>
- </if-not-empty>
+ </iterate>
<set field="serviceContext.partyId"
from-field="userLogin.partyId"/>
<set field="serviceContext.contactMechId"
from-field="parameters.shipToContactMechId"/>
<set field="serviceContext.contactMechPurposeTypeId"
value="SHIPPING_LOCATION"/>
@@ -923,11 +922,10 @@ under the License.
<field-map field-name="partyId"
from-field="userLogin.partyId"/>
<field-map field-name="contactMechPurposeTypeId"
value="SHIPPING_LOCATION"/>
</entity-and>
- <first-from-list list="pcmpList" entry="pcmp"/>
- <if-not-empty field="pcmp">
+ <iterate list="pcmpList" entry="pcmp">
<set-service-fields
service-name="deletePartyContactMechPurposeIfExists" map="pcmp"
to-map="serviceInMap"/>
<call-service
service-name="deletePartyContactMechPurposeIfExists"
in-map-name="serviceInMap"/>
- </if-not-empty>
+ </iterate>
<set field="shipToAddressCtx.contactMechPurposeTypeId"
value="SHIPPING_LOCATION"/>
<set field="shipToAddressCtx.contactMechId"
from-field="nullField"/>
<call-service service-name="createPartyPostalAddress"
in-map-name="shipToAddressCtx">
@@ -973,12 +971,11 @@ under the License.
<field-map field-name="partyId" from-field="partyId"/>
<field-map field-name="contactMechPurposeTypeId"
value="BILLING_LOCATION"/>
</entity-and>
- <first-from-list list="pcmpList" entry="pcmp"/>
- <if-not-empty field="pcmp">
+ <iterate list="pcmpList" entry="pcmp">
<set-service-fields
service-name="deletePartyContactMechPurposeIfExists" map="pcmp"
to-map="serviceInMap"/>
<call-service
service-name="deletePartyContactMechPurposeIfExists"
in-map-name="serviceInMap"/>
<clear-field field="serviceInMap"/>
- </if-not-empty>
+ </iterate>
<if-compare field="keepAddressBook" operator="equals"
value="N">
<set field="serviceInMap.contactMechId"
from-field="parameters.billToContactMechId"/>
<call-service service-name="deletePartyContactMech"
in-map-name="serviceInMap"/>
@@ -1022,12 +1019,11 @@ under the License.
<field-map field-name="partyId"
from-field="billToAddressCtx.partyId"/>
<field-map field-name="contactMechPurposeTypeId"
value="BILLING_LOCATION"/>
</entity-and>
- <if-not-empty field="pcmpList">
- <first-from-list list="pcmpList" entry="pcmp"/>
+ <iterate list="pcmpList" entry="pcmp">
<set-service-fields
service-name="deletePartyContactMechPurposeIfExists" map="pcmp"
to-map="serviceInMap"/>
<call-service
service-name="deletePartyContactMechPurposeIfExists"
in-map-name="serviceInMap"/>
<clear-field field="serviceInMap"/>
- </if-not-empty>
+ </iterate>
<set field="serviceContext.partyId"
from-field="userLogin.partyId"/>
<set field="serviceContext.contactMechId"
from-field="parameters.billToContactMechId"/>
<set field="serviceContext.contactMechPurposeTypeId"
value="BILLING_LOCATION"/>
@@ -1073,12 +1069,11 @@ under the License.
<field-map field-name="partyId"
from-field="userLogin.partyId"/>
<field-map field-name="contactMechPurposeTypeId"
value="BILLING_LOCATION"/>
</entity-and>
- <if-not-empty field="pcmpList">
- <first-from-list list="pcmpList" entry="pcmp"/>
+ <iterate list="pcmpList" entry="pcmp">
<set-service-fields
service-name="deletePartyContactMechPurposeIfExists" map="pcmp"
to-map="serviceInMap"/>
<call-service
service-name="deletePartyContactMechPurposeIfExists"
in-map-name="serviceInMap"/>
<clear-field field="serviceInMap"/>
- </if-not-empty>
+ </iterate>
<set field="serviceContext.partyId"
from-field="userLogin.partyId"/>
<set field="serviceContext.contactMechId"
from-field="parameters.billToContactMechId"/>
<set field="serviceContext.contactMechPurposeTypeId"
value="BILLING_LOCATION"/>
Modified:
ofbiz/ofbiz-framework/trunk/applications/party/minilang/contact/PartyContactMechServices.xml
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/minilang/contact/PartyContactMechServices.xml?rev=1835871&r1=1835870&r2=1835871&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/party/minilang/contact/PartyContactMechServices.xml
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/party/minilang/contact/PartyContactMechServices.xml
Sat Jul 14 05:35:44 2018
@@ -457,12 +457,11 @@ under the License.
<field-map field-name="partyId"
from-field="userLogin.partyId"/>
<field-map field-name="contactMechPurposeTypeId"
value="SHIPPING_LOCATION"/>
</entity-and>
- <if-not-empty field="pcmpList">
- <first-from-list list="pcmpList" entry="pcmp"/>
+ <iterate list="pcmpList" entry="pcmp">
<set-service-fields
service-name="deletePartyContactMechPurposeIfExists" map="pcmp"
to-map="serviceInMap"/>
<call-service
service-name="deletePartyContactMechPurposeIfExists"
in-map-name="serviceInMap"/>
<clear-field field="serviceInMap"/>
- </if-not-empty>
+ </iterate>
<set field="serviceContext.contactMechPurposeTypeId"
value="SHIPPING_LOCATION"/>
<call-service service-name="createPartyContactMechPurpose"
in-map-name="serviceContext"/>
@@ -476,11 +475,10 @@ under the License.
<field-map field-name="partyId"
from-field="userLogin.partyId"/>
<field-map field-name="contactMechPurposeTypeId"
value="BILLING_LOCATION"/>
</entity-and>
- <if-not-empty field="pcmpList">
- <first-from-list list="pcmpList" entry="pcmp"/>
+ <iterate list="pcmpList" entry="pcmp">
<set-service-fields
service-name="deletePartyContactMechPurposeIfExists" map="pcmp"
to-map="serviceInMap"/>
<call-service
service-name="deletePartyContactMechPurposeIfExists"
in-map-name="serviceInMap"/>
- </if-not-empty>
+ </iterate>
<set field="serviceContext.contactMechPurposeTypeId"
value="BILLING_LOCATION"/>
<call-service service-name="createPartyContactMechPurpose"
in-map-name="serviceContext"/>
@@ -562,12 +560,11 @@ under the License.
<field-map field-name="partyId"
from-field="userLogin.partyId"/>
<field-map field-name="contactMechPurposeTypeId"
value="SHIPPING_LOCATION"/>
</entity-and>
- <if-not-empty field="pcmpList">
- <first-from-list list="pcmpList" entry="pcmp"/>
+ <iterate list="pcmpList" entry="pcmp">
<set-service-fields
service-name="deletePartyContactMechPurposeIfExists" map="pcmp"
to-map="serviceInMap"/>
<call-service
service-name="deletePartyContactMechPurposeIfExists"
in-map-name="serviceInMap"/>
<clear-field field="serviceInMap"/>
- </if-not-empty>
+ </iterate>
<set field="serviceContext.contactMechPurposeTypeId"
value="SHIPPING_LOCATION"/>
<call-service
service-name="createPartyContactMechPurpose" in-map-name="serviceContext"/>
<clear-field field="pcmpList"/>
@@ -594,11 +591,10 @@ under the License.
<field-map field-name="partyId"
from-field="userLogin.partyId"/>
<field-map field-name="contactMechPurposeTypeId"
value="BILLING_LOCATION"/>
</entity-and>
- <if-not-empty field="pcmpList">
- <first-from-list list="pcmpList" entry="pcmp"/>
+ <iterate list="pcmpList" entry="pcmp">
<set-service-fields
service-name="deletePartyContactMechPurposeIfExists" map="pcmp"
to-map="serviceInMap"/>
<call-service
service-name="deletePartyContactMechPurposeIfExists"
in-map-name="serviceInMap"/>
- </if-not-empty>
+ </iterate>
<set field="serviceContext.contactMechPurposeTypeId"
value="BILLING_LOCATION"/>
<call-service
service-name="createPartyContactMechPurpose" in-map-name="serviceContext"/>
</if-empty>