+1
--
Ashish Vijaywargiya
Indore (M.P), India
http://en.wikipedia.org/wiki/Indore



On Thu, Aug 14, 2008 at 3:29 PM, Jacopo Cappellato <
[EMAIL PROTECTED]> wrote:

> Hi Hans,
>
> wouldn't be better (more readable code) to refactor the "if" condition
> using the <not> element?
>
> Jacopo
>
>
> On Aug 14, 2008, at 11:38 AM, [EMAIL PROTECTED] wrote:
>
>  Author: hansbak
>> Date: Thu Aug 14 02:38:42 2008
>> New Revision: 685836
>>
>> URL: http://svn.apache.org/viewvc?rev=685836&view=rev
>> Log:
>> when a custRequest is created, create also optionally the item because
>> often the texual customer request consists out of a single item
>>
>> Modified:
>>
>> ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestServices.xml
>>   ofbiz/trunk/applications/order/servicedef/services_request.xml
>>
>> Modified:
>> ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestServices.xml
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestServices.xml?rev=685836&r1=685835&r2=685836&view=diff
>>
>> ==============================================================================
>> ---
>> ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestServices.xml
>> (original)
>> +++
>> ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestServices.xml
>> Thu Aug 14 02:38:42 2008
>> @@ -83,6 +83,21 @@
>>        <string-to-field string="REQ_REQUESTER" map-name="requesterMap"
>> field-name="roleTypeId"/>
>>        <call-service service-name="createCustRequestRole"
>> in-map-name="requesterMap"/>
>>        -->
>> +
>> +        <!-- create also the item if key fields are provided -->
>> +        <if><condition><and>
>> +            <if-empty field="parameters.productId"/>
>> +            <if-empty field="parameters.reservStart"/>
>> +            <if-empty field="parameters.story"/>
>> +            <if-empty field="parameters.description"/>
>> +        </and></condition>
>> +        <then/>
>> +            <else>
>> +              <set-service-fields service-name="createCustRequestItem"
>> map-name="parameters" to-map-name="createItem"/>
>> +              <set field="createItem.custRequestId"
>> from-field="newEntity.custRequestId"/>
>> +              <call-service service-name="createCustRequestItem"
>> in-map-name="createItem"/>
>> +            </else>
>> +        </if>
>>    </simple-method>
>>    <simple-method method-name="updateCustRequest"
>> short-description="Update Customer Request">
>>        <set from-field="parameters.custRequestId"
>> field="lookupPKMap.custRequestId"/>
>>
>> Modified: ofbiz/trunk/applications/order/servicedef/services_request.xml
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services_request.xml?rev=685836&r1=685835&r2=685836&view=diff
>>
>> ==============================================================================
>> --- ofbiz/trunk/applications/order/servicedef/services_request.xml
>> (original)
>> +++ ofbiz/trunk/applications/order/servicedef/services_request.xml Thu Aug
>> 14 02:38:42 2008
>> @@ -27,9 +27,10 @@
>>    <!-- Customer Request Services -->
>>    <service name="createCustRequest" engine="simple"
>> default-entity-name="CustRequest"
>>            location="org/ofbiz/order/request/CustRequestServices.xml"
>> invoke="createCustRequest" auth="true">
>> -        <description>Create a custRequest record</description>
>> +        <description>Create a custRequest record and optionally create a
>> custRequest item.</description>
>>        <auto-attributes include="nonpk" mode="IN" optional="true"/>
>>        <auto-attributes include="pk" mode="INOUT" optional="true"/>
>> +        <auto-attributes include="all" mode="IN"
>> entity-name="CustRequestItem" optional="true"/>
>>    </service>
>>    <service name="updateCustRequest" engine="simple"
>> default-entity-name="CustRequest"
>>            location="org/ofbiz/order/request/CustRequestServices.xml"
>> invoke="updateCustRequest" auth="true">
>>
>>
>>
>

Reply via email to