From: Emmanuel Lacour Date: Tue, 10 Feb 2009 11:04:43 +0000 (+0100) Subject: Copy cmp_version from 3.8 branch as it's not present in old versions. X-Git-Tag: 0.05~1 X-Git-Url: http://git.home-dn.net/?p=manu%2FRT-Extension-SearchResults-XLS.git;a=commitdiff_plain;h=ee8787e39c776489e8748f3ae2dab3b8a0026da2 Copy cmp_version from 3.8 branch as it's not present in old versions. --- diff --git a/html/Callbacks/Results-XLS/Search/Results.html/SearchActions b/html/Callbacks/Results-XLS/Search/Results.html/SearchActions index b8bb004..b3bca55 100644 --- a/html/Callbacks/Results-XLS/Search/Results.html/SearchActions +++ b/html/Callbacks/Results-XLS/Search/Results.html/SearchActions @@ -1,8 +1,27 @@ % # Don't display this callback if our RT Version contains the new ResultsView % # AfterTools Callback -% if (RT::Handle::cmp_version( '3.8.1', $RT::VERSION ) > 0 ) { +% if ( $must_display ) { XLS % } +<%INIT> +my $must_display = 0; + +# cmp_version is present only since 3.8.0 +sub cmp_version($$) { + my ($a, $b) = (@_); + my @a = split /[^0-9]+/, $a; + my @b = split /[^0-9]+/, $b; + for ( my $i = 0; $i < @a; $i++ ) { + return 1 unless defined $b[$i]; + return $a[$i] <=> $b[$i] if $a[$i] <=> $b[$i]; + } + return 0 if @a == @b; + return -1; +} + +$must_display = ( cmp_version( '3.8.1', $RT::VERSION ) > 0 ); + + <%ARGS> $QueryString => undef