Built motion from commit c116dc8b.|2.6.30
[motion2.git] / server / components / interaction / service.js
index 4540bda..958e460 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7b6f=['toUpperCase','name','role','stringify','null','Interaction','findOne','then','info','error','user','query','body','omit','html','phone','fax','mobile','lodash','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0xd98ca3,_0x38fbd9){var _0x35960d=function(_0x52e8ee){while(--_0x52e8ee){_0xd98ca3['push'](_0xd98ca3['shift']());}};_0x35960d(++_0x38fbd9);}(_0x7b6f,0x6c));var _0xf7b6=function(_0x5caa29,_0x2151ff){_0x5caa29=_0x5caa29-0x0;var _0x5ec017=_0x7b6f[_0x5caa29];return _0x5ec017;};'use strict';var _=require(_0xf7b6('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0xf7b6('0x1'))(_0xf7b6('0x2')),'mail':require(_0xf7b6('0x1'))(_0xf7b6('0x3')),'fax':require(_0xf7b6('0x1'))(_0xf7b6('0x4')),'sms':require('../../config/logger')(_0xf7b6('0x5')),'chat':require(_0xf7b6('0x1'))(_0xf7b6('0x6')),'whatsapp':require(_0xf7b6('0x1'))(_0xf7b6('0x7'))};function getInteractionId(_0x3000ce,_0x337196,_0x3c18c6){if(_0x3000ce&&_0x3000ce[_[_0xf7b6('0x8')](_0x3c18c6)+_0xf7b6('0x9')]){return _0x3000ce[_[_0xf7b6('0x8')](_0x3c18c6)+'InteractionId'];}else if(_0x3000ce&&_0x3000ce['id']){return _0x3000ce['id'];}else if(_0x337196&&_0x337196['id']){return _0x337196['id'];}else{return _0xf7b6('0xa');}}function log(_0x3f4562,_0x842d2,_0x16ce96,_0x334491,_0x4f966a,_0x5e46e1){loggers[_0x4f966a['toLowerCase']()][_0x3f4562](_0xf7b6('0xb'),_0x5e46e1[_0xf7b6('0xc')](),_0x842d2?_0x842d2['id']:null,_0x842d2?_0x842d2[_0xf7b6('0xd')]:null,_0x842d2?_0x842d2[_0xf7b6('0xe')]:null,getInteractionId(_0x16ce96,_0x334491,_0x4f966a),_0x16ce96?JSON[_0xf7b6('0xf')](_0x16ce96):_0xf7b6('0x10'));}function updateUser(_0x389d1f,_0x386ee0,_0x4b8a0c,_0x2f3a67,_0x13731d){db[_[_0xf7b6('0x8')](_0x2f3a67)+_0xf7b6('0x11')][_0xf7b6('0x12')]({'where':{'id':getInteractionId(_0x386ee0,_0x4b8a0c,_0x2f3a67)}})[_0xf7b6('0x13')](function(_0x4fecfd){if(_0x4fecfd){return _0x4fecfd['update']({'UserId':_0x389d1f?_0x389d1f['id']:null});}})['then'](function(_0x149b5c){if(_0x149b5c){log(_0xf7b6('0x14'),_0x389d1f,_0x386ee0,_0x4b8a0c,_0x2f3a67,_0x13731d);}})['catch'](function(){log(_0xf7b6('0x15'),_0x389d1f,_0x386ee0,_0x4b8a0c,_0x2f3a67,_0x13731d);});}exports['tracked']=function(_0x27bd4a,_0x7a0a51){return function(_0x46b06d,_0x1ccf1d,_0x180f2b){var _0x5dfc28=_0x46b06d[_0xf7b6('0x16')];var _0x50a823={};var _0x20f441=_0x46b06d[_0xf7b6('0x17')];if(_0x50a823){_0x50a823=_['clone'](_0x46b06d[_0xf7b6('0x18')]);_0x50a823=_[_0xf7b6('0x19')](_0x50a823,['body',_0xf7b6('0x1a'),_0xf7b6('0x1b'),_0xf7b6('0x1c'),_0xf7b6('0x1d')]);}updateUser(_0x5dfc28,_0x50a823,_0x20f441,_0x27bd4a,_0x7a0a51);_0x180f2b(null);};};
\ No newline at end of file
+var _0xcd67=['phone','fax','mobile','lodash','./sql-utils','findAll','getInteractionsQuery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','body','contact','default','fields','filter','user','having','tags','checkAccountsRestrictions','group','i.id','ids','tag','countFilteredInteractions','count','length','order','forEach','DESC','getClosedOrderClause','getFilteredInteractions','catch','query','omit','html'];(function(_0x264257,_0x5cff0b){var _0x151b37=function(_0x11a1b2){while(--_0x11a1b2){_0x264257['push'](_0x264257['shift']());}};_0x151b37(++_0x5cff0b);}(_0xcd67,0x1cb));var _0x7cd6=function(_0x1eea64,_0x3fb361){_0x1eea64=_0x1eea64-0x0;var _0x507b47=_0xcd67[_0x1eea64];return _0x507b47;};'use strict';var _=require(_0x7cd6('0x0'));var sqlUtils=require(_0x7cd6('0x1'));var utils=require('./utils');exports[_0x7cd6('0x2')]=function(_0x389399,_0x20a9b7,_0x4a5a5a,_0x56656a,_0x5ba748){var _0x19531a={'count':0x0,'rows':[]};var _0x4de487=sqlUtils['skipInteractionsQuery'](_0x389399,_0x4a5a5a,_0x20a9b7);if(_0x4de487){return Promise['resolve'](_0x19531a);}var _0x26f2c5=sqlUtils[_0x7cd6('0x3')](_0x389399);var _0x50eb17={};return Promise[_0x7cd6('0x4')]()[_0x7cd6('0x5')](function(){if(_0x20a9b7[_0x7cd6('0x6')]){return sqlUtils[_0x7cd6('0x7')](_0x20a9b7['search'],_0x5ba748);}else{return sqlUtils[_0x7cd6('0x8')](_0x389399,_0x20a9b7,_0x5ba748);}})[_0x7cd6('0x5')](function(_0x3cca64){_0x26f2c5[_0x7cd6('0x9')](_0x3cca64[_0x7cd6('0xa')]);_0x26f2c5[_0x7cd6('0x9')](_0x3cca64[_0x7cd6('0xb')]);_0x26f2c5[_0x7cd6('0x9')](_0x3cca64[_0x7cd6('0xc')]);_0x26f2c5[_0x7cd6('0x9')](_0x3cca64[_0x7cd6('0xd')]);_0x26f2c5[_0x7cd6('0x9')](_0x3cca64[_0x7cd6('0xe')]);_0x26f2c5['where'](_0x3cca64[_0x7cd6('0xf')]);_0x26f2c5[_0x7cd6('0x10')](_0x3cca64['read']);_0x50eb17=_0x3cca64[_0x7cd6('0x11')];return sqlUtils[_0x7cd6('0x12')](_0x389399,_0x4a5a5a,_0x20a9b7);})['then'](function(_0x1885d4){_0x26f2c5[_0x7cd6('0x9')](_0x1885d4);_0x26f2c5[_0x7cd6('0x13')](_0x7cd6('0x14'));var _0x2cee1c=_0x20a9b7['search']?_0x50eb17[_0x7cd6('0x15')]:_0x20a9b7[_0x7cd6('0x16')];return sqlUtils[_0x7cd6('0x17')](_0x26f2c5,_0x2cee1c);})['then'](function(_0x4c1c12){_0x19531a[_0x7cd6('0x18')]=_0x4c1c12[_0x7cd6('0x19')];if(_0x19531a[_0x7cd6('0x18')]===0x0){return[];}_0x26f2c5[_0x7cd6('0x10')](_0x50eb17['clause']);if(_0x56656a[_0x7cd6('0x1a')]){_0x56656a[_0x7cd6('0x1a')][_0x7cd6('0x1b')](function(_0x36ac07){var _0x1d446e=_0x36ac07[0x0]==='contactName'?_0x36ac07[0x0]:'i.'+_0x36ac07[0x0];_0x26f2c5[_0x7cd6('0x1a')](_0x1d446e,_0x36ac07[0x1]===_0x7cd6('0x1c')?![]:!![]);if(_0x36ac07[0x0]==='closed'){var _0x4364bc=sqlUtils[_0x7cd6('0x1d')](_0x389399,_0x20a9b7);_0x26f2c5[_0x7cd6('0x1a')](_0x4364bc,_0x36ac07[0x1]===_0x7cd6('0x1c')?![]:!![]);}});}return sqlUtils[_0x7cd6('0x1e')](_0x389399,_0x26f2c5,_0x20a9b7,_0x56656a);})[_0x7cd6('0x5')](function(_0x38c21e){_0x19531a['rows']=_0x38c21e;return _0x19531a;})[_0x7cd6('0x1f')](function(_0x30cb56){throw _0x30cb56;});};exports['tracked']=function(_0x336eeb,_0x2e3da4){return function(_0x315deb,_0x566d60,_0x38cfbe){var _0x3c3b5d=_0x315deb[_0x7cd6('0xf')];var _0x290ac0={};var _0x1b6354=_0x315deb[_0x7cd6('0x20')];if(_0x290ac0){_0x290ac0=_['clone'](_0x315deb[_0x7cd6('0xa')]);_0x290ac0=_[_0x7cd6('0x21')](_0x290ac0,[_0x7cd6('0xa'),_0x7cd6('0x22'),_0x7cd6('0x23'),_0x7cd6('0x24'),_0x7cd6('0x25')]);}utils['updateUser'](_0x3c3b5d,_0x290ac0,_0x1b6354,_0x336eeb,_0x2e3da4);_0x38cfbe(null);};};
\ No newline at end of file