From e758f4015b0cfb23237d497f6fad4940dae84390 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 26 Jan 2016 15:21:06 +0000 Subject: [PATCH] Bug 15669 - alphabetize marc modification templtes This patch sorts the mdofication templates lists before passing them into templates in the three places they are used tools/batch_record_modification.pl tools/marc_modification.pl tools/stage-marc-import.pl To test: 1 - Add some marc modification templates in a non alpha order (Shoes, Hats, Cats) 2 - visit the three pages above and note the templates are in order added 3 - apply patch 4 - visit the three pages and note correct order 5 - verify all tools continue to work as expected --- tools/batch_record_modification.pl | 1 + tools/marc_modification_templates.pl | 2 ++ tools/stage-marc-import.pl | 1 + 3 files changed, 4 insertions(+) diff --git a/tools/batch_record_modification.pl b/tools/batch_record_modification.pl index 2f33fbb..0b0b5b3 100755 --- a/tools/batch_record_modification.pl +++ b/tools/batch_record_modification.pl @@ -67,6 +67,7 @@ if ( $completedJobID ) { } my @templates = GetModificationTemplates( $mmtid ); +@templates = sort { lc $a->{name} cmp lc $b->{name} } @templates; unless ( @templates ) { $op = 'error'; $template->param( diff --git a/tools/marc_modification_templates.pl b/tools/marc_modification_templates.pl index 10589e4..18eacf2 100755 --- a/tools/marc_modification_templates.pl +++ b/tools/marc_modification_templates.pl @@ -118,6 +118,8 @@ unless ( $template_id ) { @templates = GetModificationTemplates( $template_id ); } +@templates = sort { lc $a->{name} cmp lc $b->{name} } @templates; + my @actions = GetModificationTemplateActions( $template_id ); foreach my $action ( @actions ) { $action->{'action_delete_field'} = ( $action->{'action'} eq 'delete_field' ); diff --git a/tools/stage-marc-import.pl b/tools/stage-marc-import.pl index 8d94cdd..d2c085b 100755 --- a/tools/stage-marc-import.pl +++ b/tools/stage-marc-import.pl @@ -203,6 +203,7 @@ if ($completedJobID) { $template->param( available_matchers => \@matchers ); my @templates = GetModificationTemplates(); + @templates = sort { lc $a->{name} cmp lc $b->{name} } @templates; $template->param( MarcModificationTemplatesLoop => \@templates ); if ( C4::Context->preference('UseKohaPlugins') && -- 2.1.4