You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by bi...@apache.org on 2009/10/29 22:35:50 UTC

svn commit: r831098 - /ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java

Author: bibryam
Date: Thu Oct 29 21:35:49 2009
New Revision: 831098

URL: http://svn.apache.org/viewvc?rev=831098&view=rev
Log:
Prevent overriding of service results in a service-multi type events.

Modified:
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java

Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java?rev=831098&r1=831097&r2=831098&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java Thu Oct 29 21:35:49 2009
@@ -339,7 +339,7 @@
                     if (!UtilValidate.isEmpty(result.get(ModelService.SUCCESS_MESSAGE_LIST))) {
                         List<String> newSuccessMessages = UtilGenerics.<String>checkList(result.get(ModelService.SUCCESS_MESSAGE_LIST));
                         for (int j = 0; j < newSuccessMessages.size(); j++) {
-                            String newSuccessMessage = (String)newSuccessMessages.get(j);
+                            String newSuccessMessage = newSuccessMessages.get(j);
                             if (!successMessages.contains(newSuccessMessage)) {
                                 successMessages.add(newSuccessMessage);
                             }
@@ -355,7 +355,7 @@
                         if (resultKey != null && !ModelService.RESPONSE_MESSAGE.equals(resultKey) && !ModelService.ERROR_MESSAGE.equals(resultKey) &&
                                 !ModelService.ERROR_MESSAGE_LIST.equals(resultKey) && !ModelService.ERROR_MESSAGE_MAP.equals(resultKey) &&
                                 !ModelService.SUCCESS_MESSAGE.equals(resultKey) && !ModelService.SUCCESS_MESSAGE_LIST.equals(resultKey)) {
-                            request.setAttribute(resultKey, resultValue);
+                            request.setAttribute(resultKey + curSuffix, resultValue);
                         }
                     }
                 }



Re: svn commit: r831098 - /ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java (Manual return functionality is broken)

Posted by Jacques Le Roux <ja...@les7arts.com>.
Thanks Ashish,

Jacques

