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

Lead import: preset value of bindata by the file from db

parent 693cc6e8
No related branches found
No related tags found
No related merge requests found
......@@ -53,7 +53,7 @@
<name>bindata</name>
<title>File</title>
<contentType>FILE</contentType>
<mandatory v="true" />
<valueProcess>%aditoprj%/entity/Leadimport_entity/entityfields/bindata/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/Leadimport_entity/entityfields/bindata/displayValueProcess.js</displayValueProcess>
</entityField>
<entityField>
......
import("system.neon");
import("Sql_lib");
import("system.result");
import("system.vars");
import("system.db");
import("Document_lib");
if (vars.get("$sys.recordstate") && vars.get("$sys.recordstate") != neon.OPERATINGSTATE_NEW)
{
var binMetadatas = db.getBinaryMetadata("LEADIMPORT", "IMPORTFILE", vars.get("$field.LEADIMPORTID"), false, SqlUtils.getBinariesAlias(), "");
if (binMetadatas.length > 0)
{
// preset with data from db. This is mostly to allow just editing the other fields without uploading a file (because this field is mandatory)
var resultValue = binMetadatas[0].filename;
resultValue += ";" + db.getBinaryContent(binMetadatas[0].id, SqlUtils.getBinariesAlias());
resultValue += ";" + binMetadatas[0].mimetype;
result.string(resultValue);
} else {
result.string("FILE MISSING");
}
}
\ No newline at end of file
......@@ -101,7 +101,6 @@ LeadImportUtils.loadImportFile = function(pBinId, pFieldSep, pFieldLimit, pRecor
var data = db.getBinaryContent(pBinId, SqlUtils.getBinariesAlias());
data = util.decodeBase64String(data, "UTF-8");
var table = text.parseCSV( data.replace(/(^\s+)|(\s+$)/g,""), pRecordSep, pFieldSep, pFieldLimit.charAt(0));
logging.log(JSON.stringify([table], null, "\t"))
if(pNewFile != "true")
{
if(pUpdate) {
......@@ -327,6 +326,7 @@ LeadImportUtils.getImportFieldDef = function(pID)
for (let i = 0; i < ImportFieldDef.length; i++)
{
FieldDef[i] = new Array (ImportFieldDef[i][0], ImportFieldDef[i][1])
// TODO: this could be done using the Keyword Attributes instead of doing cracy substinging etc...
if(ImportFieldDef[i][1].substr(0, 9) == "ATTRIBUTE")//ATTRIBUTES are defined like ATTRIBUTE_Loyalty
{
var attrName = ImportFieldDef[i][1].substr(10);// so cut the first 10 characters off to get the ATTRIBUTENAME "Loyalty"
......
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