12 |
12 |
use SL::Presenter::Tag qw(link_tag);
|
13 |
13 |
use SL::Locale::String qw(t8);
|
14 |
14 |
|
15 |
|
use Params::Validate qw(:all);
|
16 |
15 |
use List::MoreUtils qw(any);
|
|
16 |
use Params::Validate qw(:all);
|
|
17 |
use Try::Tiny;
|
17 |
18 |
|
18 |
19 |
sub sync_record_email_folder {
|
19 |
20 |
my ($self, $config) = @_;
|
20 |
21 |
|
21 |
22 |
my %imap_config;
|
22 |
|
foreach my $key (qw(enabled hostname port ssl username password base_folder)) {
|
|
23 |
foreach my $key (qw(enabled hostname port ssl username password)) {
|
23 |
24 |
if (defined $config->{$key}) {
|
24 |
25 |
$imap_config{$key} = $config->{$key};
|
25 |
26 |
}
|
... | ... | |
114 |
115 |
my ($self, $job_obj) = @_;
|
115 |
116 |
$self->{job_obj} = $job_obj;
|
116 |
117 |
|
117 |
|
my $data = $job_obj->data_as_hash;
|
|
118 |
my $data;
|
118 |
119 |
|
119 |
|
my $record_type = $data->{record_type};
|
120 |
|
my $loaded_config = $::lx_office_conf{"record_emails_imap/record_type/$record_type"}
|
121 |
|
|| $::lx_office_conf{record_emails_imap}
|
122 |
|
|| {};
|
|
120 |
try {
|
|
121 |
$data = $job_obj->data_as_hash;
|
|
122 |
} catch { die t8("Invalid YAML Configuration for this job. Reason: malformed YAML Data: #1. Please consult: Program -> Documentation -> HTML -> Configuration of Background-Jobs.", $_ ); };
|
123 |
123 |
|
124 |
|
# overwrite with background job data
|
125 |
|
$loaded_config->{$_} = $data->{$_} for keys %{$data};
|
126 |
|
my @config_params = %{$loaded_config};
|
|
124 |
my @config_params = %{$data};
|
127 |
125 |
|
128 |
126 |
my %config = validate_with(
|
129 |
127 |
params => \@config_params,
|
... | ... | |
167 |
165 |
username => { type => SCALAR, },
|
168 |
166 |
password => { type => SCALAR, },
|
169 |
167 |
base_folder => { type => SCALAR, optional => 1},
|
|
168 |
|
170 |
169 |
},
|
171 |
|
called => "data filed in Background Job or kivitendo.conf in [record_emails_imap] with type $record_type",
|
|
170 |
called => "YAML Configuration for this Background Job invalid. Please consult: Program -> Documentation -> HTML -> Configuration of Background-Jobs.",
|
172 |
171 |
);
|
173 |
172 |
|
174 |
173 |
my @results;
|
BJ->ImportRecordEmails keine Konfig aus der kivitendo.conf