View | Details | Raw Unified | Return to bug 11676
Collapse All | Expand All

(-)a/cataloguing/additem.pl (+8 lines)
Lines 823-828 foreach my $tag ( keys %{$tagslib}){ Link Here
823
}
823
}
824
@loop_data = sort {$a->{subfield} cmp $b->{subfield} } @loop_data;
824
@loop_data = sort {$a->{subfield} cmp $b->{subfield} } @loop_data;
825
825
826
#These are needed to target the right <select> element to receive shelving location AJAX-updates when the homebranch is changed.
827
my ($shelvingLocationMarcTag, $shelvingLocationMarcSubfield) = C4::Biblio::GetMarcFromKohaField( "items.location", $frameworkcode );
828
my ($homebranchMarcTag, $homebranchMarcSubfield) = C4::Biblio::GetMarcFromKohaField( "items.homebranch", $frameworkcode );
829
826
# what's the next op ? it's what we are not in : an add if we're editing, otherwise, and edit.
830
# what's the next op ? it's what we are not in : an add if we're editing, otherwise, and edit.
827
$template->param( title => $record->title() ) if ($record ne "-1");
831
$template->param( title => $record->title() ) if ($record ne "-1");
828
$template->param(
832
$template->param(
Lines 840-845 $template->param( Link Here
840
    opisadd => ($nextop eq "saveitem") ? 0 : 1,
844
    opisadd => ($nextop eq "saveitem") ? 0 : 1,
841
    popup => $input->param('popup') ? 1: 0,
845
    popup => $input->param('popup') ? 1: 0,
842
    C4::Search::enabled_staff_search_views,
846
    C4::Search::enabled_staff_search_views,
847
	shelvingLocationMarcTag => $shelvingLocationMarcTag,
848
	shelvingLocationMarcSubfield => $shelvingLocationMarcSubfield,
849
	homebranchMarcTag => $homebranchMarcTag,
850
	homebranchMarcSubfield => $homebranchMarcSubfield,
843
);
851
);
844
$template->{'VARS'}->{'searchid'} = $searchid;
852
$template->{'VARS'}->{'searchid'} = $searchid;
845
853
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt (-1 / +29 lines)
Lines 14-20 Link Here
14
    var browser = KOHA.browser('[% searchid %]', parseInt('[% biblionumber %]', 10));
14
    var browser = KOHA.browser('[% searchid %]', parseInt('[% biblionumber %]', 10));
15
    browser.show();
15
    browser.show();
16
16
17
//Fetch the Shelving locations using AJAX
18
//Build the replacement HTML for the shelving location options
19
//Then replace the existing HTML with this.
20
function reloadShelvingLocations(homebranch) {
21
    
22
    $.ajax({
23
        url: "/cgi-bin/koha/svc/getAuthorisedValues.pl",
24
        type: "POST",
25
        dataType: 'json',
26
        data: { 'category' : 'LOC', 'branch_limit' : homebranch },
27
        success: function(data, textStatus, jqXHR) {
28
            
29
            var html_replacement = '<option value="" selected="selected"></option>\n';
30
            for (var i in data) {
31
                html_replacement += '<option value="'+data[i].authorised_value+'">'+data[i].lib+'</option>\n';
32
            }
33
            $("select[id*='tag_[% shelvingLocationMarcTag %]_subfield_[% shelvingLocationMarcSubfield %]']").html(html_replacement);
34
        }
35
    });    
36
}
37
38
17
$(document).ready(function(){
39
$(document).ready(function(){
40
    
41
    //Reload shelving location with AJAX if the "Permanent location" (homebranch) changes.
42
    $("select[id*='tag_[% homebranchMarcTag %]_subfield_[% homebranchMarcSubfield %]']").change(function() {
43
        reloadShelvingLocations(this.value);
44
    });
45
   
46
    
18
    [% IF (popup) %]
47
    [% IF (popup) %]
19
        [% IF (opisadd) %]
48
        [% IF (opisadd) %]
20
            window.close();
49
            window.close();
21
- 

Return to bug 11676