Upgrade Module::Install to 1.06
[manu/RT-Extension-SearchResults-XLS.git] / html / Callbacks / Results-XLS / Search / Results.html / SearchActions
index 9d83c33..b3bca55 100644 (file)
@@ -1,4 +1,27 @@
+% # Don't display this callback if our RT Version contains the new ResultsView
+% # AfterTools Callback
+% if ( $must_display ) {
 <a href="<%$RT::WebPath%>/Search/Results.xls<%$QueryString%>">XLS</a>
+% }
+<%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 );
+
+</%INIT>
 <%ARGS>
 $QueryString => undef
 </%ARGS>