Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 81379539

Von Moritz Bunkus vor mehr als 13 Jahren hinzugefügt

  • ID 81379539e7f75fc6f886057176f8a51ebb8f9cf4
  • Vorgänger 07ad0fee
  • Nachfolger 8d87ea57

Artikelimport bisher

Unterschiede anzeigen:

SL/Controller/CsvImport.pm
8 8
use SL::SessionFile;
9 9
use SL::Controller::CsvImport::Contact;
10 10
use SL::Controller::CsvImport::CustomerVendor;
11
use SL::Controller::CsvImport::Part;
11 12
use SL::Controller::CsvImport::Shipto;
12 13

  
13 14
use List::MoreUtils qw(none);
......
143 144
    return $self->action_new;
144 145
  }
145 146

  
146
  my $worker = $self->{type} eq 'customers_vendors' ? SL::Controller::CsvImport::CustomerVendor->new(controller => $self, file => $file)
147
             : $self->{type} eq 'contacts'          ? SL::Controller::CsvImport::Contact->new(       controller => $self, file => $file)
148
             : $self->{type} eq 'addresses'         ? SL::Controller::CsvImport::Shipto->new(        controller => $self, file => $file)
149
             :                                        die "Program logic error";
150

  
147
  my $worker = $self->create_worker($file);
151 148
  $worker->run;
152 149
  $worker->save_objects if !$params{test};
153 150

  
......
194 191
    push @settings, { key => "${type}_char", value => $char };
195 192
  }
196 193

  
194
  if ($self->type eq 'parts') {
195
    $::form->{settings}->{sellprice_adjustment} = $::form->parse_amount(\%::myconfig, $::form->{settings}->{sellprice_adjustment});
196
  }
197

  
197 198
  delete $::form->{profile}->{id};
198 199
  $self->profile($existing_profile || SL::DB::CsvImportProfile->new);
199 200
  $self->profile->assign_attributes(%{ $::form->{profile} });
......
222 223
  return "csv-import-" . $self->type . ".csv";
223 224
}
224 225

  
226
sub create_worker {
227
  my ($self, $file) = @_;
228

  
229
  return $self->{type} eq 'customers_vendors' ? SL::Controller::CsvImport::CustomerVendor->new(controller => $self, file => $file)
230
       : $self->{type} eq 'contacts'          ? SL::Controller::CsvImport::Contact->new(       controller => $self, file => $file)
231
       : $self->{type} eq 'addresses'         ? SL::Controller::CsvImport::Shipto->new(        controller => $self, file => $file)
232
       : $self->{type} eq 'parts'             ? SL::Controller::CsvImport::Part->new(          controller => $self, file => $file)
233
       :                                        die "Program logic error";
234
}
235

  
225 236
1;

Auch abrufbar als: Unified diff