Skip to content

Commit

Permalink
EmailJournal: Report: Sortiere nach verknüpften Emails
Browse files Browse the repository at this point in the history
  • Loading branch information
z4m1n0 committed Oct 24, 2023
1 parent 25ca3f8 commit 5dc8067
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 4 deletions.
8 changes: 5 additions & 3 deletions SL/Controller/EmailJournal.pm
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ sub init_models {
sent_on => t8('Sent on'),
status => t8('Status'),
extended_status => t8('Extended status'),
linked => t8('Linked'),
},
);
}
Expand All @@ -551,9 +552,10 @@ sub init_filter_summary {
@filters;

my %status = (
send_failed => $::locale->text('send failed'),
sent => $::locale->text('sent'),
imported => $::locale->text('imported'),
send_failed => $::locale->text('send failed'),
sent => $::locale->text('sent'),
imported => $::locale->text('imported'),
record_imported => $::locale->text('record imported'),
);
push @filter_strings, $status{ $filter->{'status:eq_ignore_empty'} } if $filter->{'status:eq_ignore_empty'};

Expand Down
6 changes: 6 additions & 0 deletions SL/DB/EmailJournal.pm
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ sub link_to_record_with_attachment {
$self->link_to_record($record);
}

sub linked {
my ($self) = @_;

return !!scalar @{$self->linked_records};
}

sub process_attachments_as_purchase_invoices {
my ($self) = @_;

Expand Down
9 changes: 9 additions & 0 deletions SL/DB/Manager/EmailJournal.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ sub _sort_spec {
columns => {
SIMPLE => 'ALL',
sender => 'sender.name',
linked => "(
SELECT count(*) from record_links where
( record_links.from_table = 'email_journal'::varchar(50)
AND record_links.from_id = email_journal.id
) OR (
record_links.to_table = 'email_journal'::varchar(50)
AND record_links.to_id = email_journal.id
)
) > 0"
},
);
}
Expand Down
1 change: 1 addition & 0 deletions locale/de/all
Original file line number Diff line number Diff line change
Expand Up @@ -2219,6 +2219,7 @@ $ ./scripts/installation_check.pl',
'Link to' => 'Verknüpfen mit',
'Link to invoice' => 'Beleglink',
'Link to the following project:' => 'Mit dem folgenden Projekt verknüpfen:',
'Linked' => 'Verknüpft',
'Linked Records' => 'Verknüpfte Belege',
'Linked email and attachment to ' => 'E-Mail und Anhang verknüpft mit ',
'Linked invoices' => 'Verknüpfte Rechnungen',
Expand Down
1 change: 1 addition & 0 deletions locale/en/all
Original file line number Diff line number Diff line change
Expand Up @@ -2218,6 +2218,7 @@ $self->{texts} = {
'Link to' => '',
'Link to invoice' => '',
'Link to the following project:' => '',
'Linked' => '',
'Linked Records' => '',
'Linked email and attachment to ' => '',
'Linked invoices' => '',
Expand Down
2 changes: 1 addition & 1 deletion templates/design40_webpages/email_journal/_filter.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
[ "sent", LxERP.t8("sent") ],
[ "imported", LxERP.t8("imported") ]
[ "record_imported", LxERP.t8("record imported") ]
], default=filter.status_eq_ignore_empty) %]</td>
], default=filter.status_eq_ignore_empty) %]
</td>
</tr>
</tbody>
Expand Down
2 changes: 2 additions & 0 deletions templates/design40_webpages/email_journal/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ <h1>[% FORM.title %]</h1>
<th>[% L.sortable_table_header("sent_on") %]</th>
<th>[% L.sortable_table_header("status") %]</th>
<th>[% L.sortable_table_header("extended_status") %]</th>
<th>[% L.sortable_table_header("linked") %]</th>
</tr>
</thead>
<tbody>
Expand All @@ -39,6 +40,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>[% entry.linked ? LxERP.t8('Yes') : LxERP.t8('No') %]</td>
</tr>
[% END %]
</tbody>
Expand Down

0 comments on commit 5dc8067

Please sign in to comment.