fix ACL cache bug, RT#27352, fallout from RT#4696
[freeside.git] / FS / FS / access_user.pm
index c5ce1af..5b2cad8 100644 (file)
@@ -454,7 +454,7 @@ sub access_right {
     unless ( grep !exists($self->{_ACLcache}{$_}), @$rightname ) {
       warn "$me ACL cache hit for ". join(', ', @$rightname). "\n"
         if $DEBUG;
-      return grep $self->{_ACLcache}{$_}, @$rightname
+      return scalar( grep $self->{_ACLcache}{$_}, @$rightname );
     }
 
     warn "$me ACL cache miss for ". join(', ', @$rightname). "\n"
@@ -511,14 +511,16 @@ sub default_customer_view {
 
 }
 
-=item spreadsheet_format
+=item spreadsheet_format [ OVERRIDE ]
 
 Returns a hashref of this user's Excel spreadsheet download settings:
 'extension' (xls or xlsx), 'class' (Spreadsheet::WriteExcel or
-Excel::Writer::XLSX), and 'mime_type'.
+Excel::Writer::XLSX), and 'mime_type'.  If OVERRIDE is 'XLS' or 'XLSX',
+use that instead of the user's setting.
 
 =cut
 
+# is there a better place to put this?
 my %formats = (
   XLS => {
     extension => '.xls',
@@ -535,10 +537,12 @@ my %formats = (
 
 sub spreadsheet_format {
   my $self = shift;
+  my $override = shift;
 
-  my $f = $self->option('spreadsheet_format') 
-       || $conf->config('spreadsheet_format')
-       || 'XLS';
+  my $f =  $override
+        || $self->option('spreadsheet_format') 
+        || $conf->config('spreadsheet_format')
+        || 'XLS';
 
   $formats{$f};
 }