Feat: Add default PDF layout option as fallback to ENV

This commit is contained in:
Silvia Bigler 2025-01-26 11:47:14 +01:00 committed by shamoon
parent 96d1a43da7
commit 6b398a6c62
7 changed files with 118 additions and 80 deletions

View File

@ -203,7 +203,7 @@ and watch out for indentation if editing the YAML file.
#### [`PAPERLESS_EMAIL_PARSE_DEFAULT_LAYOUT=<int>`(#PAPERLESS_EMAIL_PARSE_DEFAULT_LAYOUT) {#PAPERLESS_EMAIL_PARSE_DEFAULT_LAYOUT}
: The default layout to use for emails that are consumed as documents. Must be one of the integer choices below. Note that mail
rules can specify this setting, thus this fallback is used for .eml files consumed by other means.
rules can specify this setting, thus this fallback is used for the default selection and for .eml files consumed by other means.
- `1` = Text, then HTML
- `2` = HTML, then text

View File

@ -2030,7 +2030,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts</context>
<context context-type="linenumber">84</context>
<context context-type="linenumber">88</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html</context>
@ -4032,123 +4032,130 @@
<context context-type="linenumber">58</context>
</context-group>
</trans-unit>
<trans-unit id="8776300244268604360" datatype="html">
<source>System default</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts</context>
<context context-type="linenumber">65</context>
</context-group>
</trans-unit>
<trans-unit id="4812910224365219000" datatype="html">
<source>Text, then HTML</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts</context>
<context context-type="linenumber">65</context>
<context context-type="linenumber">69</context>
</context-group>
</trans-unit>
<trans-unit id="3181744476823286470" datatype="html">
<source>HTML, then text</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts</context>
<context context-type="linenumber">69</context>
<context context-type="linenumber">73</context>
</context-group>
</trans-unit>
<trans-unit id="9048933760263399623" datatype="html">
<source>HTML only</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts</context>
<context context-type="linenumber">73</context>
<context context-type="linenumber">77</context>
</context-group>
</trans-unit>
<trans-unit id="3835211125655594627" datatype="html">
<source>Text only</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts</context>
<context context-type="linenumber">77</context>
<context context-type="linenumber">81</context>
</context-group>
</trans-unit>
<trans-unit id="2784260611081866636" datatype="html">
<source>Move to specified folder</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts</context>
<context context-type="linenumber">88</context>
<context context-type="linenumber">92</context>
</context-group>
</trans-unit>
<trans-unit id="4593278936733161020" datatype="html">
<source>Mark as read, don&apos;t process read mails</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts</context>
<context context-type="linenumber">92</context>
<context context-type="linenumber">96</context>
</context-group>
</trans-unit>
<trans-unit id="2378921144019636516" datatype="html">
<source>Flag the mail, don&apos;t process flagged mails</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts</context>
<context context-type="linenumber">96</context>
<context context-type="linenumber">100</context>
</context-group>
</trans-unit>
<trans-unit id="6457024618858980302" datatype="html">
<source>Tag the mail with specified tag, don&apos;t process tagged mails</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts</context>
<context context-type="linenumber">100</context>
<context context-type="linenumber">104</context>
</context-group>
</trans-unit>
<trans-unit id="4673329664686432878" datatype="html">
<source>Use subject as title</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts</context>
<context context-type="linenumber">107</context>
<context context-type="linenumber">111</context>
</context-group>
</trans-unit>
<trans-unit id="8645471396972938185" datatype="html">
<source>Use attachment filename as title</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts</context>
<context context-type="linenumber">111</context>
<context context-type="linenumber">115</context>
</context-group>
</trans-unit>
<trans-unit id="2881879110886196973" datatype="html">
<source>Do not assign title from this rule</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts</context>
<context context-type="linenumber">115</context>
<context context-type="linenumber">119</context>
</context-group>
</trans-unit>
<trans-unit id="1568902914205618549" datatype="html">
<source>Do not assign a correspondent</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts</context>
<context context-type="linenumber">122</context>
<context context-type="linenumber">126</context>
</context-group>
</trans-unit>
<trans-unit id="3567746385454588269" datatype="html">
<source>Use mail address</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts</context>
<context context-type="linenumber">126</context>
<context context-type="linenumber">130</context>
</context-group>
</trans-unit>
<trans-unit id="445154175758965852" datatype="html">
<source>Use name (or mail address if not available)</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts</context>
<context context-type="linenumber">130</context>
<context context-type="linenumber">134</context>
</context-group>
</trans-unit>
<trans-unit id="1258862217749148424" datatype="html">
<source>Use correspondent selected below</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts</context>
<context context-type="linenumber">134</context>
<context context-type="linenumber">138</context>
</context-group>
</trans-unit>
<trans-unit id="3147349817770432927" datatype="html">
<source>Create new mail rule</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts</context>
<context context-type="linenumber">186</context>
<context context-type="linenumber">190</context>
</context-group>
</trans-unit>
<trans-unit id="3374331029704382439" datatype="html">
<source>Edit mail rule</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts</context>
<context context-type="linenumber">190</context>
<context context-type="linenumber">194</context>
</context-group>
</trans-unit>
<trans-unit id="8911059720204770105" datatype="html">

