[JIRA] Reopened: (OFBIZ-720) popups not identifying opener field properly

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

[JIRA] Reopened: (OFBIZ-720) popups not identifying opener field properly

JIRA jira@ofbiz.org
     [ http://jira.undersunconsulting.com/browse/OFBIZ-720?page=all ]
     
Jacopo Cappellato reopened OFBIZ-720:
-------------------------------------


Based on the following comments from Chris Howe, I'm reopening this issue:
******************************************
I've reproduced this.  Try the

1) Accounting app
2) Find Payments
3) Choose a payment that still has an amount left to
apply
4) Application tab
5) lookup from the invoices Id field
6) on that popup lookup from the "From Party Id" field

on that screen to a lookup
******************************************

Now I understand the problem; if you open a lookup window and then in the lookup window's form there is a new lookup link, that link will load a new lookup screen inside the same popup windows: the system will try to assign the value you'll select there to one of the fields of the main window (instead of one of the fields of the first lookup form).

Jacopo

> popups not identifying opener field properly
> --------------------------------------------
>
>          Key: OFBIZ-720
>          URL: http://jira.undersunconsulting.com/browse/OFBIZ-720
>      Project: [OFBiz] Open For Business
>         Type: Bug
>   Components: common
>     Versions: SVN
>  Environment: ubuntu breezy, jdk 1.4.2
>     Reporter: Romà Ferré Añaños
>     Assignee: Jira Administrator
>  Attachments: lookup.ftl
>
>
> We found that in a screen form with more than one popup field, the current mechanism fails to properly identify the field (in the main window) which was to receive the selected value.
> In a typical scenario, only one of the fields would receive the result of any of the popups.
> We inspected the javascript code in "framework/common/webcommon/includes/lookup.ftl" and found that the mechanism for locating the opener field depended on the URL parameter "id". This parameter is not properly passed on successive submits (or pages) in the popup, and it only takes the first submit on the "Lookup" button to lose the "id" parameter.
> We have designed a solution for this bug which relies on cookies, so that we can remember the id between pages.
> We rely upon typical javascript setCookie/getCookie functions.
> Here is the main part of our solution:
>         //let us prepare a regular expression which will alow us to extract the id parameter from the URL
>         // => this is guaranteed to work the first time we open up the popup
>         var re_id = new RegExp('id=(\\d+)');
>         //We set num_id to -1 in case of "no match" to remember this condition later
>         var num_id = (re_id.exec(String(window.location))
>                 ? new Number(RegExp.$1) : -1);
>         //Now we want to obtain the obj_caller...
>         var obj_caller;
>         if(num_id!=-1){
>        //an id was passed in, let us remember it...
>        setCookie("__popupNumId__",num_id);
>        obj_caller = (window.opener ? window.opener.lookups[num_id] : null);
>    }
>    else{
>     //No id was passed in, let us check if we have a remembered cookie
>        //let us see if we have a previous num_id saved as a cookie    
>        var oldNumId=getCookie("__popupNumId__");
>     if(oldNumId){
>     //we found a remembered id
>        obj_caller = (window.opener ? window.opener.lookups[oldNumId] : null);
>     }
>     else{
>     //oops!! abnormal situation
>     }
>    }
>         if (obj_caller == null)
>             obj_caller = window.opener;

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.undersunconsulting.com/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira