From 295c5bdecea7202150e7d2f921baf75171b4d18e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Tue, 7 Jan 2014 12:47:43 +0100 Subject: [PATCH] CsvImport: Kunden - payment und andere Daten aktualisierbar gemacht MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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. --- SL/Controller/CsvImport/Base.pm | 12 +++++++++++- SL/Controller/CsvImport/CustomerVendor.pm | 8 +++++++- SL/Controller/CsvImport/Helper/Consistency.pm | 3 +++ 3 files changed, 21 insertions(+), 2 deletions(-) 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. -- 2.20.1