Bug 10522: fix Javascript error on acquisition pages: YAHOO is not defined
authorOwen Leonard <oleonard@myacpl.org>
Fri, 28 Jun 2013 18:46:44 +0000 (14:46 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 8 Jul 2013 15:09:14 +0000 (15:09 +0000)
commit0fc7d9a0a4aa094c6295ee1f0d43d97831e322dc
tree43f555904aefa9db07cf92942e5fa807f42a239d
parentbf9eccfeb8069c1b258916c1916138b6317122da
Bug 10522: fix 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>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
koha-tmpl/intranet-tmpl/prog/en/js/acq.js