Make it works with RT >= 4.2.0
[manu/RT-Extension-SearchResults-ODS.git] / html / Callbacks / Results-ODS / Elements / Tabs / Privileged
index e144564..ec849a6 100644 (file)
@@ -55,12 +55,29 @@ my $query_string = sub {
     return $u->query;
 };
 
-if ( $request_path =~ qr{^/Search/Results\.html} ) {
-    my $tabs = PageMenu;
-    $tabs->child(
-        'ods' => title => loc('ODS'),
-        path => '/Search/Results.ods?' . $query_string->( %{ $m->request_args } )
-    );
+
+if (            
+     (           
+            $request_path =~ m{^/(?:Ticket|Search)/}
+         && $request_path !~ m{^/Search/Simple\.html}
+     )       
+     || (   $request_path =~ m{^/Search/Simple\.html}
+         && $DECODED_ARGS->{'q'} )
+   ) {
+    
+    my $has_query = '';
+    my $current_search = $session{"CurrentSearchHash"} || {};
+    $has_query = 1 if ( $DECODED_ARGS->{'Query'} or $current_search->{'Query'} );
+
+    if ( $has_query ) {
+        my $tabs = PageMenu;
+        my $feeds = $tabs->child('more'); 
+        
+        $feeds->child(
+            'ods' => title => loc('ODS'),
+            path => '/Search/Results.ods?' . $query_string->( %{ $m->request_args } )
+        );
+    }
 }
 
 </%INIT>