Bugzilla – Attachment 25062 Details for
Bug 11676
Loading shelving locations based on the item's homebranch instead of the user's logged-in branch.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11676 - Loading shelving locations based on the item's homebranch instead of the user's logged-in branch. Javascript bits.
Bug-11676---Loading-shelving-locations-based-on-th.patch (text/plain), 3.53 KB, created by
Olli-Antti Kivilahti
on 2014-02-05 16:33:44 UTC
(
hide
)
Description:
Bug 11676 - Loading shelving locations based on the item's homebranch instead of the user's logged-in branch. Javascript bits.
Filename:
MIME Type:
Creator:
Olli-Antti Kivilahti
Created:
2014-02-05 16:33:44 UTC
Size:
3.53 KB
patch
obsolete
>From 0892ee1b84627212009a5939807d044a0507289b Mon Sep 17 00:00:00 2001 >From: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> >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. >--- > cataloguing/additem.pl | 8 ++++++ > .../prog/en/modules/cataloguing/additem.tt | 29 ++++++++++++++++++++++ > 2 files changed, 37 insertions(+) > >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index 9942b1c..513bfc0 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -823,6 +823,10 @@ foreach my $tag ( keys %{$tagslib}){ > } > @loop_data = sort {$a->{subfield} cmp $b->{subfield} } @loop_data; > >+#These are needed to target the right <select> element to receive shelving location AJAX-updates when the homebranch is changed. >+my ($shelvingLocationMarcTag, $shelvingLocationMarcSubfield) = C4::Biblio::GetMarcFromKohaField( "items.location", $frameworkcode ); >+my ($homebranchMarcTag, $homebranchMarcSubfield) = C4::Biblio::GetMarcFromKohaField( "items.homebranch", $frameworkcode ); >+ > # what's the next op ? it's what we are not in : an add if we're editing, otherwise, and edit. > $template->param( title => $record->title() ) if ($record ne "-1"); > $template->param( >@@ -840,6 +844,10 @@ $template->param( > opisadd => ($nextop eq "saveitem") ? 0 : 1, > popup => $input->param('popup') ? 1: 0, > C4::Search::enabled_staff_search_views, >+ shelvingLocationMarcTag => $shelvingLocationMarcTag, >+ shelvingLocationMarcSubfield => $shelvingLocationMarcSubfield, >+ homebranchMarcTag => $homebranchMarcTag, >+ homebranchMarcSubfield => $homebranchMarcSubfield, > ); > $template->{'VARS'}->{'searchid'} = $searchid; > >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..b78f460 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 = '<option value="" selected="selected"></option>\n'; >+ for (var i in data) { >+ html_replacement += '<option value="'+data[i].authorised_value+'">'+data[i].lib+'</option>\n'; >+ } >+ $("select[id*='tag_[% shelvingLocationMarcTag %]_subfield_[% shelvingLocationMarcSubfield %]']").html(html_replacement); >+ } >+ }); >+} >+ >+ > $(document).ready(function(){ >+ >+ //Reload shelving location with AJAX if the "Permanent location" (homebranch) changes. >+ $("select[id*='tag_[% homebranchMarcTag %]_subfield_[% homebranchMarcSubfield %]']").change(function() { >+ reloadShelvingLocations(this.value); >+ }); >+ >+ > [% IF (popup) %] > [% IF (opisadd) %] > window.close(); >-- >1.8.1.2
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 11676
:
25034
|
25035
|
25036
|
25060
|
25061
| 25062 |
25064
|
25065
|
26796
|
26965