[Rt-commit] rt branch, 5.0/search-prefs-tickets-only, created. rt-5.0.1-441-gd7dc6b4ebe

Jim Brandt jbrandt at bestpractical.com
Fri Jun 11 13:59:30 EDT 2021


The branch, 5.0/search-prefs-tickets-only has been created
        at  d7dc6b4ebed845ffea2f33b192cd6668ac636411 (commit)

- Log -----------------------------------------------------------------
commit d7dc6b4ebed845ffea2f33b192cd6668ac636411
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri Jun 11 13:49:18 2021 -0400

    Load user-level search preferences for ticket searches only
    
    User-level search preferences available at Logged in as >
    Settings > Search options were originally created for ticket
    searches only. RT 5 added transaction and asset searches which
    won't have the same column maps as tickets, leading to errors
    in search results such as "LastUpdated Unimplemented in RT::Record".
    
    Load personal search settings only for tickets to avoid these
    errors.

diff --git a/share/html/Search/Build.html b/share/html/Search/Build.html
index 678acaa453..dc576ba52b 100644
--- a/share/html/Search/Build.html
+++ b/share/html/Search/Build.html
@@ -181,7 +181,11 @@ if ( $NewQuery ) {
 { # Attempt to load what we can from the session and preferences, set defaults
 
     my $current = $session{$hash_name};
-    my $prefs = $session{'CurrentUser'}->UserObj->Preferences("SearchDisplay") || {};
+    my $prefs;
+    if ( $Class eq 'RT::Tickets' ) {
+        # User-level search preferences currently apply only to tickets
+        $prefs = $session{'CurrentUser'}->UserObj->Preferences("SearchDisplay") || {};
+    }
     my %orderby = (
         'RT::Tickets'      => RT->Config->Get('DefaultSearchResultOrderBy'),
         'RT::Transactions' => RT->Config->Get('TransactionDefaultSearchResultOrderBy')->{$ObjectType},
@@ -204,7 +208,9 @@ if ( $NewQuery ) {
 
     for( qw(Query Format OrderBy Order RowsPerPage ObjectType) ) {
         $query{$_} = $current->{$_} unless defined $query{$_};
-        $query{$_} = $prefs->{$_} unless defined $query{$_};
+        if ( $prefs ) {
+            $query{$_} = $prefs->{$_} unless defined $query{$_};
+        }
         $query{$_} = $default->{$_} unless defined $query{$_};
     }
 

-----------------------------------------------------------------------


More information about the rt-commit mailing list