Revision d8d90989
Von Moritz Bunkus vor mehr als 2 Jahren hinzugefügt
bin/mozilla/io.pl | ||
---|---|---|
2201 | 2201 |
$::form->error($e->message); |
2202 | 2202 |
} |
2203 | 2203 |
} |
2204 |
|
|
2205 |
sub download_factur_x_xml { |
|
2206 |
my ($form) = @_; |
|
2207 |
|
|
2208 |
my $record = _make_record(); |
|
2209 |
|
|
2210 |
die if !$record |
|
2211 |
|| !$record->can('customer') |
|
2212 |
|| !$record->customer |
|
2213 |
|| !$record->can('create_pdf_a_print_options') |
|
2214 |
|| !$record->can('create_zugferd_data') |
|
2215 |
|| !$record->customer->create_zugferd_invoices_for_this_customer; |
|
2216 |
|
|
2217 |
my $xml_content = eval { $record->create_zugferd_data }; |
|
2218 |
|
|
2219 |
if (my $e = SL::X::ZUGFeRDValidation->caught) { |
|
2220 |
$::form->error($e->message); |
|
2221 |
} |
|
2222 |
|
|
2223 |
my $attachment_filename = $::form->generate_attachment_filename; |
|
2224 |
$attachment_filename =~ s{\.[^.]+$}{.xml}; |
|
2225 |
my %headers = ( |
|
2226 |
'-type' => 'application/xml', |
|
2227 |
'-connection' => 'close', |
|
2228 |
'-attachment' => $attachment_filename, |
|
2229 |
'-content-length' => length($xml_content), |
|
2230 |
); |
|
2231 |
|
|
2232 |
print $::request->cgi->header(%headers); |
|
2233 |
|
|
2234 |
$::locale->with_raw_io(\*STDOUT, sub { print $xml_content }); |
|
2235 |
} |
Auch abrufbar als: Unified diff
Verkaufsrechnungen direkt als Factur-X/ZUGFeRD-XML exportieren können