Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision e0ef8114

Von Tamino Steinert vor 12 Monaten hinzugefügt

  • ID e0ef8114478cf0cf7b1cc185d759ac2780334c2a
  • Vorgänger 3818b392
  • Nachfolger 418601dd

ZUGFeRD: Buchungsvorlage für Lieferant berücksichtigen

Unterschiede anzeigen:

bin/mozilla/ap.pl
113 113
sub load_zugferd {
114 114
  $::auth->assert('ap_transactions');
115 115

  
116
  my $file_name = $::form->{zugferd_session_file};
116
  my $file_name = $::form->{form_defaults}->{zugferd_session_file};
117
  flash('info', $::locale->text(
118
      "The ZUGFeRD/Factur-X invoice '#1' has been loaded.", $file_name));
119

  
120
  my $template_ap = SL::DB::Manager::RecordTemplate->get_first(where => [vendor_id => $::form->{form_defaults}->{vendor_id}]);
121
  if ($template_ap) {
122
    $::form->{id} = $template_ap->id;
123
    # set default values for items
124
    my $template_item = $template_ap->items->[0];
125
    my $chart = SL::DB::Chart->new(id => $template_item->chart_id)->load();
126
    my $tax = SL::DB::Tax->new(id => $template_item->tax_id)->load();
127
    foreach my $pos (1 .. $::form->{form_defautls}->{rowcount}) {
128
      $::form->{form_defautls}->{"AP_amount_chart_id_$pos"}          = $chart->id;
129
      $::form->{form_defautls}->{"previous_AP_amount_chart_id_$pos"} = $chart->id;
130
      $::form->{form_defautls}->{"taxchart_$pos"}   = $tax->id . '--' . $tax->rate;
131
      $::form->{form_defautls}->{"project_id_$pos"} = $template_item->project_id;
117 132

  
118
  # Defaults
119
  $::form->{title}      ||= "Add";
120
  $::form->{paidaccounts} = 1 if undef $::form->{paidaccounts};
133
    }
134
    $::form->{form_defaults}->{FLASH} = $::form->{FLASH}; # store flash, form gets cleared
135
    return load_record_template();
136
  } else {
137
    flash('error', $::locale->text(
138
        "No AP Record Template for vendor '#1' found.", $::form->{form_defaults}->{vendor}));
139
  }
121 140

  
141
  my $form_defaults = delete $::form->{form_defaults};
142
  $::form->{$_} = $form_defaults->{$_} for keys %{ $form_defaults // {} };
143
  $::form->{title} ||= "Add";
122 144
  $::form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_PURCHASE_INVOICE_POST())->token;
123
  flash('info', $::locale->text(
124
      "The ZUGFeRD/Factur-X invoice '#1' has been loaded.", $file_name));
125 145
  update(
126 146
    keep_rows_without_amount => 1,
127 147
    dont_add_new_row         => 1,

Auch abrufbar als: Unified diff