From: "Ashish Vijaywargiya" <vi...@gmail.com>
> Here you go: https://issues.apache.org/jira/browse/OFBIZ-3196
>
> --
> Ashish
>
> On Sat, Nov 14, 2009 at 12:51 PM, Jacques Le Roux <
> jacques.le.roux@les7arts.com> wrote:
>
>> Hi Divesh,
>>
>> Did you open a Jira for that ?
>>
>> Thanks
>>
>> Jacques
>>
>> From: "Divesh Dutta" <di...@hotwaxmedia.com>
>>
>>  Also Adding urls of the image which I described. Please see my comments
>>> inline:
>>>
>>> Divesh Dutta wrote:
>>>
>>>> Hello Bilgin and others,
>>>>
>>>> I found that Manual refund functionality is broken due to this commit .
>>>> Steps to reproduce the error:
>>>>
>>>> 1) Create a sales order from Order manager application with two or more
>>>> items.
>>>>
>>>> 2) Then approve and "Quick ship the entire Order" which will complete the
>>>> order.
>>>>
>>>> 3) Then click on "Create Return" button on Actions Block.
>>>>
>>>> 4) You will land on Create new Return Page: Also attaching the screen
>>>> shot. (Screenshot-1)
>>>>
>>> http://img156.yfrog.com/i/screenshot1jw.png/
>>>
>>>
>>>> 5) Click on select all check box and then click on "Return Selected items
>>>> button."
>>>>
>>>> 6) You will find that page is broken. Also attaching the screen shot for
>>>> the same.  (Screenshot-2)
>>>>
>>> http://img156.yfrog.com/i/screenshot2kn.png/
>>>
>>>
>>>
>>>> After doing research on this I found that reason for this code failure is
>>>> in "createReturnAndItemOrAdjustment" simple method in
>>>> OrderReturnServices.xml. This is because in below given code snippet :
>>>>
>>>>   1    <if-empty field="parameters.returnId">
>>>>   2      <set-service-fields service-name="createReturnHeader"
>>>> map="parameters" to-map="returnHeaderInMap"/>
>>>>   3      <call-service service-name="createReturnHeader"
>>>> in-map-name="returnHeaderInMap">
>>>>   4          <result-to-field result-name="returnId" field="returnId"/>
>>>>   5      </call-service>
>>>>   6      <check-errors/>
>>>>   7      <set field="parameters.returnId" from-field="returnId"/>
>>>>   8      <field-to-result field="returnId" result-name="returnId"/>
>>>>   9   </if-empty>
>>>>
>>>> parameters.returnId field is always empty when this service is called as
>>>> "service-multi" even though it is set in line #7.
>>>>
>>>> And if I revert your this commit then this functionality is working fine.
>>>> So It will be great if you or any one else, give the reason of this
>>>> commit and also provide fix or alternate way to solve this issue.
>>>>
>>>> Thanks
>>>> --
>>>> Divesh Dutta.
>>>>
>>>>
>>>> bibryam@apache.org wrote:
>>>>
>>>>> Author: bibryam
>>>>> Date: Thu Oct 29 21:35:49 2009
>>>>> New Revision: 831098
>>>>>
>>>>> URL: http://svn.apache.org/viewvc?rev=831098&view=rev
>>>>> Log:
>>>>> Prevent overriding of service results in a service-multi type events.
>>>>>
>>>>> Modified:
>>>>>
>>>>>  ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java
>>>>>
>>>>> Modified:
>>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java
>>>>> URL:
>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java?rev=831098&r1=831097&r2=831098&view=diff
>>>>>
>>>>> ==============================================================================
>>>>> ---
>>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java
>>>>> (original)
>>>>> +++
>>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java
>>>>> Thu Oct 29 21:35:49 2009
>>>>> @@ -339,7 +339,7 @@
>>>>>                     if
>>>>> (!UtilValidate.isEmpty(result.get(ModelService.SUCCESS_MESSAGE_LIST))) {
>>>>>                         List<String> newSuccessMessages =
>>>>> UtilGenerics.<String>checkList(result.get(ModelService.SUCCESS_MESSAGE_LIST));
>>>>>                         for (int j = 0; j < newSuccessMessages.size();
>>>>> j++) {
>>>>> -                            String newSuccessMessage =
>>>>> (String)newSuccessMessages.get(j);
>>>>> +                            String newSuccessMessage =
>>>>> newSuccessMessages.get(j);
>>>>>                             if
>>>>> (!successMessages.contains(newSuccessMessage)) {
>>>>>                                 successMessages.add(newSuccessMessage);
>>>>>                             }
>>>>> @@ -355,7 +355,7 @@
>>>>>                         if (resultKey != null &&
>>>>> !ModelService.RESPONSE_MESSAGE.equals(resultKey) &&
>>>>> !ModelService.ERROR_MESSAGE.equals(resultKey) &&
>>>>>
>>>>> !ModelService.ERROR_MESSAGE_LIST.equals(resultKey) &&
>>>>> !ModelService.ERROR_MESSAGE_MAP.equals(resultKey) &&
>>>>>
>>>>> !ModelService.SUCCESS_MESSAGE.equals(resultKey) &&
>>>>> !ModelService.SUCCESS_MESSAGE_LIST.equals(resultKey)) {
>>>>> -                            request.setAttribute(resultKey,
>>>>> resultValue);
>>>>> +                            request.setAttribute(resultKey + curSuffix,
>>>>> resultValue);
>>>>>                         }
>>>>>                     }
>>>>>                 }
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>>
> 



Re: svn commit: r831098 - /ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java (Manual return functionality is broken)

Posted by Ashish Vijaywargiya <vi...@gmail.com>.
Here you go: https://issues.apache.org/jira/browse/OFBIZ-3196

--
Ashish

On Sat, Nov 14, 2009 at 12:51 PM, Jacques Le Roux <
jacques.le.roux@les7arts.com> wrote:

