Bugzilla – Attachment 19399 Details for
Bug 10541
Enable cross-browser AJAX in additem.js
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10541 - Enable cross-browser AJAX in additem.js
0001-Bug-10541-Enable-cross-browser-AJAX-in-additem.js.patch (text/plain), 3.93 KB, created by
David Cook
on 2013-07-05 02:30:58 UTC
(
hide
)
Description:
Bug 10541 - Enable cross-browser AJAX in additem.js
Filename:
MIME Type:
Creator:
David Cook
Created:
2013-07-05 02:30:58 UTC
Size:
3.93 KB
patch
obsolete
>From 81ffb711b70f28709ff2170847fe65b99f910d51 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Fri, 5 Jul 2013 12:00:36 +1000 >Subject: [PATCH] Bug 10541 - Enable cross-browser AJAX in additem.js > >Currently, the additem.js is using "indexOf" to search >for a value in an array. While this works in Chrome, Firefox, >and IE > 9, it fails miserably in IE 8 and 7 (which don't have >the indexOf method). This means that users aren't able to add >items using the acquisitions module! > >Instead of using "indexOf", we should be using the jQuery function >$.inArray. It was added in jQuery v1.2 (3.8.0 uses v1.3.2 so even >our oldest supported release can use this method). It's perfectly >cross-browser compatible...works in Chrome, Firefox, and every >version of IE that I've tried (i.e. 7, 8, 9). > >Test Plan: > >Before applying patch: > >0) Switch to Internet Explorer 7, or 8, or 9. > >If you're using IE 9, you'll need to change the Document Mode to >IE7 standards or IE8 standards. > >You can do this by opening Internet Explorer 9, pressing F12 (or >clicking on the gear in the top right corner and choosing >F12 Developer Tools), and then clicking on "Document Mode" on the >top toolbar. There, you can change to IE7 or IE8 standards. > >N.B. This is not always a perfect emulation in every case, but this >time it does show you the bug. > >1) Set the system preference AcqCreateItem to "receiving an order" >2) Go to Acquisitions >3) Either: > a) Receive a shipment for a basket with items > b) Create a new basket, create an order, close the basket, and > then do 3a) >4) In the "Item" fieldset, fill out some fields such as barcode, > Date acquiried, Public note, etc. >5) Click "Add" at the bottom of the fieldset >6) Note that while the item may have been added, the "Item" fieldset >is not being shown again. You may also notice a Javascript error >appearing in a pop-up window or you might see a yellow warning flag >on the bottom status bar. > >APPLY THE PATCH > >7) Do a full refresh of the page (hold down shift and press the refresh >button on the browser next to the address bar), and try adding items >again. >8) Note that you receive no warnings and that items are added correctly >as they would be in Firefox or Chrome. > >OPTIONALLY > >9) To be sure that I haven't broken anything, go through the same steps >in IE9 (with IE9 standards) or Chrome or Firefox. Everything should be >working. >--- > koha-tmpl/intranet-tmpl/prog/en/js/additem.js | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/additem.js b/koha-tmpl/intranet-tmpl/prog/en/js/additem.js >index 2c15b04..6abf09e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/additem.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/additem.js >@@ -140,7 +140,7 @@ function cloneItemBlock(index, unique_item_fields) { > /* Copy values from the original block (input) */ > $(original).find("input[name='field_value']").each(function(){ > var kohafield = $(this).siblings("input[name='kohafield']").val(); >- if($(this).val() && dont_copy_fields.indexOf(kohafield) == -1) { >+ if($(this).val() && $.inArray(kohafield,dont_copy_fields) == -1) { > $(this).parent("div").attr("id").match(/^(subfield.)/); > var id = RegExp.$1; > var value = $(this).val(); >@@ -150,7 +150,7 @@ function cloneItemBlock(index, unique_item_fields) { > /* Copy values from the original block (select) */ > $(original).find("select[name='field_value']").each(function(){ > var kohafield = $(this).siblings("input[name='kohafield']").val(); >- if($(this).val() && dont_copy_fields.indexOf(kohafield) == -1) { >+ if($(this).val() && $.inArray(kohafield,dont_copy_fields) == -1) { > $(this).parent("div").attr("id").match(/^(subfield.)/); > var id = RegExp.$1; > var value = $(this).val(); >-- >1.7.7.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10541
:
19399
|
19593
|
19594