Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision e98fed9c

Von Tamino Steinert vor etwa 1 Jahr hinzugefügt

  • ID e98fed9c38bb477e2637bd7037cf6178164cbda2
  • Vorgänger 77d12cee
  • Nachfolger dab9021b

ImportPurchaseInvoiceEmails: Email Client und Ordner im Objekt speichern

Unterschiede anzeigen:

SL/BackgroundJob/ImportPurchaseInvoiceEmails.pm
10 10

  
11 11
sub sync_email_folder {
12 12
  my ($self) = @_;
13
  my $folder = $self->{job_obj}->data_as_hash->{folder};
14 13

  
15
  my $imap_client = SL::IMAPClient->new(%{$::lx_office_conf{purchase_invoice_emails_imap}});
16

  
17
  my $email_import = $imap_client->update_emails_from_folder(
18
    $folder,
14
  my $email_import = $self->{imap_client}->update_emails_from_folder(
15
    $self->{folder},
19 16
    {
20 17
      email_journal => {
21 18
        extended_status => 'purchase_invoice_import',
22 19
      },
23 20
    }
24 21
  );
22
  $self->{email_import} = $email_import;
25 23
  return unless $email_import;
26 24

  
27 25
  return "Created email import: " . $email_import->id;
......
48 46

  
49 47
sub clean_up_imported_emails {
50 48
  my ($self) = @_;
51
  my $folder = $self->{job_obj}->data_as_hash->{folder};
52

  
53
  my $imap_client = SL::IMAPClient->new(%{$::lx_office_conf{purchase_invoice_emails_imap}});
54 49

  
55
  $imap_client->clean_up_imported_emails_from_folder($folder);
50
  $self->{imap_client}->clean_up_imported_emails_from_folder($self->{folder});
56 51

  
57 52
  return "Cleaned imported emails";
58 53
}
......
60 55
sub run {
61 56
  my ($self, $job_obj) = @_;
62 57
  $self->{job_obj} = $job_obj;
58
  $self->{imap_client} = SL::IMAPClient->new(%{$::lx_office_conf{purchase_invoice_emails_imap}});
59
  $self->{folder} = $self->{job_obj}->data_as_hash->{folder};
63 60

  
64 61
  my @results;
65 62
  push @results, $self->delete_email_imports();

Auch abrufbar als: Unified diff