> Hi Divesh,
>
> Did you open a Jira for that ?
>
> Thanks
>
> Jacques
>
> From: "Divesh Dutta" <di...@hotwaxmedia.com>
>
>  Also Adding urls of the image which I described. Please see my comments
>> inline:
>>
>> Divesh Dutta wrote:
>>
>>> Hello Bilgin and others,
>>>
>>> I found that Manual refund functionality is broken due to this commit .
>>> Steps to reproduce the error:
>>>
>>> 1) Create a sales order from Order manager application with two or more
>>> items.
>>>
>>> 2) Then approve and "Quick ship the entire Order" which will complete the
>>> order.
>>>
>>> 3) Then click on "Create Return" button on Actions Block.
>>>
>>> 4) You will land on Create new Return Page: Also attaching the screen
>>> shot. (Screenshot-1)
>>>
>> http://img156.yfrog.com/i/screenshot1jw.png/
>>
>>
>>> 5) Click on select all check box and then click on "Return Selected items
>>> button."
>>>
>>> 6) You will find that page is broken. Also attaching the screen shot for
>>> the same.  (Screenshot-2)
>>>
>> http://img156.yfrog.com/i/screenshot2kn.png/
>>
>>
>>
>>> After doing research on this I found that reason for this code failure is
>>> in "createReturnAndItemOrAdjustment" simple method in
>>> OrderReturnServices.xml. This is because in below given code snippet :
>>>
>>>   1    <if-empty field="parameters.returnId">
>>>   2      <set-service-fields service-name="createReturnHeader"
>>> map="parameters" to-map="returnHeaderInMap"/>
>>>   3      <call-service service-name="createReturnHeader"
>>> in-map-name="returnHeaderInMap">
>>>   4          <result-to-field result-name="returnId" field="returnId"/>
>>>   5      </call-service>
>>>   6      <check-errors/>
>>>   7      <set field="parameters.returnId" from-field="returnId"/>
>>>   8      <field-to-result field="returnId" result-name="returnId"/>
>>>   9   </if-empty>
>>>
>>> parameters.returnId field is always empty when this service is called as
>>> "service-multi" even though it is set in line #7.
>>>
>>> And if I revert your this commit then this functionality is working fine.
>>> So It will be great if you or any one else, give the reason of this
>>> commit and also provide fix or alternate way to solve this issue.
>>>
>>> Thanks
>>> --
>>> Divesh Dutta.
>>>
>>>
>>> bibryam@apache.org wrote:
>>>
>>>> Author: bibryam
>>>> Date: Thu Oct 29 21:35:49 2009
>>>> New Revision: 831098
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=831098&view=rev
>>>> Log:
>>>> Prevent overriding of service results in a service-multi type events.
>>>>
>>>> Modified:
>>>>
>>>>  ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java
>>>>
>>>> Modified:
>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java
>>>> URL:
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java?rev=831098&r1=831097&r2=831098&view=diff
>>>>
>>>> ==============================================================================
>>>> ---
>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java
>>>> (original)
>>>> +++
>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java
>>>> Thu Oct 29 21:35:49 2009
>>>> @@ -339,7 +339,7 @@
>>>>                     if
>>>> (!UtilValidate.isEmpty(result.get(ModelService.SUCCESS_MESSAGE_LIST))) {
>>>>                         List<String> newSuccessMessages =
>>>> UtilGenerics.<String>checkList(result.get(ModelService.SUCCESS_MESSAGE_LIST));
>>>>                         for (int j = 0; j < newSuccessMessages.size();
>>>> j++) {
>>>> -                            String newSuccessMessage =
>>>> (String)newSuccessMessages.get(j);
>>>> +                            String newSuccessMessage =
>>>> newSuccessMessages.get(j);
>>>>                             if
>>>> (!successMessages.contains(newSuccessMessage)) {
>>>>                                 successMessages.add(newSuccessMessage);
>>>>                             }
>>>> @@ -355,7 +355,7 @@
>>>>                         if (resultKey != null &&
>>>> !ModelService.RESPONSE_MESSAGE.equals(resultKey) &&
>>>> !ModelService.ERROR_MESSAGE.equals(resultKey) &&
>>>>
>>>> !ModelService.ERROR_MESSAGE_LIST.equals(resultKey) &&
>>>> !ModelService.ERROR_MESSAGE_MAP.equals(resultKey) &&
>>>>
>>>> !ModelService.SUCCESS_MESSAGE.equals(resultKey) &&
>>>> !ModelService.SUCCESS_MESSAGE_LIST.equals(resultKey)) {
>>>> -                            request.setAttribute(resultKey,
>>>> resultValue);
>>>> +                            request.setAttribute(resultKey + curSuffix,
>>>> resultValue);
>>>>                         }
>>>>                     }
>>>>                 }
>>>>
>>>>
>>>>
>>>>
>>>
>>
>
>

