Built motion from commit 47436d59.|2.6.7
[motion2.git] / server / api / intVtigerConfiguration / intVtigerConfiguration.controller.js
index 2934a3f..7dcc66a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0a29=['sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','merge','find','create','body','update','findOne','getFields','VtigerField','getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','ejs','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','request\x20sent','result','catch','status','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','end','sendStatus','stack','name','send','index','VtigerConfiguration','rawAttributes','type','key','model','map','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x2c3bd9,_0x45f815){var _0x112e55=function(_0x22de25){while(--_0x22de25){_0x2c3bd9['push'](_0x2c3bd9['shift']());}};_0x112e55(++_0x45f815);}(_0x0a29,0x186));var _0x90a2=function(_0x5528a0,_0x5f52c6){_0x5528a0=_0x5528a0-0x0;var _0x5d1e63=_0x0a29[_0x5528a0];return _0x5d1e63;};'use strict';var pdf=require(_0x90a2('0x0'));var emlformat=require(_0x90a2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x90a2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x90a2('0x3'));var moment=require(_0x90a2('0x4'));var BPromise=require(_0x90a2('0x5'));var Mustache=require('mustache');var util=require(_0x90a2('0x6'));var path=require('path');var sox=require(_0x90a2('0x7'));var csv=require('to-csv');var ejs=require(_0x90a2('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x90a2('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x90a2('0xa'));var toCsv=require(_0x90a2('0xb'));var querystring=require('querystring');var Papa=require(_0x90a2('0xc'));var Redis=require(_0x90a2('0xd'));var authService=require(_0x90a2('0xe'));var qs=require(_0x90a2('0xf'));var as=require(_0x90a2('0x10'));var hardwareService=require(_0x90a2('0x11'));var logger=require('../../config/logger')(_0x90a2('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x90a2('0x13'))['db'];var jayson=require(_0x90a2('0x14'));var client=jayson[_0x90a2('0x15')][_0x90a2('0x16')]({'port':0x232a});function checkPasswordPattern(_0x12913c,_0x391215,_0x2f65b5){if(_0x2f65b5){var _0x75e9d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x75e9d[_0x90a2('0x17')](_0x391215)){return _0x12913c;}else{throw new db[(_0x90a2('0x18'))][(_0x90a2('0x19'))](_0x90a2('0x1a'));}}else{return _0x12913c;}}function respondWithRpcPromise(_0x4c7c34,_0x5c2ab4,_0x4dcec4,_0x18a0d9){return new BPromise(function(_0x10e651,_0x5672a1){var _0x5adaef=_0x18a0d9||client;return _0x5adaef['request'](_0x4c7c34,_0x4dcec4)['then'](function(_0x29e8ec){logger[_0x90a2('0x1b')]('VtigerConfiguration,\x20%s,\x20%s',_0x5c2ab4,'request\x20sent');logger[_0x90a2('0x1c')](_0x90a2('0x1d'),_0x5c2ab4,'request\x20sent',JSON[_0x90a2('0x1e')](_0x29e8ec));if(_0x29e8ec[_0x90a2('0x1f')]){if(_0x29e8ec[_0x90a2('0x1f')][_0x90a2('0x20')]===0x1f4){logger[_0x90a2('0x1f')](_0x90a2('0x21'),_0x5c2ab4,_0x29e8ec['error'][_0x90a2('0x22')]);return _0x5672a1(_0x29e8ec[_0x90a2('0x1f')][_0x90a2('0x22')]);}logger[_0x90a2('0x1f')](_0x90a2('0x21'),_0x5c2ab4,_0x29e8ec['error']['message']);return _0x10e651(_0x29e8ec[_0x90a2('0x1f')][_0x90a2('0x22')]);}else{logger[_0x90a2('0x1b')](_0x90a2('0x21'),_0x5c2ab4,_0x90a2('0x23'));_0x10e651(_0x29e8ec[_0x90a2('0x24')][_0x90a2('0x22')]);}})[_0x90a2('0x25')](function(_0x369d88){logger[_0x90a2('0x1f')](_0x90a2('0x21'),_0x5c2ab4,_0x369d88);_0x5672a1(_0x369d88);});});}function respondWithStatusCode(_0x419e2b,_0x2c5b19){_0x2c5b19=_0x2c5b19||0xcc;return function(_0x98f456){if(_0x98f456){return _0x419e2b['sendStatus'](_0x2c5b19);}return _0x419e2b[_0x90a2('0x26')](_0x2c5b19)['end']();};}function respondWithResult(_0x5b7020,_0x51072d){_0x51072d=_0x51072d||0xc8;return function(_0x4e8c95){if(_0x4e8c95){return _0x5b7020[_0x90a2('0x26')](_0x51072d)[_0x90a2('0x27')](_0x4e8c95);}};}function respondWithFilteredResult(_0x3b6a8d,_0x23fef9){return function(_0x3de4e5){if(_0x3de4e5){var _0x347327=_0x3de4e5[_0x90a2('0x28')],_0x3a7ef7=_0x23fef9[_0x90a2('0x29')],_0x1e05eb=_0x23fef9[_0x90a2('0x29')]+_0x23fef9[_0x90a2('0x2a')],_0x17cc7d;if(_0x1e05eb>=_0x347327){_0x1e05eb=_0x347327;_0x17cc7d=0xc8;}else{_0x17cc7d=0xce;}_0x3b6a8d[_0x90a2('0x26')](_0x17cc7d);return _0x3b6a8d[_0x90a2('0x2b')](_0x90a2('0x2c'),_0x3a7ef7+'-'+_0x1e05eb+'/'+_0x347327)[_0x90a2('0x27')](_0x3de4e5);}return null;};}function patchUpdates(_0x461d3c){return function(_0x2b063e){try{jsonpatch[_0x90a2('0x2d')](_0x2b063e,_0x461d3c,!![]);}catch(_0x2b0ef8){return BPromise['reject'](_0x2b0ef8);}return _0x2b063e[_0x90a2('0x2e')]();};}function saveUpdates(_0xa83d2,_0x361fc2){return function(_0x239be2){if(_0x239be2){return _0x239be2['update'](_0xa83d2)[_0x90a2('0x2f')](function(_0x1bc8f7){return _0x1bc8f7;});}return null;};}function removeEntity(_0x1f2372,_0x116435){return function(_0x264652){if(_0x264652){return _0x264652[_0x90a2('0x30')]()[_0x90a2('0x2f')](function(){_0x1f2372[_0x90a2('0x26')](0xcc)[_0x90a2('0x31')]();});}};}function handleEntityNotFound(_0x19b40c,_0xf6ccdc){return function(_0x38fcfa){if(!_0x38fcfa){_0x19b40c[_0x90a2('0x32')](0x194);}return _0x38fcfa;};}function handleError(_0x2fb060,_0xea3c41){_0xea3c41=_0xea3c41||0x1f4;return function(_0x47d4b0){logger['error'](_0x47d4b0[_0x90a2('0x33')]);if(_0x47d4b0['name']){delete _0x47d4b0[_0x90a2('0x34')];}_0x2fb060['status'](_0xea3c41)[_0x90a2('0x35')](_0x47d4b0);};}exports[_0x90a2('0x36')]=function(_0x36787f,_0x1b06ee){var _0x1421d6={},_0x30bcbd={},_0x5c12e4={'count':0x0,'rows':[]};var _0x186f19=_['map'](db[_0x90a2('0x37')][_0x90a2('0x38')],function(_0x3e2e73){return{'name':_0x3e2e73['fieldName'],'type':_0x3e2e73[_0x90a2('0x39')][_0x90a2('0x3a')]};});_0x30bcbd[_0x90a2('0x3b')]=_[_0x90a2('0x3c')](_0x186f19,'name');_0x30bcbd['query']=_['keys'](_0x36787f['query']);_0x30bcbd[_0x90a2('0x3d')]=_['intersection'](_0x30bcbd['model'],_0x30bcbd[_0x90a2('0x3e')]);_0x1421d6['attributes']=_[_0x90a2('0x3f')](_0x30bcbd[_0x90a2('0x3b')],qs['fields'](_0x36787f[_0x90a2('0x3e')][_0x90a2('0x40')]));_0x1421d6[_0x90a2('0x41')]=_0x1421d6[_0x90a2('0x41')][_0x90a2('0x42')]?_0x1421d6[_0x90a2('0x41')]:_0x30bcbd['model'];if(!_0x36787f['query'][_0x90a2('0x43')](_0x90a2('0x44'))){_0x1421d6['limit']=qs['limit'](_0x36787f['query'][_0x90a2('0x2a')]);_0x1421d6[_0x90a2('0x29')]=qs[_0x90a2('0x29')](_0x36787f[_0x90a2('0x3e')]['offset']);}_0x1421d6[_0x90a2('0x45')]=qs[_0x90a2('0x46')](_0x36787f[_0x90a2('0x3e')][_0x90a2('0x46')]);_0x1421d6[_0x90a2('0x47')]=qs['filters'](_[_0x90a2('0x48')](_0x36787f['query'],_0x30bcbd[_0x90a2('0x3d')]));if(_0x36787f[_0x90a2('0x3e')][_0x90a2('0x49')]){_0x1421d6[_0x90a2('0x47')]=_['merge'](_0x1421d6[_0x90a2('0x47')],{'$or':_[_0x90a2('0x3c')](_0x186f19,function(_0x59b444){if(_0x59b444['type']!==_0x90a2('0x4a')){var _0x45bf77={};_0x45bf77[_0x59b444[_0x90a2('0x34')]]={'$like':'%'+_0x36787f[_0x90a2('0x3e')][_0x90a2('0x49')]+'%'};return _0x45bf77;}})});}_0x1421d6=_['merge']({},_0x1421d6,_0x36787f[_0x90a2('0x4b')]);var _0x4aef55={'where':_0x1421d6[_0x90a2('0x47')]};return db['VtigerConfiguration'][_0x90a2('0x28')](_0x4aef55)[_0x90a2('0x2f')](function(_0x4b972e){_0x5c12e4[_0x90a2('0x28')]=_0x4b972e;if(_0x36787f[_0x90a2('0x3e')][_0x90a2('0x4c')]){_0x1421d6[_0x90a2('0x4d')]=[{'all':!![]}];}return db[_0x90a2('0x37')][_0x90a2('0x4e')](_0x1421d6);})['then'](function(_0x5345ca){_0x5c12e4[_0x90a2('0x4f')]=_0x5345ca;return _0x5c12e4;})[_0x90a2('0x2f')](respondWithFilteredResult(_0x1b06ee,_0x1421d6))[_0x90a2('0x25')](handleError(_0x1b06ee,null));};exports['show']=function(_0x267bae,_0x70b97f){var _0x970aed={'raw':![],'where':{'id':_0x267bae[_0x90a2('0x50')]['id']}},_0x1b00ae={};_0x1b00ae[_0x90a2('0x3b')]=_['keys'](db[_0x90a2('0x37')][_0x90a2('0x38')]);_0x1b00ae[_0x90a2('0x3e')]=_[_0x90a2('0x51')](_0x267bae[_0x90a2('0x3e')]);_0x1b00ae[_0x90a2('0x3d')]=_[_0x90a2('0x3f')](_0x1b00ae[_0x90a2('0x3b')],_0x1b00ae[_0x90a2('0x3e')]);_0x970aed[_0x90a2('0x41')]=_[_0x90a2('0x3f')](_0x1b00ae[_0x90a2('0x3b')],qs[_0x90a2('0x40')](_0x267bae[_0x90a2('0x3e')][_0x90a2('0x40')]));_0x970aed[_0x90a2('0x41')]=_0x970aed['attributes']['length']?_0x970aed['attributes']:_0x1b00ae['model'];if(_0x267bae[_0x90a2('0x3e')][_0x90a2('0x4c')]){_0x970aed[_0x90a2('0x4d')]=[{'all':!![]}];}_0x970aed=_[_0x90a2('0x52')]({},_0x970aed,_0x267bae[_0x90a2('0x4b')]);return db[_0x90a2('0x37')][_0x90a2('0x53')](_0x970aed)[_0x90a2('0x2f')](handleEntityNotFound(_0x70b97f,null))[_0x90a2('0x2f')](respondWithResult(_0x70b97f,null))['catch'](handleError(_0x70b97f,null));};exports[_0x90a2('0x54')]=function(_0x4f70d3,_0x3dce22){return db[_0x90a2('0x37')][_0x90a2('0x54')](_0x4f70d3[_0x90a2('0x55')],{})[_0x90a2('0x2f')](respondWithResult(_0x3dce22,0xc9))[_0x90a2('0x25')](handleError(_0x3dce22,null));};exports[_0x90a2('0x56')]=function(_0x5cb3cb,_0x3fbc96){if(_0x5cb3cb[_0x90a2('0x55')]['id']){delete _0x5cb3cb[_0x90a2('0x55')]['id'];}return db[_0x90a2('0x37')]['find']({'where':{'id':_0x5cb3cb[_0x90a2('0x50')]['id']}})[_0x90a2('0x2f')](handleEntityNotFound(_0x3fbc96,null))[_0x90a2('0x2f')](saveUpdates(_0x5cb3cb[_0x90a2('0x55')],null))['then'](respondWithResult(_0x3fbc96,null))[_0x90a2('0x25')](handleError(_0x3fbc96,null));};exports[_0x90a2('0x30')]=function(_0x2b6d3c,_0x466ee2){return db[_0x90a2('0x37')][_0x90a2('0x53')]({'where':{'id':_0x2b6d3c[_0x90a2('0x50')]['id']}})['then'](handleEntityNotFound(_0x466ee2,null))[_0x90a2('0x2f')](removeEntity(_0x466ee2,null))[_0x90a2('0x25')](handleError(_0x466ee2,null));};exports['getFields']=function(_0x430b2f,_0x4643f8,_0x28f688){var _0x50c255={};var _0xea041f={};var _0x4618a9;var _0x4a7af5;return db['VtigerConfiguration'][_0x90a2('0x57')]({'where':{'id':_0x430b2f[_0x90a2('0x50')]['id']}})[_0x90a2('0x2f')](handleEntityNotFound(_0x4643f8,null))[_0x90a2('0x2f')](function(_0x4b9c9f){if(_0x4b9c9f){_0x4618a9=_0x4b9c9f;_0xea041f[_0x90a2('0x3b')]=_[_0x90a2('0x51')](db['VtigerField'][_0x90a2('0x38')]);_0xea041f[_0x90a2('0x3e')]=_[_0x90a2('0x51')](_0x430b2f[_0x90a2('0x3e')]);_0xea041f[_0x90a2('0x3d')]=_['intersection'](_0xea041f[_0x90a2('0x3b')],_0xea041f[_0x90a2('0x3e')]);_0x50c255[_0x90a2('0x41')]=_[_0x90a2('0x3f')](_0xea041f[_0x90a2('0x3b')],qs[_0x90a2('0x40')](_0x430b2f[_0x90a2('0x3e')][_0x90a2('0x40')]));_0x50c255[_0x90a2('0x41')]=_0x50c255[_0x90a2('0x41')][_0x90a2('0x42')]?_0x50c255['attributes']:_0xea041f[_0x90a2('0x3b')];_0x50c255[_0x90a2('0x45')]=qs['sort'](_0x430b2f[_0x90a2('0x3e')][_0x90a2('0x46')]);_0x50c255[_0x90a2('0x47')]=qs[_0x90a2('0x3d')](_[_0x90a2('0x48')](_0x430b2f['query'],_0xea041f[_0x90a2('0x3d')]));if(_0x430b2f[_0x90a2('0x3e')][_0x90a2('0x49')]){_0x50c255[_0x90a2('0x47')]=_[_0x90a2('0x52')](_0x50c255[_0x90a2('0x47')],{'$or':_['map'](_0x50c255[_0x90a2('0x41')],function(_0x5eb7b1){var _0x2face4={};_0x2face4[_0x5eb7b1]={'$like':'%'+_0x430b2f[_0x90a2('0x3e')][_0x90a2('0x49')]+'%'};return _0x2face4;})});}_0x50c255=_[_0x90a2('0x52')]({},_0x50c255,_0x430b2f[_0x90a2('0x4b')]);return _0x4618a9[_0x90a2('0x58')](_0x50c255);}})[_0x90a2('0x2f')](function(_0x5ed024){if(_0x5ed024){_0x4a7af5=_0x5ed024['length'];if(!_0x430b2f['query']['hasOwnProperty'](_0x90a2('0x44'))){_0x50c255['limit']=qs[_0x90a2('0x2a')](_0x430b2f[_0x90a2('0x3e')]['limit']);_0x50c255[_0x90a2('0x29')]=qs[_0x90a2('0x29')](_0x430b2f[_0x90a2('0x3e')][_0x90a2('0x29')]);}return _0x4618a9[_0x90a2('0x58')](_0x50c255);}})[_0x90a2('0x2f')](function(_0x74580c){if(_0x74580c){return _0x74580c?{'count':_0x4a7af5,'rows':_0x74580c}:null;}})[_0x90a2('0x2f')](respondWithResult(_0x4643f8,null))[_0x90a2('0x25')](handleError(_0x4643f8,null));};exports['getSubjects']=function(_0x18c50d,_0x5b7615,_0x341a8d){var _0x5bbb72={};var _0x15c779={};var _0x985dbe;var _0x517361;return db[_0x90a2('0x37')][_0x90a2('0x57')]({'where':{'id':_0x18c50d['params']['id']}})[_0x90a2('0x2f')](handleEntityNotFound(_0x5b7615,null))['then'](function(_0x255ae0){if(_0x255ae0){_0x985dbe=_0x255ae0;_0x15c779['model']=_[_0x90a2('0x51')](db[_0x90a2('0x59')][_0x90a2('0x38')]);_0x15c779[_0x90a2('0x3e')]=_[_0x90a2('0x51')](_0x18c50d[_0x90a2('0x3e')]);_0x15c779['filters']=_[_0x90a2('0x3f')](_0x15c779[_0x90a2('0x3b')],_0x15c779[_0x90a2('0x3e')]);_0x5bbb72[_0x90a2('0x41')]=_['intersection'](_0x15c779[_0x90a2('0x3b')],qs['fields'](_0x18c50d[_0x90a2('0x3e')]['fields']));_0x5bbb72[_0x90a2('0x41')]=_0x5bbb72[_0x90a2('0x41')][_0x90a2('0x42')]?_0x5bbb72['attributes']:_0x15c779['model'];_0x5bbb72[_0x90a2('0x45')]=qs[_0x90a2('0x46')](_0x18c50d['query'][_0x90a2('0x46')]);_0x5bbb72['where']=qs[_0x90a2('0x3d')](_[_0x90a2('0x48')](_0x18c50d[_0x90a2('0x3e')],_0x15c779[_0x90a2('0x3d')]));if(_0x18c50d[_0x90a2('0x3e')][_0x90a2('0x49')]){_0x5bbb72[_0x90a2('0x47')]=_[_0x90a2('0x52')](_0x5bbb72[_0x90a2('0x47')],{'$or':_['map'](_0x5bbb72[_0x90a2('0x41')],function(_0x572d6a){var _0x66e06d={};_0x66e06d[_0x572d6a]={'$like':'%'+_0x18c50d[_0x90a2('0x3e')][_0x90a2('0x49')]+'%'};return _0x66e06d;})});}_0x5bbb72=_[_0x90a2('0x52')]({},_0x5bbb72,_0x18c50d[_0x90a2('0x4b')]);return _0x985dbe[_0x90a2('0x5a')](_0x5bbb72);}})[_0x90a2('0x2f')](function(_0x21e51b){if(_0x21e51b){_0x517361=_0x21e51b[_0x90a2('0x42')];if(!_0x18c50d[_0x90a2('0x3e')][_0x90a2('0x43')](_0x90a2('0x44'))){_0x5bbb72[_0x90a2('0x2a')]=qs[_0x90a2('0x2a')](_0x18c50d[_0x90a2('0x3e')][_0x90a2('0x2a')]);_0x5bbb72[_0x90a2('0x29')]=qs['offset'](_0x18c50d[_0x90a2('0x3e')][_0x90a2('0x29')]);}return _0x985dbe[_0x90a2('0x5a')](_0x5bbb72);}})['then'](function(_0xdbc627){if(_0xdbc627){return _0xdbc627?{'count':_0x517361,'rows':_0xdbc627}:null;}})[_0x90a2('0x2f')](respondWithResult(_0x5b7615,null))[_0x90a2('0x25')](handleError(_0x5b7615,null));};exports['getDescriptions']=function(_0x16dd97,_0x48d7c0,_0x1f5062){var _0xdcf3a8={};var _0x559ae1={};var _0x1fec44;var _0x9b6ca6;return db['VtigerConfiguration'][_0x90a2('0x57')]({'where':{'id':_0x16dd97[_0x90a2('0x50')]['id']}})['then'](handleEntityNotFound(_0x48d7c0,null))[_0x90a2('0x2f')](function(_0x3652a2){if(_0x3652a2){_0x1fec44=_0x3652a2;_0x559ae1[_0x90a2('0x3b')]=_[_0x90a2('0x51')](db['VtigerField']['rawAttributes']);_0x559ae1[_0x90a2('0x3e')]=_[_0x90a2('0x51')](_0x16dd97['query']);_0x559ae1[_0x90a2('0x3d')]=_[_0x90a2('0x3f')](_0x559ae1[_0x90a2('0x3b')],_0x559ae1['query']);_0xdcf3a8[_0x90a2('0x41')]=_[_0x90a2('0x3f')](_0x559ae1[_0x90a2('0x3b')],qs[_0x90a2('0x40')](_0x16dd97[_0x90a2('0x3e')][_0x90a2('0x40')]));_0xdcf3a8[_0x90a2('0x41')]=_0xdcf3a8[_0x90a2('0x41')][_0x90a2('0x42')]?_0xdcf3a8[_0x90a2('0x41')]:_0x559ae1[_0x90a2('0x3b')];_0xdcf3a8[_0x90a2('0x45')]=qs[_0x90a2('0x46')](_0x16dd97[_0x90a2('0x3e')]['sort']);_0xdcf3a8[_0x90a2('0x47')]=qs[_0x90a2('0x3d')](_['pick'](_0x16dd97[_0x90a2('0x3e')],_0x559ae1[_0x90a2('0x3d')]));if(_0x16dd97[_0x90a2('0x3e')][_0x90a2('0x49')]){_0xdcf3a8[_0x90a2('0x47')]=_[_0x90a2('0x52')](_0xdcf3a8[_0x90a2('0x47')],{'$or':_['map'](_0xdcf3a8[_0x90a2('0x41')],function(_0x1eb58d){var _0x5cba96={};_0x5cba96[_0x1eb58d]={'$like':'%'+_0x16dd97[_0x90a2('0x3e')]['filter']+'%'};return _0x5cba96;})});}_0xdcf3a8=_['merge']({},_0xdcf3a8,_0x16dd97[_0x90a2('0x4b')]);return _0x1fec44[_0x90a2('0x5b')](_0xdcf3a8);}})[_0x90a2('0x2f')](function(_0x23c023){if(_0x23c023){_0x9b6ca6=_0x23c023[_0x90a2('0x42')];if(!_0x16dd97[_0x90a2('0x3e')][_0x90a2('0x43')](_0x90a2('0x44'))){_0xdcf3a8[_0x90a2('0x2a')]=qs[_0x90a2('0x2a')](_0x16dd97[_0x90a2('0x3e')][_0x90a2('0x2a')]);_0xdcf3a8[_0x90a2('0x29')]=qs[_0x90a2('0x29')](_0x16dd97[_0x90a2('0x3e')][_0x90a2('0x29')]);}return _0x1fec44[_0x90a2('0x5b')](_0xdcf3a8);}})['then'](function(_0x1439ab){if(_0x1439ab){return _0x1439ab?{'count':_0x9b6ca6,'rows':_0x1439ab}:null;}})['then'](respondWithResult(_0x48d7c0,null))['catch'](handleError(_0x48d7c0,null));};
\ No newline at end of file
+var _0xf71b=['ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','update','destroy','then','error','stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','options','find','create','body','getFields','findOne','VtigerField','order','getSubjects','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv'];(function(_0xa763c1,_0xb5e51){var _0x3774c0=function(_0x30d0dc){while(--_0x30d0dc){_0xa763c1['push'](_0xa763c1['shift']());}};_0x3774c0(++_0xb5e51);}(_0xf71b,0x8e));var _0xbf71=function(_0x50924b,_0x56851c){_0x50924b=_0x50924b-0x0;var _0x1815a4=_0xf71b[_0x50924b];return _0x1815a4;};'use strict';var emlformat=require(_0xbf71('0x0'));var rimraf=require(_0xbf71('0x1'));var zipdir=require(_0xbf71('0x2'));var jsonpatch=require(_0xbf71('0x3'));var rp=require(_0xbf71('0x4'));var moment=require(_0xbf71('0x5'));var BPromise=require(_0xbf71('0x6'));var Mustache=require('mustache');var util=require(_0xbf71('0x7'));var path=require('path');var sox=require(_0xbf71('0x8'));var csv=require(_0xbf71('0x9'));var ejs=require(_0xbf71('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbf71('0xb'));var squel=require(_0xbf71('0xc'));var crypto=require(_0xbf71('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf71('0x9'));var querystring=require(_0xbf71('0xe'));var Papa=require('papaparse');var Redis=require(_0xbf71('0xf'));var authService=require(_0xbf71('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf71('0x11'));var logger=require('../../config/logger')(_0xbf71('0x12'));var utils=require('../../config/utils');var config=require(_0xbf71('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xbf71('0x14'))['db'];function respondWithStatusCode(_0x5bb27c,_0x59756a){_0x59756a=_0x59756a||0xcc;return function(_0x1f7527){if(_0x1f7527){return _0x5bb27c[_0xbf71('0x15')](_0x59756a);}return _0x5bb27c['status'](_0x59756a)[_0xbf71('0x16')]();};}function respondWithResult(_0x3a6955,_0x3c93cd){_0x3c93cd=_0x3c93cd||0xc8;return function(_0x443d02){if(_0x443d02){return _0x3a6955['status'](_0x3c93cd)['json'](_0x443d02);}};}function respondWithFilteredResult(_0x1f7074,_0x1709b6){return function(_0x4e0f2c){if(_0x4e0f2c){var _0x55c2bf=typeof _0x1709b6[_0xbf71('0x17')]===_0xbf71('0x18')&&typeof _0x1709b6[_0xbf71('0x19')]===_0xbf71('0x18');var _0x5ef59d=_0x4e0f2c[_0xbf71('0x1a')];var _0x3db5e4=_0x55c2bf?0x0:_0x1709b6[_0xbf71('0x17')];var _0x490cb=_0x55c2bf?_0x4e0f2c[_0xbf71('0x1a')]:_0x1709b6[_0xbf71('0x17')]+_0x1709b6[_0xbf71('0x19')];var _0x476e52;if(_0x490cb>=_0x5ef59d){_0x490cb=_0x5ef59d;_0x476e52=0xc8;}else{_0x476e52=0xce;}_0x1f7074[_0xbf71('0x1b')](_0x476e52);return _0x1f7074[_0xbf71('0x1c')](_0xbf71('0x1d'),_0x3db5e4+'-'+_0x490cb+'/'+_0x5ef59d)[_0xbf71('0x1e')](_0x4e0f2c);}return null;};}function patchUpdates(_0xc2d725){return function(_0x375aab){try{jsonpatch[_0xbf71('0x1f')](_0x375aab,_0xc2d725,!![]);}catch(_0x1561c0){return BPromise['reject'](_0x1561c0);}return _0x375aab['save']();};}function saveUpdates(_0x525498,_0x4144e0){return function(_0x25b10e){if(_0x25b10e){return _0x25b10e[_0xbf71('0x20')](_0x525498)['then'](function(_0x47573e){return _0x47573e;});}return null;};}function removeEntity(_0x327220,_0x117a8a){return function(_0x48556a){if(_0x48556a){return _0x48556a[_0xbf71('0x21')]()[_0xbf71('0x22')](function(){_0x327220[_0xbf71('0x1b')](0xcc)[_0xbf71('0x16')]();});}};}function handleEntityNotFound(_0x2056b6,_0x207686){return function(_0x4cba63){if(!_0x4cba63){_0x2056b6['sendStatus'](0x194);}return _0x4cba63;};}function handleError(_0x158654,_0x5c324a){_0x5c324a=_0x5c324a||0x1f4;return function(_0x30790d){logger[_0xbf71('0x23')](_0x30790d[_0xbf71('0x24')]);if(_0x30790d[_0xbf71('0x25')]){delete _0x30790d[_0xbf71('0x25')];}_0x158654[_0xbf71('0x1b')](_0x5c324a)[_0xbf71('0x26')](_0x30790d);};}exports['index']=function(_0x523119,_0x165198){var _0x292869={},_0x5a4564={},_0x5aaefc={'count':0x0,'rows':[]};var _0x223382=_[_0xbf71('0x27')](db[_0xbf71('0x28')][_0xbf71('0x29')],function(_0x5227b1){return{'name':_0x5227b1[_0xbf71('0x2a')],'type':_0x5227b1[_0xbf71('0x2b')]['key']};});_0x5a4564[_0xbf71('0x2c')]=_[_0xbf71('0x27')](_0x223382,_0xbf71('0x25'));_0x5a4564[_0xbf71('0x2d')]=_['keys'](_0x523119[_0xbf71('0x2d')]);_0x5a4564[_0xbf71('0x2e')]=_[_0xbf71('0x2f')](_0x5a4564['model'],_0x5a4564[_0xbf71('0x2d')]);_0x292869[_0xbf71('0x30')]=_[_0xbf71('0x2f')](_0x5a4564[_0xbf71('0x2c')],qs[_0xbf71('0x31')](_0x523119[_0xbf71('0x2d')][_0xbf71('0x31')]));_0x292869['attributes']=_0x292869['attributes'][_0xbf71('0x32')]?_0x292869[_0xbf71('0x30')]:_0x5a4564[_0xbf71('0x2c')];if(!_0x523119['query'][_0xbf71('0x33')](_0xbf71('0x34'))){_0x292869['limit']=qs['limit'](_0x523119[_0xbf71('0x2d')][_0xbf71('0x19')]);_0x292869['offset']=qs[_0xbf71('0x17')](_0x523119[_0xbf71('0x2d')][_0xbf71('0x17')]);}_0x292869['order']=qs[_0xbf71('0x35')](_0x523119[_0xbf71('0x2d')][_0xbf71('0x35')]);_0x292869[_0xbf71('0x36')]=qs[_0xbf71('0x2e')](_['pick'](_0x523119[_0xbf71('0x2d')],_0x5a4564[_0xbf71('0x2e')]),_0x223382);if(_0x523119[_0xbf71('0x2d')][_0xbf71('0x37')]){_0x292869[_0xbf71('0x36')]=_[_0xbf71('0x38')](_0x292869[_0xbf71('0x36')],{'$or':_[_0xbf71('0x27')](_0x223382,function(_0x16d1e7){if(_0x16d1e7['type']!==_0xbf71('0x39')){var _0x343d6c={};_0x343d6c[_0x16d1e7[_0xbf71('0x25')]]={'$like':'%'+_0x523119['query'][_0xbf71('0x37')]+'%'};return _0x343d6c;}})});}_0x292869=_[_0xbf71('0x38')]({},_0x292869,_0x523119['options']);var _0x301cc9={'where':_0x292869['where']};return db[_0xbf71('0x28')]['count'](_0x301cc9)[_0xbf71('0x22')](function(_0x20148c){_0x5aaefc['count']=_0x20148c;if(_0x523119[_0xbf71('0x2d')][_0xbf71('0x3a')]){_0x292869['include']=[{'all':!![]}];}return db[_0xbf71('0x28')][_0xbf71('0x3b')](_0x292869);})[_0xbf71('0x22')](function(_0x51a720){_0x5aaefc[_0xbf71('0x3c')]=_0x51a720;return _0x5aaefc;})[_0xbf71('0x22')](respondWithFilteredResult(_0x165198,_0x292869))[_0xbf71('0x3d')](handleError(_0x165198,null));};exports[_0xbf71('0x3e')]=function(_0x46d7a4,_0x4976bc){var _0x561d41={'raw':![],'where':{'id':_0x46d7a4[_0xbf71('0x3f')]['id']}},_0x290eef={};_0x290eef[_0xbf71('0x2c')]=_['keys'](db['VtigerConfiguration'][_0xbf71('0x29')]);_0x290eef[_0xbf71('0x2d')]=_[_0xbf71('0x40')](_0x46d7a4['query']);_0x290eef[_0xbf71('0x2e')]=_[_0xbf71('0x2f')](_0x290eef[_0xbf71('0x2c')],_0x290eef[_0xbf71('0x2d')]);_0x561d41[_0xbf71('0x30')]=_[_0xbf71('0x2f')](_0x290eef['model'],qs[_0xbf71('0x31')](_0x46d7a4[_0xbf71('0x2d')][_0xbf71('0x31')]));_0x561d41['attributes']=_0x561d41[_0xbf71('0x30')]['length']?_0x561d41[_0xbf71('0x30')]:_0x290eef[_0xbf71('0x2c')];if(_0x46d7a4[_0xbf71('0x2d')][_0xbf71('0x3a')]){_0x561d41['include']=[{'all':!![]}];}_0x561d41=_[_0xbf71('0x38')]({},_0x561d41,_0x46d7a4[_0xbf71('0x41')]);return db[_0xbf71('0x28')][_0xbf71('0x42')](_0x561d41)[_0xbf71('0x22')](handleEntityNotFound(_0x4976bc,null))[_0xbf71('0x22')](respondWithResult(_0x4976bc,null))[_0xbf71('0x3d')](handleError(_0x4976bc,null));};exports[_0xbf71('0x43')]=function(_0x268901,_0x5adb13){return db[_0xbf71('0x28')]['create'](_0x268901['body'],{})['then'](respondWithResult(_0x5adb13,0xc9))['catch'](handleError(_0x5adb13,null));};exports[_0xbf71('0x20')]=function(_0x398d05,_0x554fd0){if(_0x398d05[_0xbf71('0x44')]['id']){delete _0x398d05['body']['id'];}return db[_0xbf71('0x28')][_0xbf71('0x42')]({'where':{'id':_0x398d05[_0xbf71('0x3f')]['id']}})[_0xbf71('0x22')](handleEntityNotFound(_0x554fd0,null))[_0xbf71('0x22')](saveUpdates(_0x398d05[_0xbf71('0x44')],null))[_0xbf71('0x22')](respondWithResult(_0x554fd0,null))[_0xbf71('0x3d')](handleError(_0x554fd0,null));};exports['destroy']=function(_0x47070a,_0x345515){return db[_0xbf71('0x28')]['find']({'where':{'id':_0x47070a[_0xbf71('0x3f')]['id']}})['then'](handleEntityNotFound(_0x345515,null))['then'](removeEntity(_0x345515,null))[_0xbf71('0x3d')](handleError(_0x345515,null));};exports[_0xbf71('0x45')]=function(_0x571536,_0x21a55c,_0x266049){var _0xedd86b={};var _0xf51ff8={};var _0xafd18b;var _0x2c01a6;return db[_0xbf71('0x28')][_0xbf71('0x46')]({'where':{'id':_0x571536['params']['id']}})[_0xbf71('0x22')](handleEntityNotFound(_0x21a55c,null))['then'](function(_0x12ccc3){if(_0x12ccc3){_0xafd18b=_0x12ccc3;_0xf51ff8['model']=_['keys'](db[_0xbf71('0x47')][_0xbf71('0x29')]);_0xf51ff8[_0xbf71('0x2d')]=_['keys'](_0x571536[_0xbf71('0x2d')]);_0xf51ff8['filters']=_[_0xbf71('0x2f')](_0xf51ff8[_0xbf71('0x2c')],_0xf51ff8[_0xbf71('0x2d')]);_0xedd86b['attributes']=_['intersection'](_0xf51ff8['model'],qs[_0xbf71('0x31')](_0x571536['query'][_0xbf71('0x31')]));_0xedd86b[_0xbf71('0x30')]=_0xedd86b[_0xbf71('0x30')][_0xbf71('0x32')]?_0xedd86b['attributes']:_0xf51ff8['model'];_0xedd86b[_0xbf71('0x48')]=qs[_0xbf71('0x35')](_0x571536[_0xbf71('0x2d')][_0xbf71('0x35')]);_0xedd86b['where']=qs[_0xbf71('0x2e')](_['pick'](_0x571536[_0xbf71('0x2d')],_0xf51ff8[_0xbf71('0x2e')]));if(_0x571536['query'][_0xbf71('0x37')]){_0xedd86b[_0xbf71('0x36')]=_[_0xbf71('0x38')](_0xedd86b['where'],{'$or':_[_0xbf71('0x27')](_0xedd86b[_0xbf71('0x30')],function(_0x42192a){var _0x22fdf8={};_0x22fdf8[_0x42192a]={'$like':'%'+_0x571536[_0xbf71('0x2d')][_0xbf71('0x37')]+'%'};return _0x22fdf8;})});}_0xedd86b=_[_0xbf71('0x38')]({},_0xedd86b,_0x571536['options']);return _0xafd18b[_0xbf71('0x45')](_0xedd86b);}})['then'](function(_0x56c772){if(_0x56c772){_0x2c01a6=_0x56c772[_0xbf71('0x32')];if(!_0x571536[_0xbf71('0x2d')]['hasOwnProperty'](_0xbf71('0x34'))){_0xedd86b[_0xbf71('0x19')]=qs['limit'](_0x571536['query']['limit']);_0xedd86b['offset']=qs[_0xbf71('0x17')](_0x571536[_0xbf71('0x2d')]['offset']);}return _0xafd18b[_0xbf71('0x45')](_0xedd86b);}})['then'](function(_0x8ce0b2){if(_0x8ce0b2){return _0x8ce0b2?{'count':_0x2c01a6,'rows':_0x8ce0b2}:null;}})[_0xbf71('0x22')](respondWithResult(_0x21a55c,null))[_0xbf71('0x3d')](handleError(_0x21a55c,null));};exports[_0xbf71('0x49')]=function(_0xc8ab3d,_0x26a13d,_0xdecd2e){var _0x3ff8f9={};var _0x32ecf0={};var _0xff1859;var _0x3df669;return db[_0xbf71('0x28')]['findOne']({'where':{'id':_0xc8ab3d[_0xbf71('0x3f')]['id']}})[_0xbf71('0x22')](handleEntityNotFound(_0x26a13d,null))['then'](function(_0x2f9106){if(_0x2f9106){_0xff1859=_0x2f9106;_0x32ecf0[_0xbf71('0x2c')]=_[_0xbf71('0x40')](db[_0xbf71('0x47')][_0xbf71('0x29')]);_0x32ecf0['query']=_[_0xbf71('0x40')](_0xc8ab3d[_0xbf71('0x2d')]);_0x32ecf0['filters']=_[_0xbf71('0x2f')](_0x32ecf0[_0xbf71('0x2c')],_0x32ecf0[_0xbf71('0x2d')]);_0x3ff8f9[_0xbf71('0x30')]=_['intersection'](_0x32ecf0[_0xbf71('0x2c')],qs['fields'](_0xc8ab3d[_0xbf71('0x2d')][_0xbf71('0x31')]));_0x3ff8f9[_0xbf71('0x30')]=_0x3ff8f9[_0xbf71('0x30')][_0xbf71('0x32')]?_0x3ff8f9[_0xbf71('0x30')]:_0x32ecf0[_0xbf71('0x2c')];_0x3ff8f9[_0xbf71('0x48')]=qs[_0xbf71('0x35')](_0xc8ab3d[_0xbf71('0x2d')][_0xbf71('0x35')]);_0x3ff8f9['where']=qs['filters'](_[_0xbf71('0x4a')](_0xc8ab3d[_0xbf71('0x2d')],_0x32ecf0[_0xbf71('0x2e')]));if(_0xc8ab3d[_0xbf71('0x2d')][_0xbf71('0x37')]){_0x3ff8f9[_0xbf71('0x36')]=_[_0xbf71('0x38')](_0x3ff8f9[_0xbf71('0x36')],{'$or':_['map'](_0x3ff8f9['attributes'],function(_0x37f42d){var _0x12f993={};_0x12f993[_0x37f42d]={'$like':'%'+_0xc8ab3d[_0xbf71('0x2d')][_0xbf71('0x37')]+'%'};return _0x12f993;})});}_0x3ff8f9=_[_0xbf71('0x38')]({},_0x3ff8f9,_0xc8ab3d[_0xbf71('0x41')]);return _0xff1859[_0xbf71('0x49')](_0x3ff8f9);}})[_0xbf71('0x22')](function(_0xeb4b98){if(_0xeb4b98){_0x3df669=_0xeb4b98[_0xbf71('0x32')];if(!_0xc8ab3d[_0xbf71('0x2d')][_0xbf71('0x33')](_0xbf71('0x34'))){_0x3ff8f9['limit']=qs[_0xbf71('0x19')](_0xc8ab3d[_0xbf71('0x2d')][_0xbf71('0x19')]);_0x3ff8f9['offset']=qs[_0xbf71('0x17')](_0xc8ab3d[_0xbf71('0x2d')][_0xbf71('0x17')]);}return _0xff1859[_0xbf71('0x49')](_0x3ff8f9);}})[_0xbf71('0x22')](function(_0x2fe131){if(_0x2fe131){return _0x2fe131?{'count':_0x3df669,'rows':_0x2fe131}:null;}})[_0xbf71('0x22')](respondWithResult(_0x26a13d,null))['catch'](handleError(_0x26a13d,null));};exports['getDescriptions']=function(_0x5b074c,_0x41abe4,_0x1a75c8){var _0x4ec41e={};var _0x5a1fe1={};var _0x5468f0;var _0x3dfc55;return db[_0xbf71('0x28')][_0xbf71('0x46')]({'where':{'id':_0x5b074c[_0xbf71('0x3f')]['id']}})[_0xbf71('0x22')](handleEntityNotFound(_0x41abe4,null))[_0xbf71('0x22')](function(_0x5c0208){if(_0x5c0208){_0x5468f0=_0x5c0208;_0x5a1fe1[_0xbf71('0x2c')]=_[_0xbf71('0x40')](db[_0xbf71('0x47')]['rawAttributes']);_0x5a1fe1['query']=_[_0xbf71('0x40')](_0x5b074c['query']);_0x5a1fe1[_0xbf71('0x2e')]=_[_0xbf71('0x2f')](_0x5a1fe1['model'],_0x5a1fe1['query']);_0x4ec41e['attributes']=_[_0xbf71('0x2f')](_0x5a1fe1['model'],qs[_0xbf71('0x31')](_0x5b074c[_0xbf71('0x2d')][_0xbf71('0x31')]));_0x4ec41e[_0xbf71('0x30')]=_0x4ec41e[_0xbf71('0x30')]['length']?_0x4ec41e[_0xbf71('0x30')]:_0x5a1fe1['model'];_0x4ec41e[_0xbf71('0x48')]=qs[_0xbf71('0x35')](_0x5b074c[_0xbf71('0x2d')]['sort']);_0x4ec41e[_0xbf71('0x36')]=qs['filters'](_[_0xbf71('0x4a')](_0x5b074c[_0xbf71('0x2d')],_0x5a1fe1['filters']));if(_0x5b074c[_0xbf71('0x2d')][_0xbf71('0x37')]){_0x4ec41e[_0xbf71('0x36')]=_[_0xbf71('0x38')](_0x4ec41e[_0xbf71('0x36')],{'$or':_['map'](_0x4ec41e[_0xbf71('0x30')],function(_0x199890){var _0x14e4ce={};_0x14e4ce[_0x199890]={'$like':'%'+_0x5b074c[_0xbf71('0x2d')][_0xbf71('0x37')]+'%'};return _0x14e4ce;})});}_0x4ec41e=_['merge']({},_0x4ec41e,_0x5b074c[_0xbf71('0x41')]);return _0x5468f0[_0xbf71('0x4b')](_0x4ec41e);}})[_0xbf71('0x22')](function(_0x3f22a3){if(_0x3f22a3){_0x3dfc55=_0x3f22a3[_0xbf71('0x32')];if(!_0x5b074c[_0xbf71('0x2d')]['hasOwnProperty'](_0xbf71('0x34'))){_0x4ec41e['limit']=qs[_0xbf71('0x19')](_0x5b074c['query'][_0xbf71('0x19')]);_0x4ec41e['offset']=qs[_0xbf71('0x17')](_0x5b074c[_0xbf71('0x2d')][_0xbf71('0x17')]);}return _0x5468f0['getDescriptions'](_0x4ec41e);}})[_0xbf71('0x22')](function(_0x4123dc){if(_0x4123dc){return _0x4123dc?{'count':_0x3dfc55,'rows':_0x4123dc}:null;}})['then'](respondWithResult(_0x41abe4,null))[_0xbf71('0x3d')](handleError(_0x41abe4,null));};
\ No newline at end of file