Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 3f924c0f

Von Kivitendo Admin vor etwa 8 Jahren hinzugefügt

  • ID 3f924c0fc876c2133e5ba22f25a45a484885ee0b
  • Vorgänger 4f43ec85
  • Nachfolger fea07b8e

Debitorenbuchungen als CSV importieren

Ähnlich wie der Auftragsimport wird hier gemultiplexed, d.h. es gibt separate
Zeilen für die Debitorenbuchung (ar) und die Buchungszeilen (acc_trans).

Es handelt sich allerdings nicht exakt um acc_trans-Zeilen, die direkt
als acc_trans Objekte importiert werden, sondern es können die gleichen
Informationen wie bei der Debitorenbuchung übergeben werden, also Konto,
Betrag, Steuerschlüssel und Projekt, und daraus werden dann die
acc_trans-Zeilen generiert, inklusive Steuerautomatik.

Das Forderungskonto muß in der Rechnungszeile übergeben werden, der Betrag wird
dann anhand der Buchungszeilen bestimmt.

Beispiel für Import-Format (siehe auch mehr Beispiele in t/controllers/csvimport/artransactions.t)

datatype,customer_id,taxzone_id,currency_id,invnumber,taxincluded,archart
datatype,accno,amount,taxkey
"Rechnung",960,4,1,"invoice",f,1400
"AccTransaction",8400,159.48,3

Unterschiede anzeigen:

SL/Controller/CsvImport/BaseMulti.pm
187 187
    eval "require " . $class;
188 188

  
189 189
    my %unwanted = map { ( $_ => 1 ) } (qw(itime mtime), map { $_->name } @{ $class->meta->primary_key_columns });
190

  
191
    # TODO: execeptions for AccTransaction and Invoice wh
192
    if ( $class =~ m/^SL::DB::AccTransaction/ ) {
193
      my %unwanted_acc_trans = map { ( $_ => 1 ) } (qw(acc_trans_id trans_id cleared fx_transaction ob_transaction cb_transaction itime mtime chart_link tax_id description gldate memo source transdate), map { $_->name } @{ $class->meta->primary_key_columns });
194
      @unwanted{keys %unwanted_acc_trans} = values %unwanted_acc_trans;
195
    };
196
    if ( $class =~ m/^SL::DB::Invoice/ ) {
197
      # remove fields that aren't needed / shouldn't be set for ar transaction
198
      my %unwanted_ar = map { ( $_ => 1 ) } (qw(closed currency currency_id datepaid dunning_config_id gldate invnumber_for_credit_note invoice marge_percent marge_total amount netamount paid shippingpoint shipto_id shipvia storno storno_id type cp_id), map { $_->name } @{ $class->meta->primary_key_columns });
199
      @unwanted{keys %unwanted_ar} = values %unwanted_ar;
200
    };
201

  
190 202
    my %prof;
191 203
    $prof{datatype} = '';
192 204
    for my $col ($class->meta->columns) {
......
268 280

  
269 281
  my %field_lengths_by_ri = $self->field_lengths;
270 282
  foreach my $entry (@{ $self->controller->data }) {
271
    next unless @{ $entry->{errors} };
283
    next unless defined $entry->{errors} && @{ $entry->{errors} };
272 284
    my %field_lengths = %{ $field_lengths_by_ri{ $entry->{raw_data}->{datatype} } };
273 285
    map { $entry->{object}->$_(substr($entry->{object}->$_, 0, $field_lengths{$_})) if $entry->{object}->$_ } keys %field_lengths;
274 286
  }

Auch abrufbar als: Unified diff