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

refactor Lead Import lib - convert to new lib-style

parent ac0f7602
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,7 @@ if(bindata != '' && filename != '')
if (mimeType == "application/vnd.ms-excel")
{
SingleBinaryUtils.insertMainDocument("LEADIMPORT", "", assignmentRowId, bindata, filename, "");
LoadImportFile(vars.get("$field.bindata"), fieldSep, fieldLimit, recordSep, assignmentRowId);
LeadImportUtils.loadImportFile(vars.get("$field.bindata"), fieldSep, fieldLimit, recordSep, assignmentRowId);
}
}
......@@ -26,7 +26,7 @@ if(bindata != '' && filename != '')
.buildSql("select ID from ASYS_BINARIES", "1=2"), SqlUtils.getBinariesAlias());
db.updateBinary(binId, "", bindata, filename, "", "MAINDOCUMENT", SqlUtils.getBinariesAlias());
LoadImportFile(vars.get("$field.bindata"), fieldSep, fieldLimit, recordSep, assignmentRowId, true, vars.get("$param.LeadimportNewFile_param"));
LeadImportUtils.loadImportFile(vars.get("$field.bindata"), fieldSep, fieldLimit, recordSep, assignmentRowId, true, vars.get("$param.LeadimportNewFile_param"));
}
}
This diff is collapsed.
......@@ -39,14 +39,14 @@ var DataFieldCount = data[0].length;
// Attributes that should be created for Organisations and persons
var AttrObject = getLeadAttr(importdefid);
var FieldDef = AddArray(ImportFieldDef, new Array(DataFieldCount++, "SOURCE", ""));
var FieldDef = LeadImportUtils.addArray(ImportFieldDef, new Array(DataFieldCount++, "SOURCE", ""));
FieldDef.push(new Array(DataFieldCount++, "DATE_NEW", ""));
// für Tabellen Felder und Typen ermitteln
var DataTables = new Array("ORGANISATION", "PERSON", "CONTACT", "ADDRESS", "LEAD", "COMMUNICATION", "AB_ATTRIBUTERELATION");
var DataFields = GetDataFields(DataTables);
var DataTypes = GetDataTypes(DataFields, DataTables);
var DataFields = LeadImportUtils.getDataFields(DataTables);
var DataTypes = LeadImportUtils.getDataTypes(DataFields, DataTables);
// Check if a BUILDINGNO is declared
var addressPos = getFieldPos(ImportFieldDef, "ADDRESS");
......@@ -74,7 +74,7 @@ try
for (; dsanz < data.length; dsanz++)
{
//iterate over the fielddefinitions and set the values
var impvalues = AddArray(data[dsanz], source);
var impvalues = LeadImportUtils.addArray(data[dsanz], source);
impvalues.push(ImportDate);
// if there is no BUILDINGNO the select it from the ADDRESS
......@@ -127,7 +127,7 @@ try
try//import data
{
var dupCheck = ImportData(DataFields, DataTypes, FieldDef, impvalues, importdefid, AttrObject, source, user, currDate);
var dupCheck = LeadImportUtils.importData(DataFields, DataTypes, FieldDef, impvalues, importdefid, AttrObject, source, user, currDate);
allContactData[dupCheck[0]] = [dupCheck[1], dupCheck[2]]; //persObj, orgObj
}
......@@ -173,7 +173,6 @@ if(exeptions != "")//insert error document
if (userId)// if there is an user - show a notification to this user when the import is complete
{
var description = translate.withArguments("%0 leads imported, %1 errors", [rows, errorCount]);
logging.log(JSON.stringify([exeptions], null, "\t"))
notification.addNotification(util.getNewUUID(), null, null, null, "LeadImport_Notification", notification.PRIO_NORMAL, 2, notification.STATE_UNSEEN, [userId], importName, description);
}
......
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