View File

@ -60,6 +60,10 @@ const CONSUMPTION_SCOPE_OPTIONS = [
]
const PDF_LAYOUT_OPTIONS = [
{
id: MailRulePdfLayout.Default,
name: $localize`System default`,
},
{
id: MailRulePdfLayout.TextHtml,
name: $localize`Text, then HTML`,
@ -204,7 +208,7 @@ export class MailRuleEditDialogComponent extends EditDialogComponent<MailRule> {
filter_attachment_filename_exclude: new FormControl(null),
maximum_age: new FormControl(null),
attachment_type: new FormControl(MailFilterAttachmentType.Attachments),
pdf_layout: new FormControl(MailRulePdfLayout.TextHtml),
pdf_layout: new FormControl(MailRulePdfLayout.Default),
consumption_scope: new FormControl(MailRuleConsumptionScope.Attachments),
order: new FormControl(null),
action: new FormControl(MailAction.MarkRead),

View File

@ -12,6 +12,7 @@ export enum MailRuleConsumptionScope {
}
export enum MailRulePdfLayout {
Default = 0,
TextHtml = 1,
HtmlText = 2,
HtmlOnly = 3,

View File

@ -1,21 +1,21 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: paperless-ngx\n"
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-27 08:19-0800\n"
"PO-Revision-Date: 2022-02-17 04:17\n"
"Last-Translator: \n"
"Language-Team: English\n"
"Language: en_US\n"
"POT-Creation-Date: 2025-01-27 09:31-0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Crowdin-Project: paperless-ngx\n"
"X-Crowdin-Project-ID: 500308\n"
"X-Crowdin-Language: en\n"
"X-Crowdin-File: /dev/src/locale/en_US/LC_MESSAGES/django.po\n"
"X-Crowdin-File-ID: 14\n"
#: documents/apps.py:8
msgid "Documents"
@ -90,7 +90,7 @@ msgid "Automatic"
msgstr ""
#: documents/models.py:67 documents/models.py:433 documents/models.py:1493
#: paperless_mail/models.py:23 paperless_mail/models.py:136
#: paperless_mail/models.py:23 paperless_mail/models.py:143
msgid "name"
msgstr ""
@ -276,7 +276,7 @@ msgstr ""
msgid "warning"
msgstr ""
#: documents/models.py:387 paperless_mail/models.py:350
#: documents/models.py:387 paperless_mail/models.py:363
msgid "error"
msgstr ""
@ -818,7 +818,7 @@ msgstr ""
msgid "filter filename"
msgstr ""
#: documents/models.py:1066 paperless_mail/models.py:193
#: documents/models.py:1066 paperless_mail/models.py:200
msgid ""
"Only consume documents which entirely match this filename if specified. "
"Wildcards such as *.pdf or *invoice* are allowed. Case insensitive."
@ -988,15 +988,15 @@ msgid ""
"Assign a document title, can include some placeholders, see documentation."
msgstr ""
#: documents/models.py:1287 paperless_mail/models.py:261
#: documents/models.py:1287 paperless_mail/models.py:274
msgid "assign this tag"
msgstr ""
#: documents/models.py:1296 paperless_mail/models.py:269
#: documents/models.py:1296 paperless_mail/models.py:282
msgid "assign this document type"
msgstr ""
#: documents/models.py:1305 paperless_mail/models.py:283
#: documents/models.py:1305 paperless_mail/models.py:296
msgid "assign this correspondent"
msgstr ""
@ -1112,7 +1112,7 @@ msgstr ""
msgid "workflow actions"
msgstr ""
#: documents/models.py:1495 paperless_mail/models.py:138
#: documents/models.py:1495 paperless_mail/models.py:145
msgid "order"
msgstr ""
@ -1124,7 +1124,7 @@ msgstr ""
msgid "actions"
msgstr ""
#: documents/models.py:1511 paperless_mail/models.py:147
#: documents/models.py:1511 paperless_mail/models.py:154
msgid "enabled"
msgstr ""
@ -1838,161 +1838,185 @@ msgid "Process all files, including 'inline' attachments."
msgstr ""
#: paperless_mail/models.py:119
msgid "Delete"
msgid "System default"
msgstr ""
#: paperless_mail/models.py:120
msgid "Move to specified folder"
msgid "Text, then HTML"
msgstr ""
#: paperless_mail/models.py:121
msgid "Mark as read, don't process read mails"
msgid "HTML, then text"
msgstr ""
#: paperless_mail/models.py:122
msgid "Flag the mail, don't process flagged mails"
msgid "HTML only"
msgstr ""
#: paperless_mail/models.py:123
msgid "Tag the mail with specified tag, don't process tagged mails"
msgid "Text only"
msgstr ""
#: paperless_mail/models.py:126
msgid "Use subject as title"
msgid "Delete"
msgstr ""
#: paperless_mail/models.py:127
msgid "Use attachment filename as title"
msgid "Move to specified folder"
msgstr ""
#: paperless_mail/models.py:128
msgid "Do not assign title from rule"
msgid "Mark as read, don't process read mails"
msgstr ""
#: paperless_mail/models.py:131
msgid "Do not assign a correspondent"
#: paperless_mail/models.py:129
msgid "Flag the mail, don't process flagged mails"
msgstr ""
#: paperless_mail/models.py:132
msgid "Use mail address"
#: paperless_mail/models.py:130
msgid "Tag the mail with specified tag, don't process tagged mails"
msgstr ""
#: paperless_mail/models.py:133
msgid "Use name (or mail address if not available)"
msgid "Use subject as title"
msgstr ""
#: paperless_mail/models.py:134
msgid "Use attachment filename as title"
msgstr ""
#: paperless_mail/models.py:135
msgid "Do not assign title from rule"
msgstr ""
#: paperless_mail/models.py:138
msgid "Do not assign a correspondent"
msgstr ""
#: paperless_mail/models.py:139
msgid "Use mail address"
msgstr ""
#: paperless_mail/models.py:140
msgid "Use name (or mail address if not available)"
msgstr ""
#: paperless_mail/models.py:141
msgid "Use correspondent selected below"
msgstr ""
#: paperless_mail/models.py:144
#: paperless_mail/models.py:151
msgid "account"
msgstr ""
#: paperless_mail/models.py:150 paperless_mail/models.py:305
#: paperless_mail/models.py:157 paperless_mail/models.py:318
msgid "folder"
msgstr ""
#: paperless_mail/models.py:154
#: paperless_mail/models.py:161
msgid ""
"Subfolders must be separated by a delimiter, often a dot ('.') or slash "
"('/'), but it varies by mail server."
msgstr ""
#: paperless_mail/models.py:160
#: paperless_mail/models.py:167
msgid "filter from"
msgstr ""
#: paperless_mail/models.py:167
#: paperless_mail/models.py:174
msgid "filter to"
msgstr ""
#: paperless_mail/models.py:174
#: paperless_mail/models.py:181
msgid "filter subject"
msgstr ""
#: paperless_mail/models.py:181
#: paperless_mail/models.py:188
msgid "filter body"
msgstr ""
#: paperless_mail/models.py:188
#: paperless_mail/models.py:195
msgid "filter attachment filename inclusive"
msgstr ""
#: paperless_mail/models.py:200
#: paperless_mail/models.py:207
msgid "filter attachment filename exclusive"
msgstr ""
#: paperless_mail/models.py:205
#: paperless_mail/models.py:212
msgid ""
"Do not consume documents which entirely match this filename if specified. "
"Wildcards such as *.pdf or *invoice* are allowed. Case insensitive."
msgstr ""
#: paperless_mail/models.py:212
#: paperless_mail/models.py:219
msgid "maximum age"
msgstr ""
#: paperless_mail/models.py:214
#: paperless_mail/models.py:221
msgid "Specified in days."
msgstr ""
#: paperless_mail/models.py:218
#: paperless_mail/models.py:225
msgid "attachment type"
msgstr ""
#: paperless_mail/models.py:222
#: paperless_mail/models.py:229
msgid ""
"Inline attachments include embedded images, so it's best to combine this "
"option with a filename filter."
msgstr ""
#: paperless_mail/models.py:228
#: paperless_mail/models.py:235
msgid "consumption scope"
msgstr ""
#: paperless_mail/models.py:234
#: paperless_mail/models.py:241
msgid "pdf layout"
msgstr ""
#: paperless_mail/models.py:247
msgid "action"
msgstr ""
#: paperless_mail/models.py:240
#: paperless_mail/models.py:253
msgid "action parameter"
msgstr ""
#: paperless_mail/models.py:245
#: paperless_mail/models.py:258
msgid ""
"Additional parameter for the action selected above, i.e., the target folder "
"of the move to folder action. Subfolders must be separated by dots."
msgstr ""
#: paperless_mail/models.py:253
#: paperless_mail/models.py:266
msgid "assign title from"
msgstr ""
#: paperless_mail/models.py:273
#: paperless_mail/models.py:286
msgid "assign correspondent from"
msgstr ""
#: paperless_mail/models.py:287
#: paperless_mail/models.py:300
msgid "Assign the rule owner to documents"
msgstr ""
#: paperless_mail/models.py:313
#: paperless_mail/models.py:326
msgid "uid"
msgstr ""
#: paperless_mail/models.py:321
#: paperless_mail/models.py:334
msgid "subject"
msgstr ""
#: paperless_mail/models.py:329
#: paperless_mail/models.py:342
msgid "received"
msgstr ""
#: paperless_mail/models.py:336
#: paperless_mail/models.py:349
msgid "processed"
msgstr ""
#: paperless_mail/models.py:342
#: paperless_mail/models.py:355
msgid "status"
msgstr ""

View File

@ -15,12 +15,13 @@ class Migration(migrations.Migration):
name="pdf_layout",
field=models.PositiveIntegerField(
choices=[
(0, "System default"),
(1, "Text, then HTML"),
(2, "HTML, then text"),
(3, "HTML only"),
(4, "Text only"),
],
default=1,
default=0,
verbose_name="pdf layout",
),
),

View File

@ -116,6 +116,7 @@ class MailRule(document_models.ModelWithOwner):
EVERYTHING = 2, _("Process all files, including 'inline' attachments.")
class PdfLayout(models.IntegerChoices):
DEFAULT = 0, _("System default")
TEXT_HTML = 1, _("Text, then HTML")
HTML_TEXT = 2, _("HTML, then text")
HTML_ONLY = 3, _("HTML only")