Revision d7d1f551
Von Tamino Steinert vor mehr als 1 Jahr hinzugefügt
- ID d7d1f551c1789d286b61f175c6e5bb9c139f404d
- Vorgänger 18fd1765
SL/IMAPClient.pm | ||
---|---|---|
11 | 11 |
use File::MimeInfo::Magic; |
12 | 12 |
use Encode qw(encode decode); |
13 | 13 |
use Encode::IMAPUTF7; |
14 |
use SL::Locale; |
|
14 | 15 |
|
15 | 16 |
use SL::SessionFile; |
16 | 17 |
use SL::Locale::String qw(t8); |
... | ... | |
20 | 21 |
|
21 | 22 |
use SL::DB::Order; |
22 | 23 |
|
23 |
my %RECORD_TYPE_TO_FOLDER = ( |
|
24 |
sales_quotation => t8('Sales Quotations'), |
|
25 |
sales_order => t8('Sales Orders'), |
|
26 |
); |
|
27 |
my %RECORD_FOLDER_TO_TYPE = reverse %RECORD_TYPE_TO_FOLDER; |
|
28 |
|
|
29 | 24 |
sub new { |
30 | 25 |
my ($class, %params) = @_; |
31 | 26 |
my $config = $::lx_office_conf{imap_client} || {}; |
27 |
my $server_locale = Locale->new($::lx_office_conf{server}->{language}); |
|
28 |
my %record_type_to_folder = ( |
|
29 |
sales_quotation => $server_locale->text('Sales Quotations'), |
|
30 |
sales_order => $server_locale->text('Sales Orders'), |
|
31 |
); |
|
32 |
my %record_folder_to_type = reverse %record_type_to_folder; |
|
32 | 33 |
my $self = bless { |
33 | 34 |
enabled => $config->{enabled}, |
34 | 35 |
hostname => $config->{hostname}, |
... | ... | |
37 | 38 |
username => $config->{username}, |
38 | 39 |
password => $config->{password}, |
39 | 40 |
base_folder => $config->{base_folder} || 'INBOX', |
41 |
record_type_to_folder => \%record_type_to_folder, |
|
42 |
record_folder_to_type => \%record_folder_to_type, |
|
40 | 43 |
%params, |
41 | 44 |
}, $class; |
42 | 45 |
return unless $self->{enabled}; |
... | ... | |
279 | 282 |
$ilike_record_number |
280 | 283 |
) = $ilike_folder_path =~ m|^(.+)/([^\s]+) (.+)/(.+)/(.+)|; |
281 | 284 |
|
282 |
my $record_type = $RECORD_FOLDER_TO_TYPE{$record_folder};
|
|
285 |
my $record_type = $self->{record_folder_to_type}->{$record_folder};
|
|
283 | 286 |
next unless $record_type; |
284 | 287 |
|
285 | 288 |
# TODO make it generic for all records |
... | ... | |
373 | 376 |
my $record_folder_path = |
374 | 377 |
$self->{base_folder} . '/' . |
375 | 378 |
$string_parts{cv_number} . ' ' . $string_parts{cv_name} . '/' . |
376 |
$RECORD_TYPE_TO_FOLDER{$record->type} . '/' .
|
|
379 |
$self->{record_type_to_folder}->{$record->type} . '/' .
|
|
377 | 380 |
$string_parts{record_number}; |
378 | 381 |
my $folder_string = $self->get_folder_string_from_path($record_folder_path); |
379 | 382 |
return $folder_string; |
... | ... | |
468 | 471 |
|
469 | 472 |
=over 2 |
470 | 473 |
|
471 |
=item C<%RECORD_TYPE_TO_FOLDER>
|
|
474 |
=item C<%$self->{record_type_to_folder}>
|
|
472 | 475 |
|
473 | 476 |
Due to the lack of a single global mapping for $record->type, |
474 | 477 |
type is mapped to the corresponding translation. All types which |
475 | 478 |
use this module are currently mapped and should be mapped. |
476 | 479 |
|
477 |
=item C<%RECORD_FOLDER_TO_TYPE>
|
|
480 |
=item C<%$self->record_folder_to_type>
|
|
478 | 481 |
|
479 |
The reverse mapping of %RECORD_TYPE_TO_FOLDER.
|
|
482 |
The reverse mapping of C<%$self->{record_type_to_folder}>.
|
|
480 | 483 |
|
481 | 484 |
=back |
482 | 485 |
|
Auch abrufbar als: Unified diff
IMAPClient: FIX: Nutze Serversprache für Übersetzungen zur Laufzeit