Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 169357af

Von Sven Schöling vor fast 12 Jahren hinzugefügt

  • ID 169357af8aab17e151f64de9321a2a34735cb07b
  • Vorgänger 8ae2bc4f
  • Nachfolger 8a05497d

progress tracking für andere imports

Unterschiede anzeigen:

SL/Controller/CsvImport/Contact.pm
27 27
sub check_objects {
28 28
  my ($self) = @_;
29 29

  
30
  $self->controller->track_progress(phase => 'building data', progress => 0);
31

  
32
  my $i;
33
  my $num_data = scalar @{ $self->controller->data };
30 34
  foreach my $entry (@{ $self->controller->data }) {
35
    $self->controller->track_progress(progress => $i/$num_data * 100) if $i % 100 == 0;
36

  
31 37
    $self->check_name($entry);
32 38
    $self->check_vc($entry, 'cp_cv_id');
33 39
    $self->check_gender($entry);
34 40
    $self->handle_cvars($entry);
41
  } continue {
42
    $i++;
35 43
  }
36 44

  
37 45
  $self->add_info_columns({ header => $::locale->text('Customer/Vendor'), method => 'vc_name' });
......
116 124
                                );
117 125
}
118 126

  
119
1;
127
1;
SL/Controller/CsvImport/CustomerVendor.pm
47 47
sub check_objects {
48 48
  my ($self) = @_;
49 49

  
50
  $self->controller->track_progress(phase => 'building data', progress => 0);
51

  
50 52
  my $numbercolumn  = $self->controller->profile->get('table') . "number";
51 53
  my %vcs_by_number = map { ( $_->$numbercolumn => 1 ) } @{ $self->existing_objects };
52 54

  
55
  my $i;
56
  my $num_data = scalar @{ $self->controller->data };
53 57
  foreach my $entry (@{ $self->controller->data }) {
58
    $self->controller->track_progress(progress => $i/$num_data * 100) if $i % 100 == 0;
54 59
    my $object = $entry->{object};
55 60

  
56 61
    $self->check_name($entry);
......
66 71
    } else {
67 72
      $vcs_by_number{ $object->$numbercolumn } = $object;
68 73
    }
74
  } continue {
75
    $i++;
69 76
  }
70 77

  
71 78
  $self->add_columns(map { "${_}_id" } grep { exists $self->controller->data->[0]->{raw_data}->{$_} } qw(language business payment));
......
256 263
# TODO:
257 264
# salesman_id -- Kunden mit Typ 'Verkäufer', falls Vertreter-Modus an ist, ansonsten Employees
258 265

  
259
1;
266
1;
SL/Controller/CsvImport/Project.pm
27 27
sub check_objects {
28 28
  my ($self) = @_;
29 29

  
30
  $self->controller->track_progress(phase => 'building data', progress => 0);
31

  
32
  my $i;
33
  my $num_data = scalar @{ $self->controller->data };
30 34
  foreach my $entry (@{ $self->controller->data }) {
35
    $self->controller->track_progress(progress => $i/$num_data * 100) if $i % 100 == 0;
36

  
31 37
    $self->handle_cvars($entry);
38
  } continue {
39
    $i++;
32 40
  }
33 41

  
34 42
  $self->add_cvar_raw_data_columns;
......
56 64
                                );
57 65
}
58 66

  
59
1;
67
1;
SL/Controller/CsvImport/Shipto.pm
19 19
sub check_objects {
20 20
  my ($self) = @_;
21 21

  
22
  $self->controller->track_progress(phase => 'building data', progress => 0);
23

  
24
  my $i;
25
  my $num_data = scalar @{ $self->controller->data };
22 26
  foreach my $entry (@{ $self->controller->data }) {
27
    $self->controller->track_progress(progress => $i/$num_data * 100) if $i % 100 == 0;
28

  
23 29
    $self->check_vc($entry, 'trans_id');
24 30
    $entry->{object}->module('CT');
31
  } continue {
32
    $i++;
25 33
  }
26 34

  
27 35
  $self->add_info_columns({ header => $::locale->text('Customer/Vendor'), method => 'vc_name' });
......
127 135
                                );
128 136
}
129 137

  
130
1;
138
1;

Auch abrufbar als: Unified diff