From 025fcdc5ba61bf411ad1401ca292ee3f351d4218 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 7 Feb 2024 17:02:14 +0100 Subject: [PATCH] Bug 34478: Add 'op' to admin/marc-overlay-rules Signed-off-by: Jonathan Druart --- admin/marc-overlay-rules.pl | 16 ++++++++-------- .../prog/en/modules/admin/marc-overlay-rules.tt | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/admin/marc-overlay-rules.pl b/admin/marc-overlay-rules.pl index 73ac254d30..be2c8ac5aa 100755 --- a/admin/marc-overlay-rules.pl +++ b/admin/marc-overlay-rules.pl @@ -37,11 +37,11 @@ my $rule_from_cgi = sub { my %rule = map { $_ => scalar $cgi->param($_) } ( 'tag', 'module', - 'cud-filter', - 'cud-add', + 'filter', + 'add', 'append', 'remove', - 'cud-delete' + 'delete' ); my $id = $cgi->param('id'); @@ -66,7 +66,7 @@ my $get_rules = sub { }; my $rules = $get_rules->(); -if ($op eq 'remove' || $op eq 'doremove') { +if ($op eq 'remove' || $op eq 'cud-remove') { my @remove_ids = $input->multi_param('batchremove'); push @remove_ids, scalar $input->param('id') if $input->param('id'); if ($op eq 'remove') { @@ -76,7 +76,7 @@ if ($op eq 'remove' || $op eq 'doremove') { $rule->{'removemarked'} = 1 if exists $remove_ids{$rule->{id}}; } } - elsif ($op eq 'doremove') { + elsif ($op eq 'cud-remove') { my @remove_ids = $input->multi_param('batchremove'); push @remove_ids, scalar $input->param('id') if $input->param('id'); Koha::MarcOverlayRules->search({ id => { in => \@remove_ids } })->delete(); @@ -84,17 +84,17 @@ if ($op eq 'remove' || $op eq 'doremove') { $rules = $get_rules->(); } } -elsif ($op eq 'cud-edit') { +elsif ($op eq 'edit') { $template->param( edit => 1 ); my $id = $input->param('id'); for my $rule(@{$rules}) { if ($rule->{id} == $id) { - $rule->{'cud-edit'} = 1; + $rule->{'edit'} = 1; last; } } } -elsif ($op eq 'doedit' || $op eq 'cud-add') { +elsif ($op eq 'cud-edit' || $op eq 'cud-add') { my $rule_data = $rule_from_cgi->($input); if (!@{$errors}) { try { 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 5d1db7dfca..121f811511 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 @@ -142,8 +142,8 @@ - - + + [% END %] @@ -349,17 +349,17 @@ } $('#doremove').on('click', function(){ - doSubmit('doremove'); + doSubmit('cud-remove'); }); $('#doedit').on('click', function(){ - doSubmit('doedit', $("#doedit").attr('value')); + doSubmit('cud-edit', $("#doedit").attr('value')); }); $('#add').on('click', function(){ - doSubmit('add'); + doSubmit('cud-add'); return false; }); $('#btn_batchremove').on('click', function(){ - doSubmit('remove'); + doSubmit('cud-remove'); }); /* Disable batch remove unless one or more checkboxes are checked */ -- 2.39.5