Revision 295c5bde
Von Sven Schöling vor fast 11 Jahren hinzugefügt
SL/Controller/CsvImport/Base.pm | ||
---|---|---|
18 | 18 |
use Rose::Object::MakeMethods::Generic |
19 | 19 |
( |
20 | 20 |
scalar => [ qw(controller file csv test_run save_with_cascade) ], |
21 |
'scalar --get_set_init' => [ qw(profile displayable_columns existing_objects class manager_class cvar_columns all_cvar_configs all_languages payment_terms_by delivery_terms_by all_vc vc_by) ], |
|
21 |
'scalar --get_set_init' => [ qw(profile displayable_columns existing_objects class manager_class cvar_columns all_cvar_configs all_languages payment_terms_by delivery_terms_by all_vc vc_by clone_methods) ],
|
|
22 | 22 |
); |
23 | 23 |
|
24 | 24 |
sub run { |
... | ... | |
161 | 161 |
vendors => SL::DB::Manager::Vendor->get_all }; |
162 | 162 |
} |
163 | 163 |
|
164 |
sub init_clone_methods { |
|
165 |
{} |
|
166 |
} |
|
167 |
|
|
164 | 168 |
sub force_allow_columns { |
165 | 169 |
return (); |
166 | 170 |
} |
... | ... | |
385 | 389 |
} |
386 | 390 |
|
387 | 391 |
$object->payment_id($terms->id); |
392 |
|
|
393 |
# register payment_id for method copying later |
|
394 |
$self->clone_methods->{payment_id} = 1; |
|
388 | 395 |
} |
389 | 396 |
|
390 | 397 |
return 1; |
... | ... | |
411 | 418 |
} |
412 | 419 |
|
413 | 420 |
$object->delivery_term_id($terms->id); |
421 |
|
|
422 |
# register delivery_term_id for method copying later |
|
423 |
$self->clone_methods->{delivery_term_id} = 1; |
|
414 | 424 |
} |
415 | 425 |
|
416 | 426 |
return 1; |
SL/Controller/CsvImport/CustomerVendor.pm | ||
---|---|---|
89 | 89 |
# Update existing customer/vendor records. |
90 | 90 |
$entry->{object_to_save} = $existing_vc; |
91 | 91 |
|
92 |
$existing_vc->$_( $entry->{object}->$_ ) for @{ $methods }; |
|
92 |
$existing_vc->$_( $entry->{object}->$_ ) for @{ $methods }, keys %{ $self->clone_methods };
|
|
93 | 93 |
|
94 | 94 |
push @{ $entry->{information} }, $::locale->text('Updating existing entry in database'); |
95 | 95 |
|
... | ... | |
153 | 153 |
} |
154 | 154 |
|
155 | 155 |
$object->language_id($language->id); |
156 |
|
|
157 |
# register language_id for method copying later |
|
158 |
$self->clone_methods->{language_id} = 1; |
|
156 | 159 |
} |
157 | 160 |
|
158 | 161 |
return 1; |
... | ... | |
179 | 182 |
} |
180 | 183 |
|
181 | 184 |
$object->business_id($business->id); |
185 |
|
|
186 |
# register business_id for method copying later |
|
187 |
$self->clone_methods->{business_id} = 1; |
|
182 | 188 |
} |
183 | 189 |
|
184 | 190 |
return 1; |
SL/Controller/CsvImport/Helper/Consistency.pm | ||
---|---|---|
34 | 34 |
} |
35 | 35 |
|
36 | 36 |
$object->currency_id($currency->id); |
37 |
|
|
38 |
# register currency_id for method copying later |
|
39 |
$self->clone_methods->{currency_id} = 1; |
|
37 | 40 |
} |
38 | 41 |
|
39 | 42 |
# Set default currency if none was given and take_default is true. |
Auch abrufbar als: Unified diff
CsvImport: Kunden - payment und andere Daten aktualisierbar gemacht
Das Problem war, dass die methods für den clone in das bereits
bestehende Objekt aus den headers gesetzt wurden, und payment ist kein
direktes Headerfeld.
Wird jetzt über einen eigenen Container clone_methods gemacht.