Fix crash when there is no UserDetailsAttributes setting
[manu/RT-Extension-UserDetails.git] / html / Elements / ShowUserDetails
index 0e756bd..de5cbfe 100644 (file)
@@ -22,8 +22,11 @@ my $url = RT->Config->Get('WebPath') ."/Helpers/Toggle/UserDetails?id=". $id;
 # Default Attributes to display
 # SortOrder => { AttributeName => '',
 #                DisplayName   => '', }
-unless ( RT->Config->Get('UserDetailsAttributes') ) {
-    RT->Config->Set('UserDetailsAttributes',
+my %attributes;
+if ( RT->Config->Get('UserDetailsAttributes') ) {
+    %attributes = RT->Config->Get('UserDetailsAttributes');
+} else {
+    %attributes = ( 
         1 => { AttributeName => 'RealName',
                DisplayName => 'Real Name',
              },
@@ -32,14 +35,10 @@ unless ( RT->Config->Get('UserDetailsAttributes') ) {
              },
         3 => { AttributeName => 'Organization',
                DisplayName => 'Organization',
-             },
+             }, 
         );
 }
 
-my %attributes = RT->Config->Get('UserDetailsAttributes');
-
-
-
 my $User;
 
 # Load User only if needed