X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fsearch%2Felements%2Fsearch.html;h=226c4f784499669276e1833e98e0409e32615961;hp=37a3718ce2efc714a469a3a242749086345cdb85;hb=87227cd405166484ca7b791b2bd3c8829ce8d969;hpb=5cd995865b91204f7ce9233a8ba4d5eee62f9be4 diff --git a/httemplate/search/elements/search.html b/httemplate/search/elements/search.html index 37a3718ce..226c4f784 100644 --- a/httemplate/search/elements/search.html +++ b/httemplate/search/elements/search.html @@ -50,11 +50,11 @@ $header ||= $sth->{NAME}; } - if ( exists($opt{'redirect'}) && scalar(@$rows) == 1 ) { + if ( exists($opt{'redirect'}) && scalar(@$rows) == 1 && $total == 1 ) { my( $url, $method ) = @{$opt{'redirect'}}; redirect( $url. $rows->[0]->$method() ); } else { - + $opt{'name'} =~ s/s$// if $total == 1; %> <%= include( '/elements/header.html', $opt{'title'}, include( '/elements/menubar.html', 'Main menu' => $p ) @@ -87,9 +87,16 @@ <% foreach my $field ( @{$opt{'fields'}} ) { %> <% my $a = ''; %> <% if ( $links ) { - my( $url, $method ) = @{shift @$links}; - $a = $url. $row->$method(); - $a = qq(); + my $link = shift @$links; + if ( $link ) { + my( $url, $method ) = @{$link}; + if ( ref($method) eq 'CODE' ) { + $a = $url. &{$method}($row); + } else { + $a = $url. $row->$method(); + } + $a = qq(); + } } %> <% if ( ref($field) eq 'CODE' ) { %>