@@ -, +, @@ library page --- .../prog/en/includes/html_helpers.inc | 2 +- .../intranet-tmpl/prog/js/desk_selection.js | 27 +++++-------------- 2 files changed, 8 insertions(+), 21 deletions(-) --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc @@ -18,7 +18,7 @@ [% END %] [% ELSE %] - + [% END %] [% END %] [% END %] --- a/koha-tmpl/intranet-tmpl/prog/js/desk_selection.js +++ a/koha-tmpl/intranet-tmpl/prog/js/desk_selection.js @@ -1,22 +1,4 @@ $(document).ready(function() { - $("#desk_id").children().each(function() { - var selectedBranch = $("#branch"). children("option:selected"). val(); - if ($(this).attr('id') === "nodesk") { //set no desk by default, should be first element - $(this).prop("selected", true); - $(this).prop("disabled", false); - $(this).show(); - } - else if ($(this).hasClass(selectedBranch)) { - $('#nodesk').prop("disabled", true); // we have desk, no need for nodesk option - $('#nodesk').hide(); - $(this).prop("disabled", false); - $(this).show(); - $(this).prop("selected", true) - } else { - $(this).prop("disabled", true); - $(this).hide(); - } - }); $("#branch").on("change", function() { @@ -32,11 +14,16 @@ $(document).ready(function() { $('#nodesk').hide(); $(this).prop("disabled", false); $(this).show(); - $(this).prop("selected", true) + if ( selectedBranch == $(".logged-in-branch-code").html() ) { + $("#desk_id").val($(".logged-in-desk-id").html()); + } + else { + $("#desk_id").val($("#desk_id option:not([disabled]):first").val()); + } } else { $(this).prop("disabled", true); $(this).hide(); } }); }); -}) ; +}); --