Re: svn commit: r831098 - /ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java (Manual return functionality is broken)

Posted by Jacques Le Roux <ja...@les7arts.com>.
Hi Divesh,

Did you open a Jira for that ?

Thanks

Jacques

From: "Divesh Dutta" <di...@hotwaxmedia.com>
> Also Adding urls of the image which I described. Please see my comments inline:
>
> Divesh Dutta wrote:
>> Hello Bilgin and others,
>>
>> I found that Manual refund functionality is broken due to this commit . Steps to reproduce the error:
>>
>> 1) Create a sales order from Order manager application with two or more items.
>>
>> 2) Then approve and "Quick ship the entire Order" which will complete the order.
>>
>> 3) Then click on "Create Return" button on Actions Block.
>>
>> 4) You will land on Create new Return Page: Also attaching the screen shot. (Screenshot-1)
> http://img156.yfrog.com/i/screenshot1jw.png/
>
>>
>> 5) Click on select all check box and then click on "Return Selected items button."
>>
>> 6) You will find that page is broken. Also attaching the screen shot for the same.  (Screenshot-2)
> http://img156.yfrog.com/i/screenshot2kn.png/
>
>
>>
>> After doing research on this I found that reason for this code failure is in "createReturnAndItemOrAdjustment" simple method in 
>> OrderReturnServices.xml. This is because in below given code snippet :
>>
>>    1    <if-empty field="parameters.returnId">
>>    2      <set-service-fields service-name="createReturnHeader" map="parameters" to-map="returnHeaderInMap"/>
>>    3      <call-service service-name="createReturnHeader" in-map-name="returnHeaderInMap">
>>    4          <result-to-field result-name="returnId" field="returnId"/>
>>    5      </call-service>
>>    6      <check-errors/>
>>    7      <set field="parameters.returnId" from-field="returnId"/>
>>    8      <field-to-result field="returnId" result-name="returnId"/>
>>    9   </if-empty>
>>
>> parameters.returnId field is always empty when this service is called as "service-multi" even though it is set in line #7.
>>
>> And if I revert your this commit then this functionality is working fine.
>> So It will be great if you or any one else, give the reason of this commit and also provide fix or alternate way to solve this 
>> issue.
>>
>> Thanks
>> -- 
>> Divesh Dutta.
>>
>>
>> bibryam@apache.org wrote:
>>> Author: bibryam
>>> Date: Thu Oct 29 21:35:49 2009
>>> New Revision: 831098
>>>
>>> URL: http://svn.apache.org/viewvc?rev=831098&view=rev
>>> Log:
>>> Prevent overriding of service results in a service-multi type events.
>>>
>>> Modified:
>>>     ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java
>>>
>>> Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java
>>> URL: 
>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java?rev=831098&r1=831097&r2=831098&view=diff
>>> ==============================================================================
>>> --- 
>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java (original)
>>> +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java Thu Oct 29 21:35:49 2009
>>> @@ -339,7 +339,7 @@
>>>                      if (!UtilValidate.isEmpty(result.get(ModelService.SUCCESS_MESSAGE_LIST))) {
>>>                          List<String> newSuccessMessages = 
>>> UtilGenerics.<String>checkList(result.get(ModelService.SUCCESS_MESSAGE_LIST));
>>>                          for (int j = 0; j < newSuccessMessages.size(); j++) {
>>> -                            String newSuccessMessage = (String)newSuccessMessages.get(j);
>>> +                            String newSuccessMessage = newSuccessMessages.get(j);
>>>                              if (!successMessages.contains(newSuccessMessage)) {
>>>                                  successMessages.add(newSuccessMessage);
>>>                              }
>>> @@ -355,7 +355,7 @@
>>>                          if (resultKey != null && !ModelService.RESPONSE_MESSAGE.equals(resultKey) && 
>>> !ModelService.ERROR_MESSAGE.equals(resultKey) &&
>>>                                  !ModelService.ERROR_MESSAGE_LIST.equals(resultKey) && 
>>> !ModelService.ERROR_MESSAGE_MAP.equals(resultKey) &&
>>>                                  !ModelService.SUCCESS_MESSAGE.equals(resultKey) && 
>>> !ModelService.SUCCESS_MESSAGE_LIST.equals(resultKey)) {
>>> -                            request.setAttribute(resultKey, resultValue);
>>> +                            request.setAttribute(resultKey + curSuffix, resultValue);
>>>                          }
>>>                      }
>>>                  }
>>>
>>>
>>>
>>
> 



