From c9e7b7442b08913ab3f7ae22415b42d17939e609 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 Signed-off-by: Katrin Fischer --- 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 cbac52202b..872388b317 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 79897c6cff..23b4ca6dba 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 7be043165b..ceaf8b8d57 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.5