Re: svn commit: r1636495 - /ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml

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

Re: svn commit: r1636495 - /ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml

Nicolas Malin-2
Hello Hans, why don't use directly the service ensurePartyRole instead
of a entity-one and after a creation ?

Le 04/11/2014 03:45, [hidden email] a écrit :

> Author: hansbak
> Date: Tue Nov  4 02:45:29 2014
> New Revision: 1636495
>
> URL: http://svn.apache.org/r1636495
> Log:
> role not checked for existence: https://issues.apache.org/jira/browse/OFBIZ-5845
>
> Modified:
>      ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml
>
> Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml?rev=1636495&r1=1636494&r2=1636495&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml (original)
> +++ ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml Tue Nov  4 02:45:29 2014
> @@ -165,9 +165,15 @@ This file contains basic services for Sa
>               </if-not-empty>
>               <!-- Check party role for create Lead Role -->
>               <if-not-empty field="parameters.leadPartyId">
> -                <set field="roleMap.roleTypeId" value="LEAD"/>
> -                <set field="roleMap.partyId" from-field="parameters.leadPartyId"/>
> -                <call-service service-name="createPartyRole" in-map-name="roleMap"/>
> +                <entity-one value-field="leadRole" entity-name="PartyRole">
> +                    <field-map field-name="partyId" from-field="parameters.leadPartyId"/>
> +                    <field-map field-name="roleTypeId" value="LEAD"/>
> +                </entity-one>
> +                <if-empty field="leadRole">
> +                    <set field="roleMap.roleTypeId" value="LEAD"/>
> +                    <set field="roleMap.partyId" from-field="parameters.leadPartyId"/>
> +                    <call-service service-name="createPartyRole" in-map-name="roleMap"/>
> +                </if-empty>
>               </if-not-empty>
>               <set field="salesOpportunityRole.roleTypeId" value="LEAD"/>
>               <set field="salesOpportunityRole.salesOpportunityId" from-field="parameters.salesOpportunityId"/>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1636495 - /ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml

hans_bakker
Sure you can do that, i was not aware of it, feel free to improve it......

Regards,'Hans

On 04/11/14 19:10, Nicolas Malin wrote:

> Hello Hans, why don't use directly the service ensurePartyRole instead
> of a entity-one and after a creation ?
>
> Le 04/11/2014 03:45, [hidden email] a écrit :
>> Author: hansbak
>> Date: Tue Nov  4 02:45:29 2014
>> New Revision: 1636495
>>
>> URL: http://svn.apache.org/r1636495
>> Log:
>> role not checked for existence:
>> https://issues.apache.org/jira/browse/OFBIZ-5845
>>
>> Modified:
>> ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml
>>
>> Modified:
>> ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml?rev=1636495&r1=1636494&r2=1636495&view=diff
>> ==============================================================================
>>
>> ---
>> ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml
>> (original)
>> +++
>> ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml
>> Tue Nov  4 02:45:29 2014
>> @@ -165,9 +165,15 @@ This file contains basic services for Sa
>>               </if-not-empty>
>>               <!-- Check party role for create Lead Role -->
>>               <if-not-empty field="parameters.leadPartyId">
>> -                <set field="roleMap.roleTypeId" value="LEAD"/>
>> -                <set field="roleMap.partyId"
>> from-field="parameters.leadPartyId"/>
>> -                <call-service service-name="createPartyRole"
>> in-map-name="roleMap"/>
>> +                <entity-one value-field="leadRole"
>> entity-name="PartyRole">
>> +                    <field-map field-name="partyId"
>> from-field="parameters.leadPartyId"/>
>> +                    <field-map field-name="roleTypeId" value="LEAD"/>
>> +                </entity-one>
>> +                <if-empty field="leadRole">
>> +                    <set field="roleMap.roleTypeId" value="LEAD"/>
>> +                    <set field="roleMap.partyId"
>> from-field="parameters.leadPartyId"/>
>> +                    <call-service service-name="createPartyRole"
>> in-map-name="roleMap"/>
>> +                </if-empty>
>>               </if-not-empty>
>>               <set field="salesOpportunityRole.roleTypeId"
>> value="LEAD"/>
>>               <set field="salesOpportunityRole.salesOpportunityId"
>> from-field="parameters.salesOpportunityId"/>
>>
>>
>