From: Sven Schöling Date: Tue, 7 Jan 2014 11:47:43 +0000 (+0100) Subject: CsvImport: Kunden - payment und andere Daten aktualisierbar gemacht X-Git-Tag: release-3.1.0beta1~22^2~31 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=295c5bdecea7202150e7d2f921baf75171b4d18e;p=kivitendo-erp.git 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. --- diff --git a/SL/Controller/CsvImport/Base.pm b/SL/Controller/CsvImport/Base.pm index f8e9b591c..999397502 100644 --- a/SL/Controller/CsvImport/Base.pm +++ b/SL/Controller/CsvImport/Base.pm @@ -18,7 +18,7 @@ use parent qw(Rose::Object); use Rose::Object::MakeMethods::Generic ( scalar => [ qw(controller file csv test_run save_with_cascade) ], - '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) ], + '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) ], ); sub run { @@ -161,6 +161,10 @@ sub init_all_vc { vendors => SL::DB::Manager::Vendor->get_all }; } +sub init_clone_methods { + {} +} + sub force_allow_columns { return (); } @@ -385,6 +389,9 @@ sub check_payment { } $object->payment_id($terms->id); + + # register payment_id for method copying later + $self->clone_methods->{payment_id} = 1; } return 1; @@ -411,6 +418,9 @@ sub check_delivery_term { } $object->delivery_term_id($terms->id); + + # register delivery_term_id for method copying later + $self->clone_methods->{delivery_term_id} = 1; } return 1; diff --git a/SL/Controller/CsvImport/CustomerVendor.pm b/SL/Controller/CsvImport/CustomerVendor.pm index 14b67305f..946df0629 100644 --- a/SL/Controller/CsvImport/CustomerVendor.pm +++ b/SL/Controller/CsvImport/CustomerVendor.pm @@ -89,7 +89,7 @@ sub check_objects { # Update existing customer/vendor records. $entry->{object_to_save} = $existing_vc; - $existing_vc->$_( $entry->{object}->$_ ) for @{ $methods }; + $existing_vc->$_( $entry->{object}->$_ ) for @{ $methods }, keys %{ $self->clone_methods }; push @{ $entry->{information} }, $::locale->text('Updating existing entry in database'); @@ -153,6 +153,9 @@ sub check_language { } $object->language_id($language->id); + + # register language_id for method copying later + $self->clone_methods->{language_id} = 1; } return 1; @@ -179,6 +182,9 @@ sub check_business { } $object->business_id($business->id); + + # register business_id for method copying later + $self->clone_methods->{business_id} = 1; } return 1; diff --git a/SL/Controller/CsvImport/Helper/Consistency.pm b/SL/Controller/CsvImport/Helper/Consistency.pm index a666e6fe5..bf1d4c0c8 100644 --- a/SL/Controller/CsvImport/Helper/Consistency.pm +++ b/SL/Controller/CsvImport/Helper/Consistency.pm @@ -34,6 +34,9 @@ sub check_currency { } $object->currency_id($currency->id); + + # register currency_id for method copying later + $self->clone_methods->{currency_id} = 1; } # Set default currency if none was given and take_default is true.