From ce5c5aee219745d3ca996860bf57bb0a2fe5ec73 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 15 May 2024 11:51:54 +0000 Subject: [PATCH] Bug 36844: (QA follow-up) Fix preselected options on set-library.pl I found that when switching from a branch with a default register to one without, the default register for the last branch was remaining selected (though disabled) When opening the page if no desk was set (choose 'My library' on initial login) the branch was default to 'No desk' rather than defaulting to the first desk of the current branch Remove a debugging line as well Signed-off-by: Nick Clemens --- koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc | 2 +- koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt | 2 +- koha-tmpl/intranet-tmpl/prog/js/staff-global.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc index cbac52202b9..872388b3177 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc @@ -12,7 +12,7 @@ [% FOREACH d IN desks %] [% IF d.branchcode == branch %] - [% IF selected == d.desk_id %] + [% IF selected == d.desk_id || ( selected == '' && loop.first ) %] [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt index 79897c6cffa..23b4ca6dba0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt @@ -74,7 +74,7 @@
diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js index e2b9d175d9b..63cdb2ca566 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js @@ -305,7 +305,6 @@ $(document).ready(function () { $("#set-library-desk_id") .children() .each(function () { - console.log( $(this) ); if ($(this).attr("id") === "nodesk") { // set no desk by default, should be first element $(this).prop("selected", true); @@ -316,7 +315,7 @@ $(document).ready(function () { $("#nodesk").hide(); $(this).prop("disabled", false); $(this).show(); - if ( selectedBranch == $(".logged-in-branch-code").html() ) { + if ( selectedBranch == $(".logged-in-branch-code").html() && $(".logged-in-desk-id").length ) { $("#set-library-desk_id").val( $(".logged-in-desk-id").html() ); } else { $("#nodesk").hide(); @@ -330,6 +329,7 @@ $(document).ready(function () { } }); + $("#set-library-register_id").val(""); $("#set-library-register_id").children().each(function() { // default to no-register if ($(this).is("#noregister")) { -- 2.39.2