From 65747df170a47fcb095ced8317c6787700ec4d9b 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) Signed-off-by: David Nind Signed-off-by: Jan Kissig Signed-off-by: Julian Maurice --- .../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 7a6064a1356..d7615eb43b2 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.30.2