Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 5614d4b6

Von Kivitendo Admin vor fast 8 Jahren hinzugefügt

  • ID 5614d4b666816cbae6813aa41f69cfa0b2c8654a
  • Vorgänger ea1df49d
  • Nachfolger df5378aa

Part Csv Import - Umstellung auf part_type und Entfernung von income/expense_accno_id

Unterschiede anzeigen:

SL/Controller/CsvImport/Part.pm
156 156
    $self->controller->track_progress(progress => $i/$num_data * 100) if $i % 100 == 0;
157 157

  
158 158
    $self->check_buchungsgruppe($entry);
159
    $self->check_type($entry);
159
    $self->check_part_type($entry);
160 160
    $self->check_unit($entry);
161 161
    $self->check_price_factor($entry);
162 162
    $self->check_payment($entry);
......
273 273
  }
274 274

  
275 275
  if ($entry->{part}) {
276
    if ($entry->{part}->type ne $object->type ) {
276
    if ($entry->{part}->part_type ne $object->part_type ) {
277 277
      push(@{$entry->{errors}}, $::locale->text('Skipping due to existing entry in database with different type'));
278 278
      return;
279 279
    }
280
    if ( $entry->{part}->unit ne $object->unit || $entry->{part}->inventory_accno_id != $object->inventory_accno_id ) {
280
    if ( $entry->{part}->unit ne $object->unit ) {
281 281
      if ( $entry->{part}->onhand != 0 || $self->_part_is_used($entry->{part})) {
282
        push(@{$entry->{errors}}, $::locale->text('Skipping due to existing entry with different unit or inventory_accno_id'));
282
        push(@{$entry->{errors}}, $::locale->text('Skipping due to existing entry with different unit'));
283 283
        return;
284 284
      }
285 285
    }
......
404 404
  $entry->{object}->shop(1) if $self->settings->{shoparticle_if_missing} && !$self->controller->headers->{used}->{shop};
405 405
}
406 406

  
407
sub check_type {
407
sub check_part_type {
408 408
  my ($self, $entry) = @_;
409 409

  
410
  my $bg = $self->bg_by->{id}->{ $entry->{object}->buchungsgruppen_id };
411
  $bg  ||= SL::DB::Buchungsgruppe->new(inventory_accno_id => 1); # does this case ever occur?
410
  # TODO: assemblies or assortments can't be imported
411

  
412
  # my $bg = $self->bg_by->{id}->{ $entry->{object}->buchungsgruppen_id };
413
  # $bg  ||= SL::DB::Buchungsgruppe->new(inventory_accno_id => 1); # does this case ever occur?
412 414

  
413 415
  my $part_type = $self->settings->{part_type};
414 416
  if ($part_type eq 'mixed') {
......
670 672
  my ($self) = @_;
671 673

  
672 674
  my $profile = $self->SUPER::init_profile;
673
  delete @{$profile}{qw(bom expense_accno_id income_accno_id makemodel priceupdate stockable type)};
675
  delete @{$profile}{qw(bom makemodel priceupdate stockable type)};
674 676

  
675 677
  $profile->{"pricegroup_$_"} = '' for 1 .. scalar @{ $_[0]->all_pricegroups };
676 678

  

Auch abrufbar als: Unified diff