Bug 25444: Simplify the code using a loop
[koha-ffzg.git] / admin / sru_modmapping.pl
index d5ef116..80d284c 100755 (executable)
@@ -26,18 +26,20 @@ use C4::Output;
 
 my $input = new CGI;
 my $mapstr = $input->param('mapping')//'';
+my $type = $input->param('type')//'';
 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( {
-    template_name => "admin/sru_modmapping.tt",
+    template_name => $type eq "authority" ? "admin/sru_modmapping_auth.tt" : "admin/sru_modmapping.tt",
     query => $input,
     type => "intranet",
     authnotrequired => 0,
+    flagsrequired   => { parameters => 'manage_search_targets' },
 });
 
 # Main code: convert mapping string to hash structure and show template
 
 my %map;
 foreach my $singlemap ( split ',', $mapstr ) {
-    my @temp = split '=', $singlemap;
+    my @temp = split '=', $singlemap, 2;
     $map{ $temp[0] } = $temp[1] if @temp>1;
 }
 $template->param( mapping => \%map );