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
4c7cc7d6
Commit
4c7cc7d6
authored
5 years ago
by
Johannes Goderbauer
Browse files
Options
Downloads
Patches
Plain Diff
added comments to IncomingCallExecutor_lib
parent
7cf57f63
Loading
Loading
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 @
4c7cc7d6
...
...
@@ -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)
...
...
@@ -305,6 +303,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
;
...
...
@@ -369,12 +391,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
){
...
...
@@ -386,6 +424,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
];
...
...
@@ -393,7 +441,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.
Johannes Goderbauer
@j.goderbauer
mentioned in commit
269ee954
·
5 years ago
mentioned in commit
269ee954
mentioned in commit 269ee9545f0caa77f8e3a129226b65b62511eb63
Toggle commit list
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