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
8e046685
Commit
8e046685
authored
5 years ago
by
Johannes Hörmann
Browse files
Options
Downloads
Patches
Plain Diff
LeadImport_lib: consistent code & comment format
parent
961bc480
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
+19
-19
19 additions, 19 deletions
process/Leadimport_lib/process.js
with
19 additions
and
19 deletions
process/Leadimport_lib/process.js
+
19
−
19
View file @
8e046685
...
...
@@ -92,7 +92,7 @@ LeadImportUtils.loadImportFile = function(pBinId, pFieldSep, pFieldLimit, pRecor
var
insertTypes
=
db
.
getColumnTypes
(
insertTable
,
insertCols
);
var
insertVals
=
[];
if
(
pUpdate
==
undefined
)
pUpdate
=
false
;
if
(
pUpdate
==
undefined
)
pUpdate
=
false
;
if
(
pBinId
)
{
...
...
@@ -101,9 +101,9 @@ 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
));
if
(
pNewFile
!=
"
true
"
)
if
(
pNewFile
!=
"
true
"
)
{
if
(
pUpdate
)
{
if
(
pUpdate
)
{
db
.
deleteData
(
"
IMPORTFIELD
"
,
newWhere
(
"
IMPORTFIELD.LEADIMPORT_ID
"
,
pLeadImportId
).
build
());
}
//insert the importfields
...
...
@@ -169,7 +169,7 @@ LeadImportUtils.importData = function(pDataFields, pDataTypes, pFieldDef, pField
orgContactId
=
orgRet
[
1
];
orgsForDubCheck
=
orgRet
[
2
];
if
(
orgRet
[
3
])
//not a new organisation
if
(
orgRet
[
3
])
//not a new organisation
{
LeadImportUtils
.
insertAttr
(
pDataFields
,
pDataTypes
,
pFieldDef
,
LeadValues
,
orgContactId
,
orgObjID
,
pUser
,
pDate
);
LeadImportUtils
.
insertComm
(
pDataFields
,
pDataTypes
,
LeadValues
,
orgContactId
,
pUser
,
pDate
);
...
...
@@ -327,7 +327,7 @@ LeadImportUtils.getImportFieldDef = function(pID)
{
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
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"
var
attrdata
=
newSelect
(
"
AB_ATTRIBUTEID, ATTRIBUTE_TYPE
"
)
...
...
@@ -372,7 +372,7 @@ LeadImportUtils.insertAttr = function(pDataFields, pDataTypes, pFieldDef, pLeadV
// Datenwerte setzen
for
(
var
i
=
0
;
i
<
pFieldDef
.
length
;
i
++
)
{
if
(
pFieldDef
[
i
][
1
].
substr
(
0
,
9
)
==
"
ATTRIBUTE
"
&&
pFieldDef
[
i
][
2
]
!=
undefined
)
//if Attribute
if
(
pFieldDef
[
i
][
1
].
substr
(
0
,
9
)
==
"
ATTRIBUTE
"
&&
pFieldDef
[
i
][
2
]
!=
undefined
)
//if Attribute
{
var
attrdata
=
pFieldDef
[
i
][
2
];
...
...
@@ -808,30 +808,30 @@ LeadImportUtils.scanLeadDups = function(pAllContactData)
persObj
=
pAllContactData
[
pLeadID
][
0
];
//personData
orgObj
=
pAllContactData
[
pLeadID
][
1
];
//organisationData
if
(
orgObj
!=
undefined
&&
Object
.
keys
(
orgObj
).
length
>
0
)
//checks if there is an ORGANISATIONDUPLICATE
if
(
orgObj
!=
undefined
&&
Object
.
keys
(
orgObj
).
length
>
0
)
//checks if there is an ORGANISATIONDUPLICATE
{
let
scanResultsOrg
=
DuplicateScannerUtils
.
ScanForDuplicates
(
"
OrganisationDuplicates
"
,
"
Organisation_entity
"
,
orgObj
,
null
);
if
(
scanResultsOrg
!=
null
&&
scanResultsOrg
.
length
>
0
)
if
(
scanResultsOrg
!=
null
&&
scanResultsOrg
.
length
>
0
)
{
let
insertCountOrg
=
DuplicateScannerUtils
.
CacheNewScanResults
(
orgObj
[
"
CONTACTID
"
],
scanResultsOrg
,
"
Organisation_entity
"
);
dupOrg
=
true
;
}
}
if
(
persObj
!=
undefined
&&
Object
.
keys
(
persObj
).
length
>
0
)
//checks if there is an PERSONDUPLICATE
if
(
persObj
!=
undefined
&&
Object
.
keys
(
persObj
).
length
>
0
)
//checks if there is an PERSONDUPLICATE
{
let
scanResultsPers
=
DuplicateScannerUtils
.
ScanForDuplicates
(
"
PersonDuplicates
"
,
"
Person_entity
"
,
persObj
,
null
);
if
(
scanResultsPers
!=
null
&&
scanResultsPers
.
length
>
0
)
if
(
scanResultsPers
!=
null
&&
scanResultsPers
.
length
>
0
)
{
let
insertCountPers
=
DuplicateScannerUtils
.
CacheNewScanResults
(
persObj
[
"
CONTACTID
"
],
scanResultsPers
,
"
Person_entity
"
);
dupPers
=
true
;
}
}
if
(
dupOrg
&&
dupPers
)
if
(
dupOrg
&&
dupPers
)
dupStatus
=
"
ORGPERSDUP
"
;
//organisation and person duplicate
else
if
(
dupOrg
)
else
if
(
dupOrg
)
dupStatus
=
"
ORGDUP
"
;
//organisation duplicate
else
if
(
dupPers
)
else
if
(
dupPers
)
dupStatus
=
"
PERSDUP
"
;
//person duplicate
updDupVals
=
[
dupStatus
];
...
...
@@ -950,7 +950,7 @@ ContactInfoUtils.getContactDepartment = function(pLeadValues)
for
(
let
i
=
0
;
i
<
department
.
length
;
i
++
)
{
if
(
pLeadValues
[
"
DEPARTMENT
"
].
trim
()
==
department
[
i
].
trim
())
if
(
pLeadValues
[
"
DEPARTMENT
"
].
trim
()
==
department
[
i
].
trim
())
return
department
[
i
];
}
}
...
...
@@ -972,7 +972,7 @@ ContactInfoUtils.getContactPosition = function(pLeadValues)
for
(
let
i
=
0
;
i
<
position
.
length
;
i
++
)
{
if
(
pLeadValues
[
"
CONTACTPOSITION
"
].
trim
()
==
position
[
i
].
trim
())
if
(
pLeadValues
[
"
CONTACTPOSITION
"
].
trim
()
==
position
[
i
].
trim
())
return
position
[
i
];
}
}
...
...
@@ -994,7 +994,7 @@ ContactInfoUtils.getContactRole = function(pLeadValues)
for
(
let
i
=
0
;
i
<
role
.
length
;
i
++
)
{
if
(
pLeadValues
[
"
CONTACTROLE
"
].
trim
()
==
role
[
i
].
trim
())
if
(
pLeadValues
[
"
CONTACTROLE
"
].
trim
()
==
role
[
i
].
trim
())
return
role
[
i
];
}
}
...
...
@@ -1016,7 +1016,7 @@ ContactInfoUtils.getGender = function(pLeadValues)
for
(
let
i
=
0
;
i
<
gender
.
length
;
i
++
)
{
if
(
pLeadValues
[
"
GENDER
"
].
trim
()
==
gender
[
i
].
trim
())
if
(
pLeadValues
[
"
GENDER
"
].
trim
()
==
gender
[
i
].
trim
())
return
gender
[
i
];
}
}
...
...
@@ -1044,7 +1044,7 @@ ContactInfoUtils.getSalutation = function(pLeadValues, pIsoLanguage)
for
(
let
i
=
0
;
i
<
salutation
.
length
;
i
++
)
{
if
(
pLeadValues
[
"
SALUTATION
"
].
trim
()
==
salutation
[
i
].
trim
())
if
(
pLeadValues
[
"
SALUTATION
"
].
trim
()
==
salutation
[
i
].
trim
())
return
salutation
[
i
];
}
}
...
...
@@ -1072,7 +1072,7 @@ ContactInfoUtils.getTitle = function(pLeadValues, pIsoLanguage)
for
(
let
i
=
0
;
i
<
title
.
length
;
i
++
)
{
if
(
pLeadValues
[
"
TITLE
"
].
trim
()
==
title
[
i
].
trim
())
if
(
pLeadValues
[
"
TITLE
"
].
trim
()
==
title
[
i
].
trim
())
return
title
[
i
];
}
}
...
...
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