Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision cc96274a

Von Tamino Steinert vor 11 Monaten hinzugefügt

  • ID cc96274a97c4a7b853b1f1990fc6631d4a069852
  • Vorgänger 9ea083c2
  • Nachfolger 77a5beb7

Email Background Jobs: validiere Daten-Feld

Unterschiede anzeigen:

SL/BackgroundJob/SyncEmailFolder.pm
5 5

  
6 6
use parent qw(SL::BackgroundJob::Base);
7 7

  
8
use Params::Validate qw(:all);
9

  
8 10
use SL::IMAPClient;
9 11
use SL::DB::Manager::EmailImport;
10 12

  
......
12 14
  my ($self) = @_;
13 15
  my $folder = $self->{job_obj}->data_as_hash->{folder};
14 16

  
15
  my $imap_client = SL::IMAPClient->new();
16
  die "Email client is disabled" unless $imap_client;
17
  my $imap_client = SL::IMAPClient->new(%{$::lx_office_conf{imap_client}});
17 18

  
18
  my $email_import = $imap_client->update_emails_from_folder($folder);
19
  my $email_import = $imap_client->update_emails_from_folder(
20
    folder => $folder
21
  );
19 22
  return unless $email_import;
20 23

  
21 24
  return "Created email import: " . $email_import->id;
......
43 46
sub run {
44 47
  my ($self, $job_obj) = @_;
45 48
  $self->{job_obj} = $job_obj;
49
  my @bj_data = $job_obj->data_as_hash;
50
  validate_with(
51
    params => \@bj_data,
52
    spec   => {
53
      folder => {
54
        type =>
55
        SCALAR, optional => 1
56
      },
57
      email_import_ids_to_delete => {
58
        type => ARRAYREF,
59
        optional => 1,
60
      }
61
    },
62
    called => "data filed in Background Job",
63
  );
46 64

  
47 65
  my @results;
48 66
  push @results, $self->delete_email_imports();

Auch abrufbar als: Unified diff