From c6f1bdeeec412fa868c451370bb5e618b63bb934 Mon Sep 17 00:00:00 2001 From: Shi Yao Wang Date: Fri, 2 Dec 2022 14:39:32 -0500 Subject: [PATCH] Bug 31694: MARC overlay rules presets don't change anything if presets are translated This patch uses the text of option (which is translated) instead of the value (which is not translated) for the process. Test plan: 1. Install a new language 1.1. In a terminal, run the following commands gulp po:update cd misc/translator ./translate install xx-XX 1.2. Go to Administration > Global system preferences 1.3. Search for language 1.4. In the language syspref check the box for the language you just installed 1.5. Save 2. In the staff interface in English, go to Administration > Record overlay rules 3. In the column 'Preset' try the various options, note that the 'Added', 'Appended', 'Removed', and 'Deleted' settings change depending on the chosen preset 4. Change the interface language 5. Redo step 3, notice that if the preset name is translated, the other settings don't change 6. Apply patch 7. Redo step 3, the presets should now change the settings --- .../prog/en/modules/admin/marc-overlay-rules.tt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt index 781457643f..3f154eccfc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt @@ -452,8 +452,9 @@ var $this = $(this); var $parent_row = $this.closest('tr'); var preset = $this.val(); - if (preset) { - $.each(overlay_rules_presets[preset], function(operation, action) { + var presetText = $this.children('option[value="' + preset + '"]').text(); + if (presetText) { + $.each(overlay_rules_presets[presetText], function(operation, action) { $('select[name="' + operation + '"]', $parent_row).val(action); }); } -- 2.25.1