Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
basic
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
xrm
basic
Commits
14867622
Commit
14867622
authored
5 years ago
by
Johannes Hörmann
Browse files
Options
Downloads
Patches
Plain Diff
LeadImport_lib: consistent code & comment format
parent
1735f7a4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
process/Leadimport_lib/process.js
+280
-281
280 additions, 281 deletions
process/Leadimport_lib/process.js
with
280 additions
and
281 deletions
process/Leadimport_lib/process.js
+
280
−
281
View file @
14867622
...
...
@@ -70,19 +70,19 @@ LeadImportUtils.leadTempColumns = function()
];
}
/*
* Load the data
*
* @param {String} pBinId
req
the binary id for loading the binary
* @param {String} pFieldSep
req
the fieldSeparator
* @param {String} pFieldLimit
req
the fieldLimit
* @param {String} pRecordSep
req
the recordSeparator
* @param {String} pLeadImportId
req
the leadimportid
* @param {String} pUpdate
req
checks if the Import fields should be deleted or not
* @param {String} pNewFile
req
checks if the Import fields should be deleted/updated or not
*
* @return {integer} rows the number of rows which have been inserted
*/
/*
*
* Load the data
*
* @param {String} pBinId the binary id for loading the binary
* @param {String} pFieldSep the fieldSeparator
* @param {String} pFieldLimit the fieldLimit
* @param {String} pRecordSep the recordSeparator
* @param {String} pLeadImportId the leadimportid
* @param {String} pUpdate checks if the Import fields should be deleted or not
* @param {String} pNewFile checks if the Import fields should be deleted/updated or not
*
* @return {integer} rows the number of rows which have been inserted
*/
LeadImportUtils
.
loadImportFile
=
function
(
pBinId
,
pFieldSep
,
pFieldLimit
,
pRecordSep
,
pLeadImportId
,
pUpdate
,
pNewFile
)
{
var
rows
=
0
;
...
...
@@ -100,7 +100,7 @@ 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
));
var
table
=
text
.
parseCSV
(
data
.
replace
(
/
(
^
\s
+
)
|
(\s
+$
)
/g
,
""
),
pRecordSep
,
pFieldSep
,
pFieldLimit
.
charAt
(
0
));
if
(
pNewFile
!=
"
true
"
)
{
if
(
pUpdate
)
{
...
...
@@ -126,25 +126,25 @@ LeadImportUtils.loadImportFile = function(pBinId, pFieldSep, pFieldLimit, pRecor
return
rows
;
}
/*
* processes an import record
*
* @param {Object} pDataFields
req
Objekt von DBFelder
* @param {Object} pDataTypes
req
Objekt von DBTypes
* @param {Object} pFieldDef
req
Zuordnung der Importfelder
* @param {Object} pFieldValues
req
ImportWerte
* @param {String} pImportDefID
req
* @param {Object} pAttrObject
req
* @param {String} pSource the importSource
* @param {String} pUser
req
the importuser
* @param {String} pDate
req
the importdate
*
* @return {Array} returns an array with the leadid in the first place,
* the personobject for duplicate checking in the second place
* and the organisationobject for duplicate checking in the third place
*
*/
LeadImportUtils
.
importData
=
function
(
pDataFields
,
pDataTypes
,
pFieldDef
,
pFieldValues
,
pImportDefID
,
pAttrObject
,
pSource
,
pUser
,
pDate
)
/*
*
* processes an import record
*
* @param {Object} pDataFields Objekt von DBFelder
* @param {Object} pDataTypes Objekt von DBTypes
* @param {Object} pFieldDef Zuordnung der Importfelder
* @param {Object} pFieldValues ImportWerte
* @param {String} pImportDefID
* @param {Object} pAttrObject
* @param {String} pSource the importSource
* @param {String} pUser the importuser
* @param {String} pDate the importdate
*
* @return {Array} returns an array with the leadid in the first place,
* the personobject for duplicate checking in the second place
* and the organisationobject for duplicate checking in the third place
*
*/
LeadImportUtils
.
importData
=
function
(
pDataFields
,
pDataTypes
,
pFieldDef
,
pFieldValues
,
pImportDefID
,
pAttrObject
,
pSource
,
pUser
,
pDate
)
{
var
LeadValues
=
LeadImportUtils
.
setValues
(
pDataFields
[
"
LEAD
"
],
pFieldDef
,
pFieldValues
);
// set the Lead values
...
...
@@ -160,7 +160,7 @@ LeadImportUtils.importData = function(pDataFields, pDataTypes, pFieldDef, pField
var
persRet
;
//------create organisation
if
(
LeadValues
[
"
NAME
"
]
!=
""
)
//only if Organame is filled
if
(
LeadValues
[
"
NAME
"
]
!=
""
)
//only if Organame is filled
{
orgObjID
=
"
Organisation
"
;
//for attribute
orgRet
=
LeadImportUtils
.
insertOrg
(
pDataFields
,
pDataTypes
,
pFieldDef
,
pFieldValues
,
pUser
,
pDate
);
...
...
@@ -176,7 +176,7 @@ LeadImportUtils.importData = function(pDataFields, pDataTypes, pFieldDef, pField
}
}
//------create person
if
(
LeadValues
[
"
LASTNAME
"
]
!=
""
)
//only if lastname is filled
if
(
LeadValues
[
"
LASTNAME
"
]
!=
""
)
//only if lastname is filled
{
persObjID
=
"
Person
"
;
//for attribute
persRet
=
LeadImportUtils
.
insertPers
(
pDataFields
,
pDataTypes
,
pFieldDef
,
pFieldValues
,
orgid
,
LeadValues
,
pUser
,
pDate
);
...
...
@@ -213,14 +213,14 @@ LeadImportUtils.importData = function(pDataFields, pDataTypes, pFieldDef, pField
return
[
leadId
,
persForDubCheck
,
orgsForDubCheck
];
}
/*
* adds two arrays
*
* @param {[]} pArray
req
the first array
* @param {[]} pAddArray
req
the second array
*
* @return {[]} new Array
*/
/*
*
* adds two arrays
*
* @param {[]} pArray the first array
* @param {[]} pAddArray the second array
*
* @return {[]} new Array
*/
LeadImportUtils
.
addArray
=
function
(
pArray
,
pAddArray
)
{
var
NewArray
=
new
Array
()
...
...
@@ -230,13 +230,13 @@ LeadImportUtils.addArray = function(pArray, pAddArray)
return
NewArray
;
}
/*
* returns object with columns of the specified tables
*
* @param {[]} pDataTables
req
Array of TableNames
*
* @return {Object} Object with columns
*/
/*
*
* returns object with columns of the specified tables
*
* @param {[]} pDataTables Array of TableNames
*
* @return {Object} Object with columns
*/
LeadImportUtils
.
getDataFields
=
function
(
pDataTables
)
{
var
DataFields
=
new
Object
();
...
...
@@ -253,14 +253,14 @@ LeadImportUtils.getDataFields = function(pDataTables)
return
DataFields
;
}
/*
* returns object with column types of the specified tables
*
* @param {[]} pDataTables
req
Array of TableNames
* @param {[]} pDataFields
req
Array of TableColumns
*
* @return {Object} object of the column types
*/
/*
*
* returns object with column types of the specified tables
*
* @param {[]} pDataTables Array of TableNames
* @param {[]} pDataFields Array of TableColumns
*
* @return {Object} object of the column types
*/
LeadImportUtils
.
getDataTypes
=
function
(
pDataFields
,
pDataTables
)
{
var
DataTypes
=
new
Object
();
...
...
@@ -272,15 +272,15 @@ LeadImportUtils.getDataTypes = function(pDataFields, pDataTables)
}
/*
* sets values for a table
*
* @param {String []} pFields
req
fields
* @param {String []} pFieldDef
req
assignment of import fields
* @param {String []} pFieldValues
req
import values
*
* @return {Object} Object with the assigned values
*/
/*
*
* sets values for a table
*
* @param {String []} pFields fields
* @param {String []} pFieldDef assignment of import fields
* @param {String []} pFieldValues import values
*
* @return {Object} Object with the assigned values
*/
LeadImportUtils
.
setValues
=
function
(
pFields
,
pFieldDef
,
pFieldValues
)
{
var
DataValues
=
new
Object
();
...
...
@@ -306,13 +306,13 @@ LeadImportUtils.setValues = function(pFields, pFieldDef, pFieldValues)
return
DataValues
;
}
/*
* returns import fields
*
* @param {String} pID
req
ImportID
*
* @return {[]} ImportFieldDef
*/
/*
*
* returns import fields
*
* @param {String} pID ImportID
*
* @return {[]} ImportFieldDef
*/
LeadImportUtils
.
getImportFieldDef
=
function
(
pID
)
{
var
ImportFieldDef
=
newSelect
([
"
distinct FIELDNUMBER
"
,
SqlMaskingUtils
.
prototype
.
trim
(
"
MAPPINGFIELD
"
),
"
''
"
])
...
...
@@ -351,20 +351,20 @@ LeadImportUtils.getImportFieldDef = function(pID)
return
FieldDef
;
}
/*
* Attribute anlegen.
*
* @param {Object} pDataFields
req
Object of columns
* @param {Object} pDataTypes
req
Object of types
* @param {[]} pFieldDef
req
assignment of import fields
* @param {[]} pLeadValues
req
the lead values
* @param {String} pContactId
req
CONTACTID
* @param {String} pObjectID
req
ID of the object
* @param {String} pUser
req
the importuser
* @param {String} pDate
req
the importdate
*
* @return {void}
*/
/*
*
* Attribute anlegen.
*
* @param {Object} pDataFields Object of columns
* @param {Object} pDataTypes Object of types
* @param {[]} pFieldDef assignment of import fields
* @param {[]} pLeadValues the lead values
* @param {String} pContactId CONTACTID
* @param {String} pObjectID ID of the object
* @param {String} pUser the importuser
* @param {String} pDate the importdate
*
* @return {void}
*/
LeadImportUtils
.
insertAttr
=
function
(
pDataFields
,
pDataTypes
,
pFieldDef
,
pLeadValues
,
pContactId
,
pObjectID
,
pUser
,
pDate
)
{
var
Fields
=
pDataFields
[
"
AB_ATTRIBUTERELATION
"
];
...
...
@@ -411,18 +411,19 @@ LeadImportUtils.insertAttr = function(pDataFields, pDataTypes, pFieldDef, pLeadV
}
}
}
/*
* creates a communication
*
* @param {Object} pDataFields req Object of columns
* @param {Object} pDataTypes req Object of types
* @param {Object} pLeadValues req the lead values
* @param {String} contactId req CONTACTID
* @param {String} pUser req the importuser
* @param {String} pDate req the importdate
*
* @return {void}
*/
/**
* creates a communication
*
* @param {Object} pDataFields Object of columns
* @param {Object} pDataTypes Object of types
* @param {Object} pLeadValues the lead values
* @param {String} contactId CONTACTID
* @param {String} pUser the importuser
* @param {String} pDate the importdate
*
* @return {void}
*/
LeadImportUtils
.
insertComm
=
function
(
pDataFields
,
pDataTypes
,
pLeadValues
,
contactId
,
pUser
,
pDate
)
{
var
Fields
=
pDataFields
[
"
COMMUNICATION
"
];
...
...
@@ -438,7 +439,7 @@ LeadImportUtils.insertComm = function(pDataFields, pDataTypes, pLeadValues, cont
{
var
medium
=
commMedium
[
i
][
0
].
trim
();
//e. g. COMMMOBIL, COMMMAIL
if
(
pLeadValues
[
medium
]
!=
undefined
&&
pLeadValues
[
medium
]
!=
""
)
if
(
pLeadValues
[
medium
]
!=
undefined
&&
pLeadValues
[
medium
]
!=
""
)
{
DataValues
[
"
MEDIUM_ID
"
]
=
medium
;
//e. g. COMMMOBIL
DataValues
[
"
ADDR
"
]
=
pLeadValues
[
medium
];
//e. g. +49 123 45678900
...
...
@@ -449,18 +450,18 @@ LeadImportUtils.insertComm = function(pDataFields, pDataTypes, pLeadValues, cont
}
}
/*
* creates an organisation
*
* @param {Object} pDataFields
req
Object of columns
* @param {Object} pDataTypes
req
Object of types
* @param {Object} pFieldDef
req
assignment of import fields
* @param {Object} pFieldValues
req
Object of values
* @param {String} pUser
req
the importuser
* @param {String} pDate
req
the importdate
*
* @return {String[]} [organisationId, contactId, duplicateMapping, true/false]
*/
/*
*
* creates an organisation
*
* @param {Object} pDataFields Object of columns
* @param {Object} pDataTypes Object of types
* @param {Object} pFieldDef assignment of import fields
* @param {Object} pFieldValues Object of values
* @param {String} pUser the importuser
* @param {String} pDate the importdate
*
* @return {String[]} [organisationId, contactId, duplicateMapping, true/false]
*/
LeadImportUtils
.
insertOrg
=
function
(
pDataFields
,
pDataTypes
,
pFieldDef
,
pFieldValues
,
pUser
,
pDate
)
{
//Organisation
...
...
@@ -473,7 +474,7 @@ LeadImportUtils.insertOrg = function(pDataFields, pDataTypes, pFieldDef, pField
var
orgid
=
LeadImportUtils
.
insertTable
(
pDataFields
,
pDataTypes
,
OrgValues
,
"
ORGANISATION
"
,
pUser
,
pDate
);
//contact
var
ContactValues
=
LeadImportUtils
.
setValues
(
pDataFields
[
"
CONTACT
"
],
pFieldDef
,
pFieldValues
);
var
ContactValues
=
LeadImportUtils
.
setValues
(
pDataFields
[
"
CONTACT
"
],
pFieldDef
,
pFieldValues
);
ContactValues
[
"
STATUS
"
]
=
"
CONTACTSTATACTIVE
"
;
ContactValues
[
"
ORGANISATION_ID
"
]
=
orgid
;
ContactValues
[
"
ADDRESS_ID
"
]
=
util
.
getNewUUID
();
...
...
@@ -481,7 +482,7 @@ LeadImportUtils.insertOrg = function(pDataFields, pDataTypes, pFieldDef, pField
var
contactId
=
LeadImportUtils
.
insertTable
(
pDataFields
,
pDataTypes
,
ContactValues
,
"
CONTACT
"
,
pUser
,
pDate
);
//address
var
AddrValues
=
LeadImportUtils
.
setValues
(
pDataFields
[
"
ADDRESS
"
],
pFieldDef
,
pFieldValues
);
var
AddrValues
=
LeadImportUtils
.
setValues
(
pDataFields
[
"
ADDRESS
"
],
pFieldDef
,
pFieldValues
);
AddrValues
[
"
ADDRESSID
"
]
=
ContactValues
[
"
ADDRESS_ID
"
];
AddrValues
[
"
ADDR_TYPE
"
]
=
"
OFFICEADDR
"
;
...
...
@@ -497,20 +498,20 @@ LeadImportUtils.insertOrg = function(pDataFields, pDataTypes, pFieldDef, pField
return
new
Array
(
ids
[
0
],
ids
[
1
]
,
entityFieldValues
,
false
);
}
/*
* creates a person
*
* @param {Object} pDataFields
req
Object of columns
* @param {Object} pDataTypes
req
Object of types
* @param {Object} pFieldDef
req
assignment of import fields
* @param {Object} pFieldValues
req
Object of values
* @param {String} pOrgId the OrganisationId
* @param {Object} pLeadValues the LeadValues
* @param {String} pUser
req
the importuser
* @param {String} pDate
req
the importdate
*
* @return {String []} (
personId, contactId, duplicateMapping)
*/
/*
*
* creates a person
*
* @param {Object} pDataFields Object of columns
* @param {Object} pDataTypes Object of types
* @param {Object} pFieldDef assignment of import fields
* @param {Object} pFieldValues Object of values
* @param {String} pOrgId the OrganisationId
* @param {Object} pLeadValues the LeadValues
* @param {String} pUser the importuser
* @param {String} pDate the importdate
*
* @return {String []} (personId, contactId, duplicateMapping)
*/
LeadImportUtils
.
insertPers
=
function
(
pDataFields
,
pDataTypes
,
pFieldDef
,
pFieldValues
,
pOrgId
,
pLeadValues
,
pUser
,
pDate
)
{
var
isoLanguage
=
LeadImportUtils
.
checkISOLanguage
(
pLeadValues
[
"
ISOLANGUAGE
"
]);
...
...
@@ -551,18 +552,18 @@ LeadImportUtils.insertPers = function(pDataFields, pDataTypes, pFieldDef, pFiel
return
new
Array
(
persid
,
contactId
,
entityFieldValues
);
}
/*
* Inserts a dataset
*
* @param {Object} pDataFields
req
Object of columns
* @param {Object} pDataTypes
req
Object of types
* @param {Object} pValues
req
Object of values
* @param {String} pTable
req
Table
* @param {String} pUser
req
the importuser
* @param {String} pDate
req
the importdate
*
* @return {String} Tableid
*/
/*
*
* Inserts a dataset
*
* @param {Object} pDataFields Object of columns
* @param {Object} pDataTypes Object of types
* @param {Object} pValues Object of values
* @param {String} pTable Table
* @param {String} pUser the importuser
* @param {String} pDate the importdate
*
* @return {String} Tableid
*/
LeadImportUtils
.
insertTable
=
function
(
pDataFields
,
pDataTypes
,
pValues
,
pTable
,
pUser
,
pDate
)
{
var
Fields
=
pDataFields
[
pTable
];
...
...
@@ -578,11 +579,11 @@ LeadImportUtils.insertTable = function(pDataFields, pDataTypes, pValues, pTable,
pValues
[
"
DATE_NEW
"
]
=
pDate
;
for
(
var
i
=
0
;
i
<
Fields
.
length
;
i
++
)
{
if
(
pValues
[
Fields
[
i
]]
!=
""
&&
Fields
[
i
]
!=
"
DATE_NEW
"
)
if
(
pValues
[
Fields
[
i
]]
!=
""
&&
Fields
[
i
]
!=
"
DATE_NEW
"
)
{
try
{
switch
(
String
(
Types
[
i
]
)
)
switch
(
String
(
Types
[
i
]
)
)
{
// formatting of certain data types, e.g. Date
case
String
(
SQLTYPES
.
DATE
):
...
...
@@ -608,21 +609,21 @@ LeadImportUtils.insertTable = function(pDataFields, pDataTypes, pValues, pTable,
return
pValues
[
TableID
];
}
/*
* preparing the attributedata for insert
*
* @param {Object} pAttrObject
req
the object for the attribute
* @param {String} orgid
req
the ORGANISATIONID
* @param {String} persid
req
the PERSONID
* @param {String} pUser
req
the importuser
* @param {String} pDate
req
the importdate
* @param {Boolean} pInsertOrgAttr
req
true/false checks if an orgAttr should be created or not
*
* @return {void}
*/
/*
*
* preparing the attributedata for insert
*
* @param {Object} pAttrObject the object for the attribute
* @param {String} orgid the ORGANISATIONID
* @param {String} persid the PERSONID
* @param {String} pUser the importuser
* @param {String} pDate the importdate
* @param {Boolean} pInsertOrgAttr true/false checks if an orgAttr should be created or not
*
* @return {void}
*/
LeadImportUtils
.
insertLeadAttr
=
function
(
pAttrObject
,
orgid
,
persid
,
pUser
,
pDate
,
pInsertOrgAttr
)
{
for
(
var
i
=
0
;
i
<
pAttrObject
[
"
Values
"
].
length
;
i
++
)
for
(
var
i
=
0
;
i
<
pAttrObject
[
"
Values
"
].
length
;
i
++
)
{
var
AttrValues
=
pAttrObject
[
"
Values
"
][
i
];
...
...
@@ -654,16 +655,16 @@ LeadImportUtils.insertLeadAttr = function(pAttrObject, orgid, persid, pUser, pD
}
}
/*
* inserts an ATTRIBUTERELATION
*
* @param {Object} pAttrObject
req
the object for the attribute
* @param {[]} pAttrValues
req
values for the attribute
* @param {String} pUser
req
the importuser
* @param {String} pDate
req
the importdate
*
* @return {void}
*/
/*
*
* inserts an ATTRIBUTERELATION
*
* @param {Object} pAttrObject the object for the attribute
* @param {[]} pAttrValues values for the attribute
* @param {String} pUser the importuser
* @param {String} pDate the importdate
*
* @return {void}
*/
LeadImportUtils
.
sqlInsertAttr
=
function
(
pAttrObject
,
pAttrValues
,
pUser
,
pDate
)
{
pAttrValues
[
8
]
=
util
.
getNewUUID
();
...
...
@@ -673,13 +674,13 @@ LeadImportUtils.sqlInsertAttr = function(pAttrObject, pAttrValues, pUser, pDate)
db
.
insertData
(
"
AB_ATTRIBUTERELATION
"
,
pAttrObject
[
"
Fields
"
]
,
pAttrObject
[
"
Types
"
],
pAttrValues
);
}
/*
* returns the object for the leadattribute
*
* @param {String} pImportDefID
req
the ID of the connected dataset
*
* @return {Object} object for the leadattribute
*/
/*
*
* returns the object for the leadattribute
*
* @param {String} pImportDefID the ID of the connected dataset
*
* @return {Object} object for the leadattribute
*/
LeadImportUtils
.
getLeadAttr
=
function
(
pImportDefID
)
{
let
fields
=
[
"
OBJECT_TYPE
"
,
"
AB_ATTRIBUTE_ID
"
,
"
CHAR_VALUE
"
,
"
DATE_VALUE
"
,
"
NUMBER_VALUE
"
,
"
INT_VALUE
"
,
"
ID_VALUE
"
,
"
OBJECT_ROWID
"
,
"
AB_ATTRIBUTERELATIONID
"
,
"
DATE_NEW
"
,
"
USER_NEW
"
];
...
...
@@ -695,15 +696,14 @@ LeadImportUtils.getLeadAttr = function(pImportDefID)
};
}
/*
* Checks if the COUNTRY is a valid one.
* The value is checked against ISO2, ISO3 and NAME_LATIN
*
* @param {String} pCountry req the COUNTRY
*
* @return {String} validated COUNTRY as ISO2, Default is "DE".
*/
/**
* Checks if the COUNTRY is a valid one.
* The value is checked against ISO2, ISO3 and NAME_LATIN
*
* @param {String} pCountry the COUNTRY
*
* @return {String} validated COUNTRY as ISO2, Default is "DE".
*/
LeadImportUtils
.
checkCountry
=
function
(
pCountry
)
{
var
iso2
=
newSelect
(
"
MAX(ISO2)
"
)
// normally there should be only one so MAX is only to be safe here...
...
...
@@ -716,14 +716,14 @@ LeadImportUtils.checkCountry = function(pCountry)
return
iso2
?
iso2
:
"
DE
"
;
}
/*
* Checks if the LANGUAGE is a valid one.
* The value is checked against ISO2, ISO3 and NAME_LATIN
*
* @param {String} pLanguage
req
the LANGUAGE
*
* @return {String} validated LANGUAGE as ISO3. Default is "deu".
*/
/*
*
* Checks if the LANGUAGE is a valid one.
* The value is checked against ISO2, ISO3 and NAME_LATIN
*
* @param {String} pLanguage the LANGUAGE
*
* @return {String} validated LANGUAGE as ISO3. Default is "deu".
*/
LeadImportUtils
.
checkISOLanguage
=
function
(
pLanguage
)
{
var
iso3
=
newSelect
(
"
MAX(ISO3)
"
)
// normally there should be only one so MAX is only to be safe here...
...
...
@@ -737,16 +737,16 @@ LeadImportUtils.checkISOLanguage = function(pLanguage)
}
/*
* mapping for the duplicate search for ORGANISATION
* maps the DB-Field to the ENTITY-Field
*
* @param {Object} pOrgDataFields the the ORGANISATION values;
* @param {Object} pContactDataFields the CONTACT values;
* @param {Object} pAddressDataFields the ADDRESS values;
*
* @return {Object} the mapping
*/
/*
*
* mapping for the duplicate search for ORGANISATION
* maps the DB-Field to the ENTITY-Field
*
* @param {Object} pOrgDataFields the the ORGANISATION values;
* @param {Object} pContactDataFields the CONTACT values;
* @param {Object} pAddressDataFields the ADDRESS values;
*
* @return {Object} the mapping
*/
LeadImportUtils
.
getEntityFieldsOrg
=
function
(
pOrgDataFields
,
pContactDataFields
,
pAddressDataFields
)
{
var
EntityOrgFieldObj
=
{};
...
...
@@ -758,16 +758,16 @@ LeadImportUtils.getEntityFieldsOrg = function(pOrgDataFields, pContactDataFields
return
EntityOrgFieldObj
;
}
/*
* mapping for the duplicate search for PERSON
* maps the DB-Field to the ENTITY-Field
*
* @param {Object} pPersDataFields the the PERSON values;
* @param {Object} pContactDataFields the CONTACT values;
* @param {Object} pAddressDataFields the ADDRESS values;
*
* @return {Object} the mapping
*/
/*
*
* mapping for the duplicate search for PERSON
* maps the DB-Field to the ENTITY-Field
*
* @param {Object} pPersDataFields the the PERSON values;
* @param {Object} pContactDataFields the CONTACT values;
* @param {Object} pAddressDataFields the ADDRESS values;
*
* @return {Object} the mapping
*/
LeadImportUtils
.
getEntityFieldsPers
=
function
(
pPersDataFields
,
pContactDataFields
,
pAddressDataFields
)
{
var
EntityPersFieldObj
=
{};
...
...
@@ -782,13 +782,12 @@ LeadImportUtils.getEntityFieldsPers = function(pPersDataFields, pContactDataFiel
return
EntityPersFieldObj
;
}
/*
* checks if there are dups for the LEAD and updates the status of it
*
* @param {Object} pAllContactData the contactData;
* @return {void}
*/
/**
* checks if there are dups for the LEAD and updates the status of it
*
* @param {Object} pAllContactData the contactData;
* @return {void}
*/
LeadImportUtils
.
scanLeadDups
=
function
(
pAllContactData
)
{
var
dupUpdateLeadTable
=
"
LEAD
"
;
...
...
@@ -842,16 +841,15 @@ LeadImportUtils.scanLeadDups = function(pAllContactData)
db
.
updates
(
toUpdate
);
//update Leads with the new status
}
/*
* Checks if there is already an ORGANISATION
* if there is one then return the ids of it
* else return no ids
*
* @param {Object} pLeadValues req values of the Lead
* @return {[]} [ORGANISATIONID, CONTACTID]
*/
LeadImportUtils
.
CheckDup
=
function
(
pLeadValues
)
/**
* Checks if there is already an ORGANISATION
* if there is one then return the ids of it
* else return no ids
*
* @param {Object} pLeadValues values of the Lead
* @return {[]} [ORGANISATIONID, CONTACTID]
*/
LeadImportUtils
.
CheckDup
=
function
(
pLeadValues
)
{
// search whether the organisation already exists
var
query
=
newSelect
(
"
ORGANISATIONID, CONTACTID
"
)
...
...
@@ -931,22 +929,22 @@ LeadImportUtils.getRecordSeparator = function(pKeyId)
}
/**
* a static Utility class for contact infos
*
* @class
*/
* a static Utility class for contact infos
*
* @class
*/
function
ContactInfoUtils
()
{}
/*
* checks if there is a department for the contact
*
* @param {Object} pLeadValues the leadValues;
*
* @return {String} the department
*/
/*
*
* checks if there is a department for the contact
*
* @param {Object} pLeadValues the leadValues;
*
* @return {String} the department
*/
ContactInfoUtils
.
getContactDepartment
=
function
(
pLeadValues
)
{
if
(
pLeadValues
[
"
DEPARTMENT
"
]
!=
undefined
&&
pLeadValues
[
"
DEPARTMENT
"
]
!=
""
)
if
(
pLeadValues
[
"
DEPARTMENT
"
]
!=
undefined
&&
pLeadValues
[
"
DEPARTMENT
"
]
!=
""
)
{
var
department
=
KeywordUtils
.
getEntryNamesByContainer
(
"
ContactDepartment
"
);
...
...
@@ -959,16 +957,16 @@ ContactInfoUtils.getContactDepartment = function(pLeadValues)
return
""
;
};
/*
* checks if there is a position for the contact
*
* @param {Object} pLeadValues the leadValues;
*
* @return {String} the position
*/
/*
*
* checks if there is a position for the contact
*
* @param {Object} pLeadValues the leadValues;
*
* @return {String} the position
*/
ContactInfoUtils
.
getContactPosition
=
function
(
pLeadValues
)
{
if
(
pLeadValues
[
"
CONTACTPOSITION
"
]
!=
undefined
&&
pLeadValues
[
"
CONTACTPOSITION
"
]
!=
""
)
if
(
pLeadValues
[
"
CONTACTPOSITION
"
]
!=
undefined
&&
pLeadValues
[
"
CONTACTPOSITION
"
]
!=
""
)
{
var
position
=
KeywordUtils
.
getEntryNamesByContainer
(
"
ContactPosition
"
);
...
...
@@ -981,16 +979,16 @@ ContactInfoUtils.getContactPosition = function(pLeadValues)
return
""
;
};
/*
* checks if there is a contactRole for the contact
*
* @param {Object} pLeadValues the leadValues;
*
* @return {String} the contactRole
*/
/*
*
* checks if there is a contactRole for the contact
*
* @param {Object} pLeadValues the leadValues;
*
* @return {String} the contactRole
*/
ContactInfoUtils
.
getContactRole
=
function
(
pLeadValues
)
{
if
(
pLeadValues
[
"
CONTACTROLE
"
]
!=
undefined
&&
pLeadValues
[
"
CONTACTROLE
"
]
!=
""
)
if
(
pLeadValues
[
"
CONTACTROLE
"
]
!=
undefined
&&
pLeadValues
[
"
CONTACTROLE
"
]
!=
""
)
{
var
role
=
KeywordUtils
.
getEntryNamesByContainer
(
"
ContactContactrole
"
);
...
...
@@ -1003,16 +1001,16 @@ ContactInfoUtils.getContactRole = function(pLeadValues)
return
""
;
};
/*
* checks if there is a gender for the person
*
* @param {Object} pLeadValues the leadValues;
*
* @return {String} the gender
*/
/*
*
* checks if there is a gender for the person
*
* @param {Object} pLeadValues the leadValues;
*
* @return {String} the gender
*/
ContactInfoUtils
.
getGender
=
function
(
pLeadValues
)
{
if
(
pLeadValues
[
"
GENDER
"
]
!=
undefined
&&
pLeadValues
[
"
GENDER
"
]
!=
""
)
if
(
pLeadValues
[
"
GENDER
"
]
!=
undefined
&&
pLeadValues
[
"
GENDER
"
]
!=
""
)
{
var
gender
=
KeywordUtils
.
getEntryNamesByContainer
(
"
PersonGender
"
);
...
...
@@ -1025,18 +1023,18 @@ ContactInfoUtils.getGender = function(pLeadValues)
return
""
;
};
/*
* checks if there is a salutation for the person
*
* @param {Object} pLeadValues the leadValues;
* @param {String} pIsoLanguage the IsoLanguage;
*
* @return {String} the salutation
*/
/*
*
* checks if there is a salutation for the person
*
* @param {Object} pLeadValues the leadValues;
* @param {String} pIsoLanguage the IsoLanguage;
*
* @return {String} the salutation
*/
ContactInfoUtils
.
getSalutation
=
function
(
pLeadValues
,
pIsoLanguage
)
{
// TODO: use getRows
if
(
pLeadValues
[
"
SALUTATION
"
]
!=
undefined
&&
pLeadValues
[
"
SALUTATION
"
]
!=
""
)
if
(
pLeadValues
[
"
SALUTATION
"
]
!=
undefined
&&
pLeadValues
[
"
SALUTATION
"
]
!=
""
)
{
var
salutation
=
newSelect
(
"
distinct SALUTATION
"
)
.
from
(
"
SALUTATION
"
)
...
...
@@ -1052,18 +1050,19 @@ ContactInfoUtils.getSalutation = function(pLeadValues, pIsoLanguage)
}
return
""
;
};
/*
* checks if there is a title for the person
*
* @param {Object} pLeadValues the leadValues;
* @param {String} pIsoLanguage the IsoLanguage;
*
* @return {String} the title
*/
/**
* checks if there is a title for the person
*
* @param {Object} pLeadValues the leadValues;
* @param {String} pIsoLanguage the IsoLanguage;
*
* @return {String} the title
*/
ContactInfoUtils
.
getTitle
=
function
(
pLeadValues
,
pIsoLanguage
)
{
// TODO: use getRows
if
(
pLeadValues
[
"
TITLE
"
]
!=
undefined
&&
pLeadValues
[
"
TITLE
"
]
!=
""
)
if
(
pLeadValues
[
"
TITLE
"
]
!=
undefined
&&
pLeadValues
[
"
TITLE
"
]
!=
""
)
{
var
title
=
newSelect
(
"
distinct TITLE
"
)
.
from
(
"
SALUTATION
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment