diff options
author | Mark Wells <mark@freeside.biz> | 2012-07-13 15:33:43 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2012-07-13 15:33:43 -0700 |
commit | 8ce2c1f11378b22966ec536f11898b4708a40237 (patch) | |
tree | 6b3a23fa6c52dcd930fef9ff092f0af2de6eb137 /FS/FS/access_user.pm | |
parent | 15db7ad6e6ea2e57784368eec80e4aae54358f77 (diff) |
XLSX format for spreadsheet download, #17971
Diffstat (limited to 'FS/FS/access_user.pm')
-rw-r--r-- | FS/FS/access_user.pm | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/FS/FS/access_user.pm b/FS/FS/access_user.pm index 5d5cc12..4d72c2e 100644 --- a/FS/FS/access_user.pm +++ b/FS/FS/access_user.pm @@ -511,6 +511,38 @@ sub default_customer_view { } +=item spreadsheet_format + +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'. + +=cut + +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 $f = $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 |