Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a03a52eb

Von Tamino Steinert vor 11 Monaten hinzugefügt

  • ID a03a52eb41062404a7bb16472ef47e020511c24f
  • Vorgänger e453ae7c
  • Nachfolger 6aa3c3ea

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