Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 85a71bad

Von Bernd Bleßmann vor fast 11 Jahren hinzugefügt

  • ID 85a71bad4e1e97d75c852abe4da7f1d8ca15743c
  • Vorgänger 99556d8b
  • Nachfolger 579f5842

Beim CSV-Import die Session-Id der "auftraggebenden" Sitzung verwenden.

Damit kann der CSV-Import via Task-Server auch von Benutzern verwendet
werden, die den Task-Server nicht in ihrer Sitzung gestartet haben.

Es bleibt das Problem, dass der Import nicht ausgeführt werden kann,
wenn sie sich abmelden.

Behebt #2198.

Unterschiede anzeigen:

SL/BackgroundJob/CsvImport.pm
82 82
  );
83 83
  $c->add_progress_tracker($self);
84 84

  
85
  my $session_id = $job->data_as_hash->{session_id};
85 86

  
86
  $c->test_and_import(test => $test, session_id => $job->data_as_hash->{session_id});
87
  $c->test_and_import(test => $test, session_id => $session_id);
87 88

  
88 89
  if ($c->errors) {
89 90
    $job->set_data(
......
91 92
    )->save;
92 93
  } else {
93 94

  
94
    my $report_id = $c->save_report;
95
    my $report_id = $c->save_report(session_id => $session_id);
95 96
    $job->set_data(report_id => $report_id)->save;
96 97

  
97 98
    $c->track_progress(finished => 1);
SL/Controller/CsvImport.pm
414 414
}
415 415

  
416 416
sub save_report {
417
  my ($self, $report_id) = @_;
417
  my ($self, %params) = @_;
418 418

  
419 419
  if ($self->worker->is_multiplexed) {
420
    return $self->save_report_multi($report_id);
420
    return $self->save_report_multi(%params);
421 421
  } else {
422
    return $self->save_report_single($report_id);
422
    return $self->save_report_single(%params);
423 423
  }
424 424
}
425 425

  
426 426
sub save_report_single {
427
  my ($self, $report_id) = @_;
427
  my ($self, %params) = @_;
428 428

  
429 429
  $self->track_progress(phase => 'building report', progress => 0);
430 430

  
......
432 432
  $clone_profile->save; # weird bug. if this isn't saved before adding it to the report, it will default back to the last profile.
433 433

  
434 434
  my $report = SL::DB::CsvImportReport->new(
435
    session_id => $::auth->create_or_refresh_session,
435
    session_id => $params{session_id},
436 436
    profile    => $clone_profile,
437 437
    type       => $self->type,
438 438
    file       => '',
......
494 494
}
495 495

  
496 496
sub save_report_multi {
497
  my ($self, $report_id) = @_;
497
  my ($self, %params) = @_;
498 498

  
499 499
  $self->track_progress(phase => 'building report', progress => 0);
500 500

  
......
502 502
  $clone_profile->save; # weird bug. if this isn't saved before adding it to the report, it will default back to the last profile.
503 503

  
504 504
  my $report = SL::DB::CsvImportReport->new(
505
    session_id => $::auth->create_or_refresh_session,
505
    session_id => $params{session_id},
506 506
    profile    => $clone_profile,
507 507
    type       => $self->type,
508 508
    file       => '',
SL/SessionFile.pm
21 21

  
22 22
  my $self   = $class->SUPER::new;
23 23

  
24
  if ($params{session_id}) {
25
    $self->session_id($params{session_id})
26
  }
27

  
24 28
  my $path   = $self->prepare_path;
25 29
  $file_name =~ s:.*/::g;
26 30
  $file_name =  "${path}/${file_name}";

Auch abrufbar als: Unified diff