X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Faccess_user.pm;h=509cc09505abfd065d9a4ceb05362ea35451069d;hb=7b5a266236857fbb4bbf8d4ac3031c3fec75cac2;hp=075733a6861a0cfecfef4732607f096eb8d83bb2;hpb=fb4ab1073f0d15d660c6cdc4e07afebf68ef3924;p=freeside.git diff --git a/FS/FS/access_user.pm b/FS/FS/access_user.pm index 075733a68..509cc0950 100644 --- a/FS/FS/access_user.pm +++ b/FS/FS/access_user.pm @@ -498,7 +498,7 @@ sub access_right { Returns the default customer view for this user, from the "default_customer_view" user preference, the "cust_main-default_view" config, -or the hardcoded default, "jumbo" (may change to "basics" in the near future). +or the hardcoded default, "basics" (formerly "jumbo" prior to 3.0). =cut @@ -507,10 +507,46 @@ sub default_customer_view { $self->option('default_customer_view') || $conf->config('cust_main-default_view') - || 'jumbo'; #'basics' in 1.9.1? + || 'basics'; #s/jumbo/basics/ starting with 3.0 } +=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'. 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', + class => 'Spreadsheet::WriteExcel', + mime_type => 'application/vnd.ms-excel', + }, + XLSX => { + extension => '.xlsx', + class => 'Excel::Writer::XLSX', + mime_type => # it's on wikipedia, it must be true + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + } +); + +sub spreadsheet_format { + my $self = shift; + my $override = shift; + + my $f = $override + || $self->option('spreadsheet_format') + || $conf->config('spreadsheet_format') + || 'XLS'; + + $formats{$f}; +} + =item is_system_user Returns true if this user has the name of a known system account. These