Re: svn commit: r831098 - /ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java (Manual return functionality is broken)

Posted by Divesh Dutta <di...@hotwaxmedia.com>.
Also Adding urls of the image which I described. Please see my comments 
inline:

Divesh Dutta wrote:
> Hello Bilgin and others,
>
> I found that Manual refund functionality is broken due to this commit 
> . Steps to reproduce the error:
>
> 1) Create a sales order from Order manager application with two or 
> more items.
>
> 2) Then approve and "Quick ship the entire Order" which will complete 
> the order.
>
> 3) Then click on "Create Return" button on Actions Block.
>
> 4) You will land on Create new Return Page: Also attaching the screen 
> shot. (Screenshot-1)
http://img156.yfrog.com/i/screenshot1jw.png/

>
> 5) Click on select all check box and then click on "Return Selected 
> items button."
>
> 6) You will find that page is broken. Also attaching the screen shot 
> for the same.  (Screenshot-2)
http://img156.yfrog.com/i/screenshot2kn.png/


>
> After doing research on this I found that reason for this code failure 
> is in "createReturnAndItemOrAdjustment" simple method in 
> OrderReturnServices.xml. This is because in below given code snippet :
>
>    1    <if-empty field="parameters.returnId">
>    2      <set-service-fields service-name="createReturnHeader" 
> map="parameters" to-map="returnHeaderInMap"/>
>    3      <call-service service-name="createReturnHeader" 
> in-map-name="returnHeaderInMap">
>    4          <result-to-field result-name="returnId" field="returnId"/>
>    5      </call-service>
>    6      <check-errors/>
>    7      <set field="parameters.returnId" from-field="returnId"/>
>    8      <field-to-result field="returnId" result-name="returnId"/>
>    9   </if-empty>
>
> parameters.returnId field is always empty when this service is called 
> as "service-multi" even though it is set in line #7.
>
> And if I revert your this commit then this functionality is working fine.
> So It will be great if you or any one else, give the reason of this 
> commit and also provide fix or alternate way to solve this issue.
>
> Thanks
> -- 
> Divesh Dutta.
>
>
> bibryam@apache.org wrote:
>> Author: bibryam
>> Date: Thu Oct 29 21:35:49 2009
>> New Revision: 831098
>>
>> URL: http://svn.apache.org/viewvc?rev=831098&view=rev
>> Log:
>> Prevent overriding of service results in a service-multi type events.
>>
>> Modified:
>>     
>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java 
>>
>>
>> Modified: 
>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java 
>>
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java?rev=831098&r1=831097&r2=831098&view=diff 
>>
>> ============================================================================== 
>>
>> --- 
>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java 
>> (original)
>> +++ 
>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java 
>> Thu Oct 29 21:35:49 2009
>> @@ -339,7 +339,7 @@
>>                      if 
>> (!UtilValidate.isEmpty(result.get(ModelService.SUCCESS_MESSAGE_LIST))) {
>>                          List<String> newSuccessMessages = 
>> UtilGenerics.<String>checkList(result.get(ModelService.SUCCESS_MESSAGE_LIST)); 
>>
>>                          for (int j = 0; j < 
>> newSuccessMessages.size(); j++) {
>> -                            String newSuccessMessage = 
>> (String)newSuccessMessages.get(j);
>> +                            String newSuccessMessage = 
>> newSuccessMessages.get(j);
>>                              if 
>> (!successMessages.contains(newSuccessMessage)) {
>>                                  successMessages.add(newSuccessMessage);
>>                              }
>> @@ -355,7 +355,7 @@
>>                          if (resultKey != null && 
>> !ModelService.RESPONSE_MESSAGE.equals(resultKey) && 
>> !ModelService.ERROR_MESSAGE.equals(resultKey) &&
>>                                  
>> !ModelService.ERROR_MESSAGE_LIST.equals(resultKey) && 
>> !ModelService.ERROR_MESSAGE_MAP.equals(resultKey) &&
>>                                  
>> !ModelService.SUCCESS_MESSAGE.equals(resultKey) && 
>> !ModelService.SUCCESS_MESSAGE_LIST.equals(resultKey)) {
>> -                            request.setAttribute(resultKey, 
>> resultValue);
>> +                            request.setAttribute(resultKey + 
>> curSuffix, resultValue);
>>                          }
>>                      }
>>                  }
>>
>>
>>   
>


