From a0c6f5df3fd58f22c84a7250692a4613104bc166 Mon Sep 17 00:00:00 2001 From: Olli-Antti Kivilahti Date: Tue, 4 Feb 2014 19:39:02 +0200 Subject: [PATCH] Bug 11676 - Loading shelving locations based on the item's homebranch instead of the user's logged-in branch. Javascript bits. Makes the Shelving locations automatically refresh when the "Permanent location" (homebranch) changes. --- .../prog/en/modules/cataloguing/additem.tt | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt index 2e3ddc3..ae26576 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt @@ -14,7 +14,36 @@ var browser = KOHA.browser('[% searchid %]', parseInt('[% biblionumber %]', 10)); browser.show(); +//Fetch the Shelving locations using AJAX +//Build the replacement HTML for the shelving location options +//Then replace the existing HTML with this. +function reloadShelvingLocations(homebranch) { + + $.ajax({ + url: "/cgi-bin/koha/svc/getAuthorisedValues.pl", + type: "POST", + dataType: 'json', + data: { 'category' : 'LOC', 'branch_limit' : homebranch }, + success: function(data, textStatus, jqXHR) { + + var html_replacement = '\n'; + for (var i in data) { + html_replacement += '\n'; + } + $("select[id*='tag_952_subfield_c']").html(html_replacement); + } + }); +} + + $(document).ready(function(){ + + //Reload shelving location with AJAX if the "Permanent location" (homebranch) changes. + $("select[id*='tag_952_subfield_a']").change(function() { + reloadShelvingLocations(this.value); + }); + + [% IF (popup) %] [% IF (opisadd) %] window.close(); -- 1.8.1.2