Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ADITO_Update_Upgrade
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository 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
ADITO_Update_Upgrade
Commits
269ee954
Commit
269ee954
authored
5 years ago
by
Johannes Goderbauer
Committed by
Johannes Goderbauer
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
added comments to IncomingCallExecutor_lib
(cherry picked from commit
4c7cc7d6
)
parent
3c5c8c2d
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/IncomingCallExecutor_lib/process.js
+52
-4
52 additions, 4 deletions
process/IncomingCallExecutor_lib/process.js
with
52 additions
and
4 deletions
process/IncomingCallExecutor_lib/process.js
+
52
−
4
View file @
269ee954
...
...
@@ -10,8 +10,6 @@ import("Sql_lib");
import
(
"
system.cti
"
);
import
(
"
system.indexsearch
"
);
//TODO: comment library completely
/**
* object for processing cti-calls
* Within the constructor, data is collected but not further processed. To perform operations, different methods are provide (lke the .execute-function)
...
...
@@ -205,6 +203,30 @@ IncomingCallExecutor._callstateToText = function(pCallstate)
return
callstateName
;
};
/**
* helper function to load a contact by a given number (or contactId) as they are required for formatting of a callers name for example
* will use the index for a fast phone number search; will load the actual data from the database
*
* either the number or contactIds have to be given to the function. you can specify both if you want to extent the search
* (look for the phoneNumber XXX and also look for those YYY contactIds; Note that this is an extension and not a an addtional filter and therefor
* will result in an SQL-OR-condtion)
*
* @param {String} pNumber phone number that shall be searched, formatting is ignored for searching
* @param {Array} pContactIds additional contactIds to load
*
* @return {Array} array of contacts where each element is an object with these properites
* <ul>
* <li>CONTACTID</li>
* <li>ORGANISATION_ID</li>
* <li>ORGANISATION_NAME</li>
* <li>PERSON_ID</li>
* <li>LANGUAGE</li>
* <li>PERSON_FULL_NAME</li>
* </ul>
*
* @private
* @static
*/
IncomingCallExecutor
.
_getContactsFromNumber
=
function
(
pNumber
,
pContactIds
)
{
var
phoneNumber
=
pNumber
;
...
...
@@ -269,12 +291,28 @@ IncomingCallExecutor._getContactsFromNumber = function(pNumber, pContactIds)
ORGANISATION_ID
:
e
[
1
],
ORGANISATION_NAME
:
e
[
2
].
trim
(),
PERSON_ID
:
e
[
3
],
LANGUAGE
:
e
[
4
],
ISO
LANGUAGE
:
e
[
4
],
PERSON_FULL_NAME
:
e
.
slice
(
5
).
join
(
"
"
).
trim
()
//quick solution until the ticket above (#1047680) is solved
};
});
};
/**
* helper function to load user data models by given contacts as they are returned in IncomingCallExecutor._getContactsFromNumber
* the CONTACTID-property of the contact will be used to search within the users
* Only active users are returned
*
* either the number or contactIds have to be given to the function. you can specify both if you want to extent the search
* (look for the phoneNumber XXX and also look for those YYY contactIds; Note that this is an extension and not a an addtional filter and therefor
* will result in an SQL-OR-condtion)
*
* @param {Array} pContacts contacts as they are returned in IncomingCallExecutor._getContactsFromNumber(...)
*
* @return {Array} array of user data models (PROFILE_DEFAULT)
*
* @private
* @static
*/
IncomingCallExecutor
.
_getUsersFromContacts
=
function
(
pContacts
)
{
var
users
=
tools
.
getUsersByAttribute
(
tools
.
CONTACTID
,
pContacts
.
map
(
function
(
e
){
...
...
@@ -286,6 +324,16 @@ IncomingCallExecutor._getUsersFromContacts = function (pContacts)
return
users
;
};
/**
* will search within the contacts for a given user and then return the contacts language
* The CONTACTID of the user is used for finding the matching contact
*
* @param {Object} pUserObject user data model whose contact shall be searched
*
* @return {String} language as isocode of the contact or null if no language is set/the user was not found in the "contactsLocal" property
*
* @private
*/
IncomingCallExecutor
.
prototype
.
getLocaleFromUser
=
function
(
pUserObject
)
{
var
contactId
=
pUserObject
[
tools
.
CONTACTID
];
...
...
@@ -293,7 +341,7 @@ IncomingCallExecutor.prototype.getLocaleFromUser = function(pUserObject)
return
e
.
CONTACTID
==
contactId
;
});
//language for output like notifications, this is most likely used within the callback-functions (action handlers):
if
(
contact
&&
contact
.
LANGUAGE
)
if
(
contact
&&
contact
.
ISO
LANGUAGE
)
return
contact
.
ISOLANGUAGE
;
else
return
null
;
...
...
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