@@ -, +, @@
- Create some matching rule
- Have free text values on the 'Normalization rule' field
- Apply the patches
- Create a new routine
- Save the rule
- Open it for editing
- Edit the original free-text including rule
- Sign off :-D
saving the matching rule will overwrite those, with 'none'.
---
admin/matching-rules.pl | 10 ++-
.../prog/en/modules/admin/matching-rules.tt | 96 ++++++++++++++++++----
2 files changed, 85 insertions(+), 21 deletions(-)
--- a/admin/matching-rules.pl
+++ a/admin/matching-rules.pl
@@ -26,7 +26,7 @@ use C4::Auth;
use C4::Context;
use C4::Output;
use C4::Koha;
-use C4::Matcher;
+use C4::Matcher qw/valid_normalization_routines/;
my $script_name = "/cgi-bin/koha/admin/matching-rules.pl";
@@ -47,8 +47,12 @@ $template->param(script_name => $script_name);
my $matcher_id = $input->param("matcher_id");
-$template->param(max_matchpoint => 0);
-$template->param(max_matchcheck => 0);
+$template->param( max_matchpoint => 0 );
+$template->param( max_matchcheck => 0 );
+my @valid_norms = C4::Matcher::valid_normalization_routines();
+unshift @valid_norms, 'none';
+$template->param( valid_norms => \@valid_norms );
+
my $display_list = 0;
if ($op eq "edit_matching_rule") {
edit_matching_rule_form($template, $matcher_id);
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/matching-rules.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/matching-rules.tt
@@ -13,6 +13,39 @@
[% INCLUDE 'doc-head-close.inc' %]
+[% BLOCK norms_text %]
+[% SWITCH norm %]
+[% CASE 'none' %]None
+[% CASE 'remove_spaces' %]Remove spaces
+[% CASE 'upper_case' %]Uppercase
+[% CASE 'lower_case' %]Lowercase
+[% CASE 'legacy_default' %]Legacy default
+[% CASE %][% norm %]
+[% END %]
+[% END %]
+
+[% BLOCK norms_options %]
+[%# PARAMS: selected_norm %]
+[% FOREACH norm IN valid_norms %]
+[% IF ( norm == selected_norm ) %]
+
+[% ELSE %]
+
+[% END %]
+[% END %]
+[% END %]
+
+[% BLOCK norms_select %]
+[%# PARAMS: selected_norm, id, name %]
+[% UNLESS valid_norms.grep(selected_norm).size %]
+[%# Fallback to 'none' %]
+[% selected_norm = 'none' %]
+[% END %]
+
+[% END %]
+