Skip to content

Commit

Permalink
EmailJournal: Belegtype übersetzt anzeigen
Browse files Browse the repository at this point in the history
  • Loading branch information
z4m1n0 committed Dec 1, 2023
1 parent 9cf32c2 commit 9990866
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
21 changes: 18 additions & 3 deletions SL/Controller/EmailJournal.pm
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,17 @@ sub get_record_types_with_info {
return @record_types_with_info;
}

# has do be done at runtime for translation to work
sub get_record_types_to_text {
my @record_types_with_info = get_record_types_with_info();

my %record_types_to_text = ();
$record_types_to_text{$_->{record_type}} = $_->{text} for @record_types_with_info;
$record_types_to_text{'catch_all'} = t8("Catch-all");

return %record_types_to_text;
}

sub record_types_for_customer_vendor_type_and_action {
my ($self, $customer_vendor_type, $action) = @_;
return [
Expand Down Expand Up @@ -217,11 +228,13 @@ sub action_list {
}
$self->setup_list_action_bar;
my @record_types_with_info = $self->get_record_types_with_info();
my %record_types_to_text = $self->get_record_types_to_text();
$self->render('email_journal/list',
title => $::locale->text('Email journal'),
ENTRIES => $self->models->get,
MODELS => $self->models,
RECORD_TYPES_WITH_INFO => \@record_types_with_info,
RECORD_TYPES_TO_TEXT => \%record_types_to_text,
);
}

Expand All @@ -239,6 +252,7 @@ sub action_show {
}

my @record_types_with_info = $self->get_record_types_with_info();
my %record_types_to_text = $self->get_record_types_to_text();

my $customer_vendor = $self->find_customer_vendor_from_email($self->entry);
my $cv_type = $customer_vendor && $customer_vendor->is_vendor ? 'vendor' : 'customer';
Expand All @@ -255,7 +269,8 @@ sub action_show {
CUSTOMER_VENDOR => , $customer_vendor,
CV_TYPE_FOUND => $cv_type_found,
RECORD_TYPES_WITH_INFO => \@record_types_with_info,
back_to => $back_to
RECORD_TYPES_TO_TEXT => \%record_types_to_text,
back_to => $back_to,
);
}

Expand Down Expand Up @@ -764,8 +779,8 @@ sub init_filter_summary {
push @filter_strings, $status{ $filter->{'status:eq_ignore_empty'} } if $filter->{'status:eq_ignore_empty'};


my %record_type = map { $_->{record_type} => $_->{text} } $self->get_record_types_with_info();
push @filter_strings, $record_type{ $filter->{'record_type:eq_ignore_empty'} } if $filter->{'record_type:eq_ignore_empty'};
my %record_type_to_text = $self->get_record_types_to_text();
push @filter_strings, $record_type_to_text{ $filter->{'record_type:eq_ignore_empty'} } if $filter->{'record_type:eq_ignore_empty'};

push @filter_strings, $::locale->text('Obsolete') if $filter->{'obsolete:eq_ignore_empty'} eq '1';
push @filter_strings, $::locale->text('Not obsolete') if $filter->{'obsolete:eq_ignore_empty'} eq '0';
Expand Down
2 changes: 1 addition & 1 deletion templates/design40_webpages/email_journal/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ <h1>[% FORM.title %]</h1>
<td>[% HTML.escape(entry.sent_on.to_lxoffice('precision' => 'second')) %]</td>
<td> [% P.email_journal.entry_status(entry) %] </td>
<td>[% HTML.escape(entry.extended_status) %]</td>
<td>[% HTML.escape(entry.record_type) %]</td>
<td>[% HTML.escape(RECORD_TYPES_TO_TEXT.${entry.record_type}) %]</td>
<td>[% HTML.escape(entry.obsolete_as_bool_yn) %]</td>
<td>
[% P.record.simple_grouped_record_list(entry.linked_records) %]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</tr>
<tr>
<th>[% 'For Record Type' | $T8 %]</th>
<td>[% L.input_tag('record_type', SELF.entry.record_type, style="color:black", class="wi-verywide", disabled=1) %]</td>
<td>[% L.input_tag('record_type', RECORD_TYPES_TO_TEXT.${SELF.entry.record_type}, style="color:black", class="wi-verywide", disabled=1) %]</td>
</tr>
<tr>
<th>[% 'Headers' | $T8 %]</th>
Expand Down
2 changes: 1 addition & 1 deletion templates/webpages/email_journal/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ <h1>[% FORM.title %]</h1>
<td>[%- HTML.escape(entry.sent_on.to_lxoffice('precision' => 'second')) %]</td>
<td> [% P.email_journal.entry_status(entry) %] </td>
<td>[%- HTML.escape(entry.extended_status) %]</td>
<td>[% HTML.escape(entry.record_type) %]</td>
<td>[% HTML.escape(RECORD_TYPES_TO_TEXT.${entry.record_type}) %]</td>
<td>[% HTML.escape(entry.obsolete_as_bool_yn) %]</td>
<td>
[% P.record.simple_grouped_record_list(entry.linked_records) %]
Expand Down
2 changes: 1 addition & 1 deletion templates/webpages/email_journal/tabs/basic_data.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

<tr class="listrow">
<th>[%- LxERP.t8("For Record Type") %]</th>
<td>[%- HTML.escape(SELF.entry.record_type) %]</td>
<td>[%- HTML.escape(RECORD_TYPES_TO_TEXT.${SELF.entry.record_type}) %]</td>
</tr>

<tr class="listrow">
Expand Down

0 comments on commit 9990866

Please sign in to comment.