]> wagnertech.de Git - mfinanz.git/blob - SL/BackgroundJob/CleanUpEmailSubfolders.pm
restart apache2 in postinst
[mfinanz.git] / SL / BackgroundJob / CleanUpEmailSubfolders.pm
1 package SL::BackgroundJob::CleanUpEmailSubfolders;
2
3 use strict;
4 use warnings;
5
6 use parent qw(SL::BackgroundJob::Base);
7
8 use SL::IMAPClient;
9
10 sub clean_up_record_subfolders {
11   my ($self) = @_;
12   my $imap_client = SL::IMAPClient->new(%{$::lx_office_conf{imap_client}});
13
14   my $open_sales_orders = SL::DB::Manager::Order->get_all(
15     query => [
16       vendor_id => undef,
17       closed => 0,
18     ],
19   );
20
21   $imap_client->clean_up_record_subfolders(active_records => $open_sales_orders);
22 }
23
24 sub run {
25   my ($self, $job_obj) = @_;
26   $self->{job_obj} = $job_obj;
27
28   $self->clean_up_record_subfolders();
29
30   return;
31 }
32
33 1;
34
35 __END__
36
37 =encoding utf8
38
39 =head1 NAME
40
41 SL::BackgroundJob::CleanUpEmailSubfolders - Background job for removing all email
42 subfolders except open records.
43
44 =head1 SYNOPSIS
45
46 This background job syncs all emails in subfolders and adds emails files to the
47 corresponding record. After that is removes all subfolders except for open
48 records.
49
50 =head1 BUGS
51
52 Nothing here yet.
53
54 =head1 AUTHOR
55
56 Tamino Steinert E<lt>tamino.steinert@tamino.stE<gt>
57
58 =cut