Revision 6759902a
Von Moritz Bunkus vor mehr als 13 Jahren hinzugefügt
SL/Controller/CsvImport.pm | ||
---|---|---|
67 | 67 |
$self->redirect_to(action => 'new', 'profile.type' => $self->type); |
68 | 68 |
} |
69 | 69 |
|
70 |
sub action_download_sample { |
|
71 |
my $self = shift; |
|
72 |
|
|
73 |
$self->profile_from_form; |
|
74 |
$self->setup_help; |
|
75 |
|
|
76 |
my $file_name = 'csv_import_sample_' . $self->type . '.csv'; |
|
77 |
my $file = SL::SessionFile->new($file_name, mode => '>', encoding => $self->profile->get('charset')); |
|
78 |
my $csv = Text::CSV_XS->new({ binary => 1, map { ( $_ => $self->profile->get($_) ) } qw(sep_char escape_char quote_char),}); |
|
79 |
|
|
80 |
$csv->print($file->fh, [ map { $_->{name} } @{ $self->displayable_columns } ]); |
|
81 |
$file->fh->print("\r\n"); |
|
82 |
$csv->print($file->fh, [ map { $_->{description} } @{ $self->displayable_columns } ]); |
|
83 |
$file->fh->print("\r\n"); |
|
84 |
|
|
85 |
$file->fh->close; |
|
86 |
|
|
87 |
$self->send_file($file->file_name); |
|
88 |
} |
|
89 |
|
|
70 | 90 |
# |
71 | 91 |
# filters |
72 | 92 |
# |
locale/de/all | ||
---|---|---|
614 | 614 |
'Documents in the WebDAV repository' => 'Dokumente im WebDAV-Repository', |
615 | 615 |
'Done' => 'Fertig', |
616 | 616 |
'Download SEPA XML export file' => 'SEPA-XML-Exportdatei herunterladen', |
617 |
'Download sample file' => 'Beispieldatei herunterladen', |
|
617 | 618 |
'Download the backup' => 'Die Sicherungsdatei herunterladen', |
618 | 619 |
'Draft saved.' => 'Entwurf gespeichert.', |
619 | 620 |
'Drawing' => 'Zeichnung', |
templates/webpages/csv_import/form.html | ||
---|---|---|
85 | 85 |
</p> |
86 | 86 |
[%- END %] |
87 | 87 |
|
88 |
<p> |
|
89 |
[%- L.submit_tag('action_download_sample', LxERP.t8('Download sample file')) %] |
|
90 |
</p> |
|
91 |
|
|
88 | 92 |
</div> |
89 | 93 |
|
90 | 94 |
<hr> |
Auch abrufbar als: Unified diff
Beispieldatei bei CSV-Import herunterladen