From ff039a072fc68dc3a4ffe1f27a0ac6dcd19ecfc0 Mon Sep 17 00:00:00 2001 From: Kevin Carnes Date: Thu, 13 Apr 2023 15:20:02 +0200 Subject: [PATCH] Bug 31694: (follow-up) Use values for operations to avoid translation issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To test: * Try adding a preset rule that has an operation with different translations for the column and the pull down (e.g. Outrepasser for fr-CA) * Without the patch it appears as Custom (e.g. Personnalisé) * With the patch it appears correctly (e.g. Outrepasser) --- .../en/modules/admin/marc-overlay-rules.tt | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 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 ef0672f737..19cbd570f6 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 @@ -263,10 +263,10 @@ [% rule.tag | html %] - [% IF rule.add %]Add[% ELSE %]Skip[% END %] - [% IF rule.append %]Append[% ELSE %]Skip[% END %] - [% IF rule.remove %]Remove[% ELSE %]Skip[% END %] - [% IF rule.delete %]Delete[% ELSE %]Skip[% END %] + [% IF rule.add %]Add[% ELSE %]Skip[% END %] + [% IF rule.append %]Append[% ELSE %]Skip[% END %] + [% IF rule.remove %]Remove[% ELSE %]Skip[% END %] + [% IF rule.delete %]Delete[% ELSE %]Skip[% END %] Delete Edit @@ -430,13 +430,6 @@ 'delete': 0 }; - var overlay_rules_label_to_value = {}; - overlay_rules_label_to_value[_("Add")] = 1; - overlay_rules_label_to_value[_("Append")] = 1; - overlay_rules_label_to_value[_("Remove")] = 1; - overlay_rules_label_to_value[_("Delete")] = 1; - overlay_rules_label_to_value[_("Skip")] = 0; - function hash_config(config) { return JSON.stringify(config, Object.keys(config).sort()); } @@ -456,10 +449,10 @@ var operations_config = {}; $('.rule-operation-action', $this).each(function() { var $operation = $(this); - operations_config[$operation.data('operation')] = overlay_rules_label_to_value[$operation.text()]; + operations_config[$operation.data('operation')] = $operation.data('value'); }); $('.rule-preset', $this).text( - $('option[value="' + operations_config_overlay_rule_preset(operations_config) + '"]').text() || _("Custom") + $('select[name="preset"] option[value="' + operations_config_overlay_rule_preset(operations_config) + '"]').text() ); }); -- 2.34.1