git bisect tells me that bug 9779 introduces a javascript issue in some acquisition pages. To reproduce: - open Firebug - go to acqui/addorderiso2709.pl I don't know if the guilty code in js/acq.js can be removed.
I have a patch in progress for this already. I'll try to get it submitted today.
Created attachment 19342 [details] [review] Bug 10522 - Javascript error on acquisition pages: YAHOO is not defined acq.js includes an immediately invoked function expression, which means that it runs whether or not it is called. Because this function tries to reference the YAHOO object, it triggers an error on pages which don't include the main YAHOO assets. Only the basketgroups page uses this function and YAHOO assets. It's probably possible to make this a regular function, but I propose simply wrapping it in a check for the YAHOO object so that it only executes on pages where YAHOO exists--the basketgroups page. To test, apply the patch, clear your browser cache, and test on both the basketgroups page and at least one page which also includes acq.js (addorderiso2709.pl, neworderempty.pl, aqbudgets.pl, suggestion.pl, etc.) and confirm that the browser reports no JavaScript errors.
Don't you think it is worth to create, for instance a basketgroup.js, and to put this code in?
(In reply to Jonathan Druart from comment #3) > Don't you think it is worth to create, for instance a basketgroup.js, and to > put this code in? That would certainly work. It would also work to replace the YUI-dependent JS with something that doesn't require YUI. I'm offering a minimal patch because I'm not familiar with how the basketgroups drag-and-drop JS works and would prefer that someone more familiar with acquisitions take it up.
Created attachment 19358 [details] [review] Bug 10522 - Javascript error on acquisition pages: YAHOO is not defined acq.js includes an immediately invoked function expression, which means that it runs whether or not it is called. Because this function tries to reference the YAHOO object, it triggers an error on pages which don't include the main YAHOO assets. Only the basketgroups page uses this function and YAHOO assets. It's probably possible to make this a regular function, but I propose simply wrapping it in a check for the YAHOO object so that it only executes on pages where YAHOO exists--the basketgroups page. To test, apply the patch, clear your browser cache, and test on both the basketgroups page and at least one page which also includes acq.js (addorderiso2709.pl, neworderempty.pl, aqbudgets.pl, suggestion.pl, etc.) and confirm that the browser reports no JavaScript errors. Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> $ git show HEAD -w [...] - +if( typeof(YAHOO) === "object"){ (function() { var Dom = YAHOO.util.Dom; @@ -234,7 +234,7 @@ YAHOO.extend(DDList, YAHOO.util.DDProxy, { } }); })(); - +}
Created attachment 19449 [details] [review] Bug 10522 - Javascript error on acquisition pages: YAHOO is not defined acq.js includes an immediately invoked function expression, which means that it runs whether or not it is called. Because this function tries to reference the YAHOO object, it triggers an error on pages which don't include the main YAHOO assets. Only the basketgroups page uses this function and YAHOO assets. It's probably possible to make this a regular function, but I propose simply wrapping it in a check for the YAHOO object so that it only executes on pages where YAHOO exists--the basketgroups page. To test, apply the patch, clear your browser cache, and test on both the basketgroups page and at least one page which also includes acq.js (addorderiso2709.pl, neworderempty.pl, aqbudgets.pl, suggestion.pl, etc.) and confirm that the browser reports no JavaScript errors. Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> $ git show HEAD -w [...] - +if( typeof(YAHOO) === "object"){ (function() { var Dom = YAHOO.util.Dom; @@ -234,7 +234,7 @@ YAHOO.extend(DDList, YAHOO.util.DDProxy, { } }); })(); - +} Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Pushed to master. Thanks, Owen!