Revision 91e4c0dc
Von Thomas Heck vor etwa 12 Jahren hinzugefügt
SL/Controller/CsvImport/CustomerVendor.pm | ||
---|---|---|
7 | 7 |
use SL::DB::CustomVariable; |
8 | 8 |
use SL::DB::CustomVariableConfig; |
9 | 9 |
use SL::DB::PaymentTerm; |
10 |
use SL::TransNumber; |
|
10 | 11 |
|
11 | 12 |
use parent qw(SL::Controller::CsvImport::Base); |
12 | 13 |
|
... | ... | |
167 | 168 |
my $with_number = [ grep { $_->{object}->$numbercolumn ne '####' } @{ $self->controller->data } ]; |
168 | 169 |
my $without_number = [ grep { $_->{object}->$numbercolumn eq '####' } @{ $self->controller->data } ]; |
169 | 170 |
|
170 |
map { $_->{object}->$numbercolumn('') } @{ $without_number }; |
|
171 |
foreach my $entry (@{$with_number}, @{$without_number}) { |
|
172 |
my $object = $entry->{object}; |
|
173 |
|
|
174 |
my $number = SL::TransNumber->new(type => $self->table(), |
|
175 |
number => $object->$numbercolumn(), |
|
176 |
business_id => $object->business_id(), |
|
177 |
save => 1); |
|
178 |
|
|
179 |
if ( $object->$numbercolumn eq '####' || !$number->is_unique() ) { |
|
180 |
$object->$numbercolumn($number->create_unique()); |
|
181 |
} |
|
182 |
} |
|
171 | 183 |
|
172 | 184 |
$self->SUPER::save_objects(data => $with_number); |
173 | 185 |
$self->SUPER::save_objects(data => $without_number); |
Auch abrufbar als: Unified diff
CSV-Kunden-/Lieferantenimport: Verwendung von TransNumber zur Erzeugung von Nummern
implementiert #1972