From: Sven Schöling Date: Fri, 16 Nov 2012 17:27:13 +0000 (+0100) Subject: progress tracking für andere imports X-Git-Tag: release-3.1.0beta1~720 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=169357af8aab17e151f64de9321a2a34735cb07b;p=kivitendo-erp.git progress tracking für andere imports --- diff --git a/SL/Controller/CsvImport/Contact.pm b/SL/Controller/CsvImport/Contact.pm index b707ae8f8..93a55bf1f 100644 --- a/SL/Controller/CsvImport/Contact.pm +++ b/SL/Controller/CsvImport/Contact.pm @@ -27,11 +27,19 @@ sub init_all_cvar_configs { sub check_objects { my ($self) = @_; + $self->controller->track_progress(phase => 'building data', progress => 0); + + my $i; + my $num_data = scalar @{ $self->controller->data }; foreach my $entry (@{ $self->controller->data }) { + $self->controller->track_progress(progress => $i/$num_data * 100) if $i % 100 == 0; + $self->check_name($entry); $self->check_vc($entry, 'cp_cv_id'); $self->check_gender($entry); $self->handle_cvars($entry); + } continue { + $i++; } $self->add_info_columns({ header => $::locale->text('Customer/Vendor'), method => 'vc_name' }); @@ -116,4 +124,4 @@ sub setup_displayable_columns { ); } -1; \ No newline at end of file +1; diff --git a/SL/Controller/CsvImport/CustomerVendor.pm b/SL/Controller/CsvImport/CustomerVendor.pm index 41234bfee..757c52c5d 100644 --- a/SL/Controller/CsvImport/CustomerVendor.pm +++ b/SL/Controller/CsvImport/CustomerVendor.pm @@ -47,10 +47,15 @@ sub init_languages_by { sub check_objects { my ($self) = @_; + $self->controller->track_progress(phase => 'building data', progress => 0); + my $numbercolumn = $self->controller->profile->get('table') . "number"; my %vcs_by_number = map { ( $_->$numbercolumn => 1 ) } @{ $self->existing_objects }; + my $i; + my $num_data = scalar @{ $self->controller->data }; foreach my $entry (@{ $self->controller->data }) { + $self->controller->track_progress(progress => $i/$num_data * 100) if $i % 100 == 0; my $object = $entry->{object}; $self->check_name($entry); @@ -66,6 +71,8 @@ sub check_objects { } else { $vcs_by_number{ $object->$numbercolumn } = $object; } + } continue { + $i++; } $self->add_columns(map { "${_}_id" } grep { exists $self->controller->data->[0]->{raw_data}->{$_} } qw(language business payment)); @@ -256,4 +263,4 @@ sub setup_displayable_columns { # TODO: # salesman_id -- Kunden mit Typ 'Verkäufer', falls Vertreter-Modus an ist, ansonsten Employees -1; \ No newline at end of file +1; diff --git a/SL/Controller/CsvImport/Project.pm b/SL/Controller/CsvImport/Project.pm index 6530fb314..d03de46bf 100644 --- a/SL/Controller/CsvImport/Project.pm +++ b/SL/Controller/CsvImport/Project.pm @@ -27,8 +27,16 @@ sub init_all_cvar_configs { sub check_objects { my ($self) = @_; + $self->controller->track_progress(phase => 'building data', progress => 0); + + my $i; + my $num_data = scalar @{ $self->controller->data }; foreach my $entry (@{ $self->controller->data }) { + $self->controller->track_progress(progress => $i/$num_data * 100) if $i % 100 == 0; + $self->handle_cvars($entry); + } continue { + $i++; } $self->add_cvar_raw_data_columns; @@ -56,4 +64,4 @@ sub setup_displayable_columns { ); } -1; \ No newline at end of file +1; diff --git a/SL/Controller/CsvImport/Shipto.pm b/SL/Controller/CsvImport/Shipto.pm index 903c4b2ca..c20b574df 100644 --- a/SL/Controller/CsvImport/Shipto.pm +++ b/SL/Controller/CsvImport/Shipto.pm @@ -19,9 +19,17 @@ sub init_class { sub check_objects { my ($self) = @_; + $self->controller->track_progress(phase => 'building data', progress => 0); + + my $i; + my $num_data = scalar @{ $self->controller->data }; foreach my $entry (@{ $self->controller->data }) { + $self->controller->track_progress(progress => $i/$num_data * 100) if $i % 100 == 0; + $self->check_vc($entry, 'trans_id'); $entry->{object}->module('CT'); + } continue { + $i++; } $self->add_info_columns({ header => $::locale->text('Customer/Vendor'), method => 'vc_name' }); @@ -127,4 +135,4 @@ sub setup_displayable_columns { ); } -1; \ No newline at end of file +1;