Revision a566082c
Von Tamino Steinert vor etwa 1 Jahr hinzugefügt
SL/IMAPClient.pm | ||
---|---|---|
65 | 65 |
} |
66 | 66 |
|
67 | 67 |
sub update_emails_from_folder { |
68 |
my ($self, $folder_path) = @_; |
|
68 |
my ($self, $folder_path, $params) = @_;
|
|
69 | 69 |
$folder_path ||= $self->{base_folder}; |
70 | 70 |
|
71 | 71 |
my $folder_string = $self->get_folder_string_from_path($folder_path); |
72 | 72 |
my $email_import = |
73 |
_update_emails_from_folder_strings($self, $folder_path, [$folder_string]); |
|
73 |
_update_emails_from_folder_strings($self, $folder_path, [$folder_string], $params);
|
|
74 | 74 |
|
75 | 75 |
return $email_import; |
76 | 76 |
} |
77 | 77 |
|
78 | 78 |
sub update_emails_from_subfolders { |
79 |
my ($self, $base_folder_path) = @_; |
|
79 |
my ($self, $base_folder_path, $params) = @_;
|
|
80 | 80 |
$base_folder_path ||= $self->{base_folder}; |
81 | 81 |
my $base_folder_string = $self->get_folder_string_from_path($base_folder_path); |
82 | 82 |
|
... | ... | |
85 | 85 |
@subfolder_strings = grep { $_ ne $base_folder_string } @subfolder_strings; |
86 | 86 |
|
87 | 87 |
my $email_import = |
88 |
_update_emails_from_folder_strings($self, $base_folder_path, \@subfolder_strings); |
|
88 |
_update_emails_from_folder_strings($self, $base_folder_path, \@subfolder_strings, $params);
|
|
89 | 89 |
|
90 | 90 |
return $email_import; |
91 | 91 |
} |
92 | 92 |
|
93 | 93 |
sub _update_emails_from_folder_strings { |
94 |
my ($self, $base_folder_path, $folder_strings) = @_; |
|
94 |
my ($self, $base_folder_path, $folder_strings, $params) = @_;
|
|
95 | 95 |
|
96 | 96 |
my $dbh = SL::DB->client->dbh; |
97 | 97 |
|
... | ... | |
131 | 131 |
my $new_email_string = $self->{imap_client}->message_string($new_uid); |
132 | 132 |
my $email = Email::MIME->new($new_email_string); |
133 | 133 |
my $email_journal = $self->_create_email_journal( |
134 |
$email, $email_import, $new_uid, $folder_string, $folder_uidvalidity |
|
134 |
$email, $email_import, $new_uid, $folder_string, $folder_uidvalidity, $params->{email_journal}
|
|
135 | 135 |
); |
136 | 136 |
$email_journal->save(); |
137 | 137 |
} |
... | ... | |
152 | 152 |
} |
153 | 153 |
|
154 | 154 |
sub _create_email_journal { |
155 |
my ($self, $email, $email_import, $uid, $folder_string, $folder_uidvalidity) = @_; |
|
155 |
my ($self, $email, $email_import, $uid, $folder_string, $folder_uidvalidity, $params) = @_;
|
|
156 | 156 |
|
157 | 157 |
my @email_parts = $email->parts; # get parts or self |
158 | 158 |
my $text_part = $email_parts[0]; |
... | ... | |
197 | 197 |
body => $body, |
198 | 198 |
headers => $header_string, |
199 | 199 |
attachments => \@attachments, |
200 |
%$params, |
|
200 | 201 |
); |
201 | 202 |
|
202 | 203 |
return $email_journal; |
Auch abrufbar als: Unified diff
BJ: ImportPurchaseInvoiceEmails hinzugefügt