From d394c95770f69a16cf337b748a61308b3250bc98 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 9 Feb 2023 16:50:38 +0000 Subject: [PATCH] Bug 32933: [22.05.x] Use val() instead of attr("value") when getting field values with jQuery This patch replaces instances in Koha's templates where "attr('value')" is used to get the value of a form field, using "val()" instead. This ensures that we get the current value of the field, not just the value of the field when the page first loaded. To test, apply the patch and test the following pages: - Tools -> Tags. Use the "Check lists" form in the right-hand sidebar to test the approval status of some approved and rejected tags. It should correctly respond with the tag's status. - Cataloging -> Label creator. - New -> Printer profile. Each offset and creep field should correctly reflect the selected value in the "Units" dropdown. Changing the dropdown should make the units change accordingly. - New -> Label template. Perform the same tests as above. - Tools -> Patron card creator. - New -> Layout. If necessary, check the "Field 1" checkbox. The units should be displayed correctly and change as you change the "Units" dropdown. - New -> Printer profile, - New -> Card template: Perform the same tests as above. - Lists -> List contents. - Check that the "Add to" dropdown menu works for adding selected titles to a cart or another list. - Back record modification. Submit a batch of records for modification and go to Administration -> Manage jobs. - View the details of the job you just submitted. - Confirm that the "Add modified records to the following list" dropdown works correctly. - Cataloging -> Find a bibliographic record -> Edit items. - Confirm that clicking a cell in the table of existing items triggers the "Edit item/Delete item" menu, and that these links work correctly. Works as described. Signed-off-by: Alex Buckley Signed-off-by: Katrin Fischer Signed-off-by: Lucas Gass --- .../background_jobs/batch_biblio_record_modification.inc | 2 +- .../prog/en/modules/acqui/duplicate_orders.tt | 2 +- .../prog/en/modules/labels/label-edit-profile.tt | 2 +- .../prog/en/modules/labels/label-edit-template.tt | 2 +- .../prog/en/modules/patroncards/edit-layout.tt | 2 +- .../prog/en/modules/patroncards/edit-profile.tt | 2 +- .../prog/en/modules/patroncards/edit-template.tt | 2 +- .../prog/en/modules/virtualshelves/shelves.tt | 8 ++++---- koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js | 2 +- koha-tmpl/intranet-tmpl/prog/js/pages/tags-review.js | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_biblio_record_modification.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_biblio_record_modification.inc index e766e78adf..534c9a9522 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_biblio_record_modification.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_biblio_record_modification.inc @@ -54,7 +54,7 @@ $("#add_bibs_to_list").change(function(){ var selected = $("#add_bibs_to_list").find("option:selected"); if ( selected.attr("class") == "shelf" ){ - var shelfnumber = selected.attr("value"); + var shelfnumber = selected.val(); var bibs = new Array(); [% FOREACH message IN job.messages %] [% IF message.code == 'biblio_modified' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicate_orders.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicate_orders.tt index 8bb5e07d85..c8e1669f61 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicate_orders.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicate_orders.tt @@ -397,7 +397,7 @@ Acquisitions › Koha $("#batch_edit_form").on("submit", function(e){ var budget_value_will_be_reused = $("input[name='copy_existing_value'][value='budget_id']").is(':checked'); if ( ! budget_value_will_be_reused ) { - if ($("#all_budget_id").find("option:selected").attr("value") == "" ) { + if ($("#all_budget_id").find("option:selected").val() == "" ) { alert(MSG_NO_FUND_SELECTED); e.preventDefault(); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-profile.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-profile.tt index 48073db2f9..97fad09cd0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-profile.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-profile.tt @@ -146,7 +146,7 @@ [% Asset.js("js/tools-menu.js") | $raw %]