Bug 28847: Only apply JS to branch/multibranch selection if there are search groups

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Nick Clemens 2021-08-13 19:48:48 +00:00 committed by Jonathan Druart
parent 065ec4e726
commit 109bbcf242

View file

@ -455,23 +455,25 @@
[% Asset.js("lib/jquery/plugins/jquery.deserialize.min.js") | $raw %]
[% Asset.js("lib/jquery/plugins/jquery.cookie.min.js") | $raw %]
<script>
function branch_limit() {
if( $("#branchloop").val() != "" ){
$("#categoryloop").val("").prop('disabled',true);
} else {
$("#categoryloop").prop('disabled',false);
}
if ( $("#categoryloop").val() != "" ){
$("#branchloop").val("").prop('disabled',true);
} else {
$("#branchloop").prop('disabled',false);
}
}
$(document).ready(function() {
branch_limit();
$("#branchloop,#categoryloop").on("change",function(){
[% IF search_groups %]
function branch_limit() {
if( $("#branchloop").val() != "" ){
$("#categoryloop").val("").prop('disabled',true);
} else {
$("#categoryloop").prop('disabled',false);
}
if ( $("#categoryloop").val() != "" ){
$("#branchloop").val("").prop('disabled',true);
} else {
$("#branchloop").prop('disabled',false);
}
}
branch_limit();
});
$("#branchloop,#categoryloop").on("change",function(){
branch_limit();
});
[% END %]
$('#advsearches').tabs();
jQuery.cookie.json = true;