Skip to content
Snippets Groups Projects
Commit 81aa6d7b authored by Benjamin Ulrich's avatar Benjamin Ulrich :speech_balloon:
Browse files

Merge branch 'm_1085867_mosaico_link_anbindung' into '2021.2.0'

M 1085867 mosaico link anbindung

See merge request xrm/basic!1292
parents 0d2eae09 65113550
No related branches found
No related tags found
No related merge requests found
Showing
with 182 additions and 8 deletions
import("system.vars");
import("system.result");
import("system.neon");
if (vars.get("$field.MOSAICOTEMPLATE_ID"))
{
result.string(neon.COMPONENTSTATE_DISABLED);
}
else
{
result.string(neon.COMPONENTSTATE_EDITABLE)
}
\ No newline at end of file
import("system.translate");
import("system.result");
import("system.vars");
import("Sql_lib");
var latinName = newSelect("NAME_LATIN")
.from("AB_LANGUAGE")
.whereIfSet("AB_LANGUAGE.ISO3", "$field.ISOLANGUAGE")
.cell(true)
result.string(translate.text(latinName));
\ No newline at end of file
import("system.neon");
import("system.vars");
import("system.result");
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null)
{
result.string("deu");
}
\ No newline at end of file
import("system.result");
import("Sql_lib");
result.string(newSelect("MOSAICOTEMPLATE.NAME")
.from("MOSAICOTEMPLATE")
.whereIfSet("MOSAICOTEMPLATE.MOSAICOTEMPLATEID", "$field.MOSAICOTEMPLATE_ID")
.cell(true));
\ No newline at end of file
import("system.vars");
import("system.neon");
import("system.util");
import("system.mail");
import("DocumentTemplate_lib");
import("Entity_lib");
import("EmailUtil_lib");
import("Document_lib");
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT)
{
// note: could not use only the valueProcess from $field.content because then it refreshed $field.content just before save.
// --> only set in $field.content.valueProcess if $field.content is null and set it from here only if MASK triggered change
var fileUpLoad = new FileUpload(vars.get("$field.bindata"));
var content,type,template;
if (fileUpLoad.isFilled())
{
type = DocumentTemplate.types.fromFileExtension(fileUpLoad.fileExtension);
if (type == DocumentTemplate.types.HTML || type == DocumentTemplate.types.TXT || type == DocumentTemplate.types.EML)
{
content = util.decodeBase64String(fileUpLoad.bindata);
}
}
else
{
var mosaicoTemplateId = vars.get("$local.value");
template = DocumentTemplate.loadTemplate(mosaicoTemplateId, "MOSAICOTEMPLATE", false);
if (template != null)
{
type = template.type;
if (type == DocumentTemplate.types.HTML || type == DocumentTemplate.types.TXT || type == DocumentTemplate.types.EML)
{
content = util.decodeBase64String(template.content);
}
}
}
if(content)
{
vars.set("$field.templateType", type);
vars.set("$field.content", content);
}
}
\ No newline at end of file
import("system.vars");
import("system.result");
import("system.neon");
if (vars.get("$field.DOCUMENTTEMPLATE_ID"))
{
result.string(neon.COMPONENTSTATE_DISABLED);
}
else
{
result.string(neon.COMPONENTSTATE_EDITABLE)
}
\ No newline at end of file
import("Util_lib");
import("system.result");
import("system.vars");
if (vars.get("$param.CreateFromMosaicoTemplateId_param") && Utils.isNullOrEmptyString(vars.get("$this.value")))
{
result.string(vars.get("$param.CreateFromMosaicoTemplateId_param"));
}
\ No newline at end of file
...@@ -21,7 +21,24 @@ if (!vars.get("$this.value") && vars.get("$sys.recordstate") == neon.OPERATINGST ...@@ -21,7 +21,24 @@ if (!vars.get("$this.value") && vars.get("$sys.recordstate") == neon.OPERATINGST
var name = entities.getRows(conf); var name = entities.getRows(conf);
if (name.length > 0) if (name.length > 0)
{
name = name[0].NAME; name = name[0].NAME;
}
result.string(name);
}
else if (vars.get("$field.MOSAICOTEMPLATE_ID"))
{
let conf = entities.createConfigForLoadingRows();
conf.entity("MosaicoTemplate_entity")
.fields(["NAME"])
.uid(vars.get("$field.MOSAICOTEMPLATE_ID"));
let name = entities.getRows(conf);
if (name.length > 0)
{
name = name[0].NAME;
}
result.string(name); result.string(name);
} }
......
import("system.neon");
import("system.vars")
var params = {
"BulkMailId_param": vars.get("$field.BULKMAILID")
};
neon.openContext("BulkMailAddMosaico", "BulkMailAddMosaicoEdit_view",null, neon.OPERATINGSTATE_VIEW, params, null);
\ No newline at end of file
import("system.vars");
import("system.neon");
import("system.result");
if (vars.get("$field.MOSAICOTEMPLATE_ID" || vars.get("$field.DOCUMENTTEMPLATE_ID") || vars.get("$field.content")))
{
result.string( neon.COMPONENTSTATE_INVISIBLE);
}
else
{
result.string(neon.COMPONENTSTATE_EDITABLE);
}
\ No newline at end of file
import("system.vars");
import("system.neon");
import("MosaicoTemplate_lib")
MosaicoUtils.openInMosaico(vars.get("$field.MOSAICOTEMPLATE_ID"));
\ No newline at end of file
import("system.vars");
import("system.neon"); import("system.neon");
import("system.result"); import("system.result");
import("system.project");
if (project.getPreferenceValue("custom.mosaico.url") != "") if (vars.get("$field.MOSAICOTEMPLATE_ID"))
{ {
result.string( neon.COMPONENTSTATE_EDITABLE); result.string( neon.COMPONENTSTATE_EDITABLE);
} }
......
import("system.neon");
import("system.project");
neon.openUrl(project.getPreferenceValue("custom.mosaico.url"),true);
\ No newline at end of file
...@@ -6,6 +6,7 @@ import("system.vars"); ...@@ -6,6 +6,7 @@ import("system.vars");
/* Processes that can also set the value of this field: /* Processes that can also set the value of this field:
* - bindata.onValueChange * - bindata.onValueChange
* - DOCUMENTTEMPLATE_ID.onValueChange * - DOCUMENTTEMPLATE_ID.onValueChange
* - MOSAICOTEMPLATE_ID.onVAlueChange
*/ */
if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET) if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET)
......
import("Sql_lib");
import("system.result"); import("system.result");
result.string("BULKMAIL left join DOCUMENTTEMPLATE on BULKMAIL.DOCUMENTTEMPLATE_ID = DOCUMENTTEMPLATE.DOCUMENTTEMPLATEID"); var from = new SqlBuilder()
\ No newline at end of file .from("BULKMAIL")
.leftJoin("DOCUMENTTEMPLATE", "BULKMAIL.DOCUMENTTEMPLATE_ID = DOCUMENTTEMPLATE.DOCUMENTTEMPLATEID")
.leftJoin("MOSAICOTEMPLATE", "BULKMAIL.MOSAICOTEMPLATE_ID = MOSAICOTEMPLATE.MOSAICOTEMPLATEID")
result.string(from.toString());
\ No newline at end of file
...@@ -19,8 +19,9 @@ var rowdata = vars.get("$local.rowdata"); ...@@ -19,8 +19,9 @@ var rowdata = vars.get("$local.rowdata");
var bulkMailId = rowdata["BULKMAIL.BULKMAILID"]; var bulkMailId = rowdata["BULKMAIL.BULKMAILID"];
var templateId = rowdata["BULKMAIL.DOCUMENTTEMPLATE_ID"]; var templateId = rowdata["BULKMAIL.DOCUMENTTEMPLATE_ID"];
var bulkMailName = rowdata["BULKMAIL.NAME"]; var bulkMailName = rowdata["BULKMAIL.NAME"];
var mosaicoTemplateId = rowdata["BULKMAIL.MOSAICOTEMPLATE_ID"];
var template = BulkMailUtils.getBulkMailTemplate(bulkMailId, templateId, false, false, new FileUpload(bindata)); var template = BulkMailUtils.getBulkMailTemplate(bulkMailId, templateId, false, false, new FileUpload(bindata), mosaicoTemplateId);
if (content) if (content)
template.content = util.encodeBase64String(content); template.content = util.encodeBase64String(content);
......
import("system.result");
import("Keyword_lib");
result.string(LanguageKeywordUtils.getResolvedTitleSqlPart("BULKMAIL.ISOLANGUAGE"));
\ No newline at end of file
import("system.result");
import("Sql_lib");
result.string(newSelect("MOSAICOTEMPLATE.NAME")
.from("MOSAICOTEMPLATE")
.whereIfSet("MOSAICOTEMPLATE.MOSAICOTEMPLATEID = BULKMAIL.MOSAICOTEMPLATE_ID")
.toString());
\ No newline at end of file
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
<entityField> <entityField>
<name>BINDATA</name> <name>BINDATA</name>
<contentType>FILE</contentType> <contentType>FILE</contentType>
<valueProcess>%aditoprj%/entity/DocumentTemplate_entity/entityfields/bindata/valueProcess.js</valueProcess>
<onValueChange>%aditoprj%/entity/DocumentTemplate_entity/entityfields/bindata/onValueChange.js</onValueChange> <onValueChange>%aditoprj%/entity/DocumentTemplate_entity/entityfields/bindata/onValueChange.js</onValueChange>
<onValueChangeTypes> <onValueChangeTypes>
<element>MASK</element> <element>MASK</element>
...@@ -348,6 +349,10 @@ ...@@ -348,6 +349,10 @@
<name>IncludeDocumentTemplateIds_param</name> <name>IncludeDocumentTemplateIds_param</name>
<expose v="true" /> <expose v="true" />
</entityParameter> </entityParameter>
<entityParameter>
<name>CreateFromMosaicoTemplateId_param</name>
<expose v="true" />
</entityParameter>
</entityFields> </entityFields>
<recordContainers> <recordContainers>
<dbRecordContainer> <dbRecordContainer>
......
import("Util_lib");
import("system.result");
import("DocumentTemplate_lib");
import("system.vars");
if (vars.get("$param.CreateFromMosaicoTemplateId_param") && Utils.isNullOrEmptyString(vars.get("$this.value")))
{
template = DocumentTemplate.loadTemplate(vars.get("$param.CreateFromMosaicoTemplateId_param"), "MOSAICOTEMPLATE", false)
result.string([template.filename, template.content, template.mimeType].join(";"));
}
\ 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