Skip to content
Snippets Groups Projects
Commit b4a0e9fa authored by Sebastian Pongratz's avatar Sebastian Pongratz :ping_pong:
Browse files

#1060627-LeadimportMappingassistent Lib Documentation

parent 595be8f6
No related branches found
No related tags found
No related merge requests found
......@@ -153,6 +153,7 @@ LeadImportUtils.loadImportFile = function(pBinId, pFieldSep, pFieldLimit, pRecor
*/
LeadImportUtils.importData = function(pDataFields, pDataTypes, pFieldDef, pFieldValues, pImportDefID, pAttrObject, pSource, pUser, pDate)
{
// set the mappings
LeadImportUtils.mapping = LeadImportUtils.getMapping(pImportDefID);
var LeadValues = LeadImportUtils.setValues(pDataFields["LEAD"], pFieldDef, pFieldValues); // set the Lead values
......@@ -222,6 +223,14 @@ LeadImportUtils.importData = function(pDataFields, pDataTypes, pFieldDef, pField
return [leadId, persForDubCheck, orgsForDubCheck];
}
/**
* get all Mapping to a Leadimport
*
* @param {String} pleadimportId the ID of a Leadimport
*
* @return {Object} an associative array in format arr[fieldname][inputvalue] --> outputvalue
*/
LeadImportUtils.getMapping = function(pleadimportId)
{
let tempData = {};
......@@ -230,7 +239,7 @@ LeadImportUtils.getMapping = function(pleadimportId)
.where("LEADIMPORTMAPPINGASSISTANT.LEADIMPORT_ID", pleadimportId)
.table().forEach(function (d) {
if (tempData[d[0]] == undefined )
tempData[d[0]] = {} //[[d[1], d[2]]]
tempData[d[0]] = {}
tempData[d[0]][d[1]] = d[2];
});
return tempData;
......@@ -325,6 +334,7 @@ LeadImportUtils.setValues = function(pFields, pFieldDef, pFieldValues)
LeadImportUtils.mapping[pFieldDef[i][1]] != undefined &&
LeadImportUtils.mapping[pFieldDef[i][1]][pFieldValues[pFieldDef[i][0]]] != undefined)
{
// mapping is available and is set
pFieldValues[pFieldDef[i][0]] = LeadImportUtils.mapping[pFieldDef[i][1]][pFieldValues[pFieldDef[i][0]]];
}
......
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