Re: svn commit: r831098 - /ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java (Manual return functionality is broken)

Posted by Divesh Dutta <di...@hotwaxmedia.com>.
Hello Bilgin and others,

I found that Manual refund functionality is broken due to this commit . 
Steps to reproduce the error:

1) Create a sales order from Order manager application with two or more 
items.

2) Then approve and "Quick ship the entire Order" which will complete 
the order.

3) Then click on "Create Return" button on Actions Block.

4) You will land on Create new Return Page: Also attaching the screen 
shot. (Screenshot-1)

5) Click on select all check box and then click on "Return Selected 
items button."

6) You will find that page is broken. Also attaching the screen shot for 
the same.  (Screenshot-2)

After doing research on this I found that reason for this code failure 
is in "createReturnAndItemOrAdjustment" simple method in 
OrderReturnServices.xml. This is because in below given code snippet :

    1    <if-empty field="parameters.returnId">
    2      <set-service-fields service-name="createReturnHeader" 
map="parameters" to-map="returnHeaderInMap"/>
    3      <call-service service-name="createReturnHeader" 
in-map-name="returnHeaderInMap">
    4          <result-to-field result-name="returnId" field="returnId"/>
    5      </call-service>
    6      <check-errors/>
    7      <set field="parameters.returnId" from-field="returnId"/>
    8      <field-to-result field="returnId" result-name="returnId"/>
    9   </if-empty>

parameters.returnId field is always empty when this service is called as 
"service-multi" even though it is set in line #7.

And if I revert your this commit then this functionality is working fine.
So It will be great if you or any one else, give the reason of this 
commit and also provide fix or alternate way to solve this issue.

Thanks
--
Divesh Dutta.


bibryam@apache.org wrote:
> Author: bibryam
> Date: Thu Oct 29 21:35:49 2009
> New Revision: 831098
>
> URL: http://svn.apache.org/viewvc?rev=831098&view=rev
> Log:
> Prevent overriding of service results in a service-multi type events.
>
> Modified:
>     ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java
>
> Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java?rev=831098&r1=831097&r2=831098&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java (original)
> +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java Thu Oct 29 21:35:49 2009
> @@ -339,7 +339,7 @@
>                      if (!UtilValidate.isEmpty(result.get(ModelService.SUCCESS_MESSAGE_LIST))) {
>                          List<String> newSuccessMessages = UtilGenerics.<String>checkList(result.get(ModelService.SUCCESS_MESSAGE_LIST));
>                          for (int j = 0; j < newSuccessMessages.size(); j++) {
> -                            String newSuccessMessage = (String)newSuccessMessages.get(j);
> +                            String newSuccessMessage = newSuccessMessages.get(j);
>                              if (!successMessages.contains(newSuccessMessage)) {
>                                  successMessages.add(newSuccessMessage);
>                              }
> @@ -355,7 +355,7 @@
>                          if (resultKey != null && !ModelService.RESPONSE_MESSAGE.equals(resultKey) && !ModelService.ERROR_MESSAGE.equals(resultKey) &&
>                                  !ModelService.ERROR_MESSAGE_LIST.equals(resultKey) && !ModelService.ERROR_MESSAGE_MAP.equals(resultKey) &&
>                                  !ModelService.SUCCESS_MESSAGE.equals(resultKey) && !ModelService.SUCCESS_MESSAGE_LIST.equals(resultKey)) {
> -                            request.setAttribute(resultKey, resultValue);
> +                            request.setAttribute(resultKey + curSuffix, resultValue);
>                          }
>                      }
>                  }
>
>
>