Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d8d90989

Von Moritz Bunkus vor fast 3 Jahren hinzugefügt

  • ID d8d909892ba302d142df9430786242502fa437fe
  • Vorgänger c2e12394
  • Nachfolger 42a10479

Verkaufsrechnungen direkt als Factur-X/ZUGFeRD-XML exportieren können

Unterschiede anzeigen:

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
}
bin/mozilla/is.pl
276 276
}
277 277

  
278 278
sub setup_is_action_bar {
279
  my ($tmpl_var)              = @_;
279 280
  my $form                    = $::form;
280 281
  my $change_never            = $::instance_conf->get_is_changeable == 0;
281 282
  my $change_on_same_day_only = $::instance_conf->get_is_changeable == 2 && ($form->current_date(\%::myconfig) ne $form->{gldate});
282 283
  my $payments_balanced       = ($::form->{oldtotalpaid} == 0);
283 284
  my $has_storno              = ($::form->{storno} && !$::form->{storno_id});
284 285
  my $may_edit_create         = $::auth->assert('invoice_edit', 1);
286
  my $factur_x_enabled        = $tmpl_var->{invoice_obj} && $tmpl_var->{invoice_obj}->customer->create_zugferd_invoices_for_this_customer;
285 287
  my ($is_linked_bank_transaction, $warn_unlinked_delivery_order);
286 288
    if ($::form->{id}
287 289
        && SL::DB::Default->get->payments_changeable != 0
......
423 425
                    : $form->{postal_invoice} ? t8('This customer wants a postal invoices.')
424 426
                    :                     undef,
425 427
        ],
428
        action => [ t8('Factur-X/ZUGFeRD'),
429
          submit   => [ '#form', { action => "download_factur_x_xml" } ],
430
          checks   => [ 'kivi.validate_form' ],
431
          disabled => !$may_edit_create  ? t8('You must not print this invoice.')
432
                    : !$form->{id}       ? t8('This invoice has not been posted yet.')
433
                    : !$factur_x_enabled ? t8('Creating Factur-X/ZUGFeRD invoices is not enabled for this customer.')
434
                    :                      undef,
435
        ],
426 436
      ], # end of combobox "Export"
427 437

  
428 438
      combobox => [
......
562 572
  $TMPL_VAR{payment_terms_obj} = get_payment_terms_for_invoice();
563 573
  $form->{duedate}             = $TMPL_VAR{payment_terms_obj}->calc_date(reference_date => $form->{invdate}, due_date => $form->{duedate})->to_kivitendo if $TMPL_VAR{payment_terms_obj};
564 574

  
565
  setup_is_action_bar();
575
  setup_is_action_bar(\%TMPL_VAR);
566 576

  
567 577
  $form->header();
568 578

  
js/locale/de.js
89 89
"July":"Juli",
90 90
"Jun":"Jun",
91 91
"June":"Juni",
92
"Leading and trailing whitespaces have been removed.":"",
92 93
"Loading...":"Wird geladen...",
93 94
"Map":"Karte",
94 95
"Mar":"März",
locale/de/all
822 822
  'Created for'                 => 'Erstellt für',
823 823
  'Created on'                  => 'Erstellt am',
824 824
  'Creating Documents'          => 'Erzeuge Dokumente',
825
  'Creating Factur-X/ZUGFeRD invoices is not enabled for this customer.' => 'Das Erzeugen von Factur-X/ZUGFeRD-Rechnungen ist für diesen Kunden nicht aktiviert.',
825 826
  'Creating invoices'           => 'Erzeuge Rechnungen',
826 827
  'Creating the PDF failed:'    => 'PDF-Erzeugung fehlgeschlagen:',
827 828
  'Creation Date'               => 'Erstelldatum',
......
1501 1502
  'Extended status'             => 'Erweiterter Status',
1502 1503
  'Extension Of Time'           => 'Dauerfristverlängerung',
1503 1504
  'Factor'                      => 'Faktor',
1505
  'Factur-X/ZUGFeRD'            => 'Factur-X/ZUGFeRD',
1504 1506
  'Factur-X/ZUGFeRD import'     => 'Factur-X-/ZUGFeRD-Import',
1505 1507
  'Factur-X/ZUGFeRD invoice'    => 'Factur-X-/ZUGFeRD-Rechnung',
1506 1508
  'Factur-X/ZUGFeRD notes for each invoice' => 'Factur-X-/ZUGFeRD-Notizen für jede Rechnung',
......
1933 1935
  'Lastcost'                    => 'Einkaufspreis',
1934 1936
  'Lastcost (with X being a number)' => 'Einkaufspreis (X ist eine fortlaufende Zahl)',
1935 1937
  'Lastname'                    => 'Nachname',
1938
  'Leading and trailing whitespaces have been removed.' => 'Leerzeichen wurden vorne und hinten entfernt',
1936 1939
  'Left'                        => 'Links',
1937 1940
  'Letter'                      => 'Brief',
1938 1941
  'Letter Draft'                => 'Briefentwurf',
locale/en/all
822 822
  'Created for'                 => '',
823 823
  'Created on'                  => '',
824 824
  'Creating Documents'          => '',
825
  'Creating Factur-X/ZUGFeRD invoices is not enabled for this customer.' => '',
825 826
  'Creating invoices'           => '',
826 827
  'Creating the PDF failed:'    => '',
827 828
  'Creation Date'               => '',
......
1501 1502
  'Extended status'             => '',
1502 1503
  'Extension Of Time'           => '',
1503 1504
  'Factor'                      => '',
1505
  'Factur-X/ZUGFeRD'            => '',
1504 1506
  'Factur-X/ZUGFeRD import'     => '',
1505 1507
  'Factur-X/ZUGFeRD invoice'    => '',
1506 1508
  'Factur-X/ZUGFeRD notes for each invoice' => '',

Auch abrufbar als: Unified diff