Skip to content
Snippets Groups Projects
Commit 6d4ed163 authored by Johannes Hörmann's avatar Johannes Hörmann
Browse files

Serial letter fixes

parent f70a9f2a
No related branches found
No related tags found
No related merge requests found
import("system.neon");
import("system.translate");
import("system.result");
import("system.logging");
......@@ -6,7 +7,7 @@ import("Bulkmail_lib");
import("DocumentTemplate_lib");
import("KeywordRegistry_basic");
if (vars.exists("$context.currentTemplateType"))
if (vars.exists("$context.currentTemplateType") && (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT))
{
var kind = vars.get("$field.KIND");
var classification = vars.get("$field.CLASSIFICATION");
......
......@@ -12,6 +12,7 @@
<title>Serial letter</title>
<consumer>SerialLetters</consumer>
<mandatory v="true" />
<displayValueProcess>%aditoprj%/entity/SerialLetterAddRecipients_entity/entityfields/serialletter_id/displayValueProcess.js</displayValueProcess>
</entityField>
<entityField>
<name>UID</name>
......
import("system.vars");
import("Sql_lib");
import("system.db");
import("system.result");
if (vars.get("$this.value"))
result.string(db.cell(SqlCondition.begin().andPrepare("SERIALLETTER.SERIALLETTERID", vars.get("$this.value")).buildSql("select TITLE from SERIALLETTER")));
else
result.string("");
\ No newline at end of file
......@@ -62,6 +62,16 @@
<entityName>DocumentTemplate_entity</entityName>
<fieldName>DocumentTemplateProvider</fieldName>
</dependency>
<children>
<entityParameter>
<name>DocumentTemplateType_param</name>
<valueProcess>%aditoprj%/entity/SerialLetter_entity/entityfields/templates/children/documenttemplatetype_param/valueProcess.js</valueProcess>
</entityParameter>
<entityParameter>
<name>DocumentTemplateTypeClassification_param</name>
<valueProcess>%aditoprj%/entity/SerialLetter_entity/entityfields/templates/children/documenttemplatetypeclassification_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
<entityField>
<name>TITLE</name>
......
import("KeywordRegistry_basic");
import("system.result");
result.string($KeywordRegistry.documentTemplateType$letter());
\ No newline at end of file
import("KeywordRegistry_basic");
import("system.result");
result.string($KeywordRegistry.documentTemplateTypeCategory$serial());
\ No newline at end of file
import("system.neon");
import("system.result");
import("system.vars");
import("DocumentTemplate_lib");
[content, type] = DocumentTemplateUtils.getTemplateContent(vars.get("$field.DOCUMENTTEMPLATE_ID"), new FileUpload(vars.get("$field.bindata")));
if (type != DocumentTemplate.types.ODT)
result.string(DocumentTemplate.serialLetterODTOnlyMessage())
\ No newline at end of file
if (type != DocumentTemplate.types.ODT && (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT))
result.string(DocumentTemplate.serialLetterODTOnlyMessage());
\ No newline at end of file
......@@ -308,7 +308,7 @@ DocumentTemplate.prototype.getReplacedContent = function (pReplacements, pEncode
return emlContent;
}
case DocumentTemplate.types.HTML:
// replaces ä, ö, ü, ... with html escape signs
// replaces ä, ö, ü, ... with html escape signs
for (let i in pReplacements)
pReplacements[i] = text.text2html(pReplacements[i], false);
case DocumentTemplate.types.TXT:
......@@ -397,6 +397,10 @@ DocumentTemplate.prototype.getSerialLetterByContactIds = function (pContactIds,
{
if (this.type == DocumentTemplate.types.ODT)
{
let replacements = TemplateHelper._getReplacementsByContactIds(this, pContactIds);
let replaceArray = [];
for (let i = 0, l = pContactIds.length; i < l; i++)
replaceArray.push(replacements[pContactIds[i]]);
return TemplateHelper._getReplacedODT(this, replaceArray, pTableData);
}
......@@ -849,4 +853,4 @@ DocumentTemplateUtils.getContentType = function (pTemplateId, pFileUpload)
}
return type;
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment