Built motion from commit 753c950e.|2.5.42
[motion2.git] / server / api / faxTransferReport / faxTransferReport.controller.js
index a2454f7..33f2fb8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8e74=['includeAll','include','findAll','rows','catch','params','find','create','body','update','describe','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','save','then','destroy','name','index','FaxTransferReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options'];(function(_0x4884a7,_0x18e38a){var _0x56b60e=function(_0x2ba8a3){while(--_0x2ba8a3){_0x4884a7['push'](_0x4884a7['shift']());}};_0x56b60e(++_0x18e38a);}(_0x8e74,0x97));var _0x48e7=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x8e74[_0x20ef64];return _0x3707d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x48e7('0x0'));var zipdir=require(_0x48e7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x48e7('0x2'));var moment=require(_0x48e7('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x48e7('0x4'));var path=require(_0x48e7('0x5'));var sox=require('sox');var csv=require(_0x48e7('0x6'));var ejs=require(_0x48e7('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x48e7('0x8'));var squel=require('squel');var crypto=require(_0x48e7('0x9'));var jsforce=require(_0x48e7('0xa'));var deskjs=require(_0x48e7('0xb'));var toCsv=require(_0x48e7('0x6'));var querystring=require(_0x48e7('0xc'));var Papa=require(_0x48e7('0xd'));var Redis=require('ioredis');var authService=require(_0x48e7('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x48e7('0xf'));var hardwareService=require(_0x48e7('0x10'));var logger=require(_0x48e7('0x11'))(_0x48e7('0x12'));var utils=require(_0x48e7('0x13'));var config=require(_0x48e7('0x14'));var licenseUtil=require(_0x48e7('0x15'));var db=require(_0x48e7('0x16'))['db'];function respondWithStatusCode(_0x40dd12,_0x1fbf79){_0x1fbf79=_0x1fbf79||0xcc;return function(_0x5b6238){if(_0x5b6238){return _0x40dd12[_0x48e7('0x17')](_0x1fbf79);}return _0x40dd12['status'](_0x1fbf79)[_0x48e7('0x18')]();};}function respondWithResult(_0x2ee279,_0x3b95dd){_0x3b95dd=_0x3b95dd||0xc8;return function(_0x1a3368){if(_0x1a3368){return _0x2ee279[_0x48e7('0x19')](_0x3b95dd)[_0x48e7('0x1a')](_0x1a3368);}};}function respondWithFilteredResult(_0x51358e,_0xc20016){return function(_0x573bb9){if(_0x573bb9){var _0x360ad5=_0x573bb9[_0x48e7('0x1b')],_0x1d98ae=_0xc20016[_0x48e7('0x1c')],_0x361dda=_0xc20016[_0x48e7('0x1c')]+_0xc20016[_0x48e7('0x1d')],_0x5dfa95;if(_0x361dda>=_0x360ad5){_0x361dda=_0x360ad5;_0x5dfa95=0xc8;}else{_0x5dfa95=0xce;}_0x51358e['status'](_0x5dfa95);return _0x51358e['set'](_0x48e7('0x1e'),_0x1d98ae+'-'+_0x361dda+'/'+_0x360ad5)[_0x48e7('0x1a')](_0x573bb9);}return null;};}function patchUpdates(_0x46856b){return function(_0x36b202){try{jsonpatch['apply'](_0x36b202,_0x46856b,!![]);}catch(_0x5cc946){return BPromise[_0x48e7('0x1f')](_0x5cc946);}return _0x36b202[_0x48e7('0x20')]();};}function saveUpdates(_0x95398e,_0x3c6deb){return function(_0x57330f){if(_0x57330f){return _0x57330f['update'](_0x95398e)[_0x48e7('0x21')](function(_0x4d4e15){return _0x4d4e15;});}return null;};}function removeEntity(_0x418c0c,_0x1e85fc){return function(_0x3be26d){if(_0x3be26d){return _0x3be26d[_0x48e7('0x22')]()['then'](function(){_0x418c0c[_0x48e7('0x19')](0xcc)[_0x48e7('0x18')]();});}};}function handleEntityNotFound(_0x446a28,_0x566655){return function(_0x1f7640){if(!_0x1f7640){_0x446a28['sendStatus'](0x194);}return _0x1f7640;};}function handleError(_0x2fc785,_0x2a75d3){_0x2a75d3=_0x2a75d3||0x1f4;return function(_0x47217d){logger['error'](_0x47217d['stack']);if(_0x47217d[_0x48e7('0x23')]){delete _0x47217d[_0x48e7('0x23')];}_0x2fc785[_0x48e7('0x19')](_0x2a75d3)['send'](_0x47217d);};}exports[_0x48e7('0x24')]=function(_0x18db89,_0x4d72ea){var _0x11ddc5={},_0xda6345={},_0x287477={'count':0x0,'rows':[]};var _0x106a2f=_['map'](db[_0x48e7('0x25')][_0x48e7('0x26')],function(_0x5bbf02){return{'name':_0x5bbf02[_0x48e7('0x27')],'type':_0x5bbf02[_0x48e7('0x28')]['key']};});_0xda6345[_0x48e7('0x29')]=_[_0x48e7('0x2a')](_0x106a2f,'name');_0xda6345[_0x48e7('0x2b')]=_[_0x48e7('0x2c')](_0x18db89['query']);_0xda6345[_0x48e7('0x2d')]=_['intersection'](_0xda6345['model'],_0xda6345['query']);_0x11ddc5['attributes']=_[_0x48e7('0x2e')](_0xda6345[_0x48e7('0x29')],qs[_0x48e7('0x2f')](_0x18db89[_0x48e7('0x2b')][_0x48e7('0x2f')]));_0x11ddc5[_0x48e7('0x30')]=_0x11ddc5['attributes'][_0x48e7('0x31')]?_0x11ddc5['attributes']:_0xda6345[_0x48e7('0x29')];if(!_0x18db89[_0x48e7('0x2b')][_0x48e7('0x32')](_0x48e7('0x33'))){_0x11ddc5[_0x48e7('0x1d')]=qs[_0x48e7('0x1d')](_0x18db89['query']['limit']);_0x11ddc5['offset']=qs[_0x48e7('0x1c')](_0x18db89['query'][_0x48e7('0x1c')]);}_0x11ddc5[_0x48e7('0x34')]=qs['sort'](_0x18db89['query'][_0x48e7('0x35')]);_0x11ddc5[_0x48e7('0x36')]=qs[_0x48e7('0x2d')](_['pick'](_0x18db89[_0x48e7('0x2b')],_0xda6345['filters']),_0x106a2f);if(_0x18db89[_0x48e7('0x2b')][_0x48e7('0x37')]){_0x11ddc5['where']=_['merge'](_0x11ddc5[_0x48e7('0x36')],{'$or':_[_0x48e7('0x2a')](_0x106a2f,function(_0x18485b){if(_0x18485b[_0x48e7('0x28')]!==_0x48e7('0x38')){var _0x533f25={};_0x533f25[_0x18485b['name']]={'$like':'%'+_0x18db89[_0x48e7('0x2b')][_0x48e7('0x37')]+'%'};return _0x533f25;}})});}_0x11ddc5=_[_0x48e7('0x39')]({},_0x11ddc5,_0x18db89[_0x48e7('0x3a')]);var _0x314f31={'where':_0x11ddc5[_0x48e7('0x36')]};return db[_0x48e7('0x25')][_0x48e7('0x1b')](_0x314f31)[_0x48e7('0x21')](function(_0x4189a7){_0x287477['count']=_0x4189a7;if(_0x18db89[_0x48e7('0x2b')][_0x48e7('0x3b')]){_0x11ddc5[_0x48e7('0x3c')]=[{'all':!![]}];}return db[_0x48e7('0x25')][_0x48e7('0x3d')](_0x11ddc5);})[_0x48e7('0x21')](function(_0x5466b8){_0x287477[_0x48e7('0x3e')]=_0x5466b8;return _0x287477;})[_0x48e7('0x21')](respondWithFilteredResult(_0x4d72ea,_0x11ddc5))[_0x48e7('0x3f')](handleError(_0x4d72ea,null));};exports['show']=function(_0x49bf34,_0x2fdd72){var _0x544fbb={'raw':!![],'where':{'id':_0x49bf34[_0x48e7('0x40')]['id']}},_0x46b43d={};_0x46b43d[_0x48e7('0x29')]=_['keys'](db[_0x48e7('0x25')]['rawAttributes']);_0x46b43d[_0x48e7('0x2b')]=_['keys'](_0x49bf34[_0x48e7('0x2b')]);_0x46b43d['filters']=_[_0x48e7('0x2e')](_0x46b43d[_0x48e7('0x29')],_0x46b43d['query']);_0x544fbb[_0x48e7('0x30')]=_['intersection'](_0x46b43d[_0x48e7('0x29')],qs[_0x48e7('0x2f')](_0x49bf34[_0x48e7('0x2b')][_0x48e7('0x2f')]));_0x544fbb[_0x48e7('0x30')]=_0x544fbb[_0x48e7('0x30')]['length']?_0x544fbb[_0x48e7('0x30')]:_0x46b43d[_0x48e7('0x29')];if(_0x49bf34[_0x48e7('0x2b')]['includeAll']){_0x544fbb['include']=[{'all':!![]}];}_0x544fbb=_[_0x48e7('0x39')]({},_0x544fbb,_0x49bf34[_0x48e7('0x3a')]);return db[_0x48e7('0x25')][_0x48e7('0x41')](_0x544fbb)[_0x48e7('0x21')](handleEntityNotFound(_0x2fdd72,null))[_0x48e7('0x21')](respondWithResult(_0x2fdd72,null))['catch'](handleError(_0x2fdd72,null));};exports[_0x48e7('0x42')]=function(_0x4d9259,_0x143ce4){return db[_0x48e7('0x25')][_0x48e7('0x42')](_0x4d9259[_0x48e7('0x43')],{})[_0x48e7('0x21')](respondWithResult(_0x143ce4,0xc9))[_0x48e7('0x3f')](handleError(_0x143ce4,null));};exports[_0x48e7('0x44')]=function(_0x923d77,_0x396291){if(_0x923d77[_0x48e7('0x43')]['id']){delete _0x923d77['body']['id'];}return db[_0x48e7('0x25')][_0x48e7('0x41')]({'where':{'id':_0x923d77[_0x48e7('0x40')]['id']}})[_0x48e7('0x21')](handleEntityNotFound(_0x396291,null))[_0x48e7('0x21')](saveUpdates(_0x923d77['body'],null))[_0x48e7('0x21')](respondWithResult(_0x396291,null))['catch'](handleError(_0x396291,null));};exports[_0x48e7('0x22')]=function(_0x578c77,_0x351631){return db[_0x48e7('0x25')]['find']({'where':{'id':_0x578c77['params']['id']}})[_0x48e7('0x21')](handleEntityNotFound(_0x351631,null))[_0x48e7('0x21')](removeEntity(_0x351631,null))[_0x48e7('0x3f')](handleError(_0x351631,null));};exports[_0x48e7('0x45')]=function(_0x31328f,_0x216e97){return db[_0x48e7('0x25')][_0x48e7('0x45')]()[_0x48e7('0x21')](respondWithResult(_0x216e97,null))[_0x48e7('0x3f')](handleError(_0x216e97,null));};
\ No newline at end of file
+var _0x00a8=['keys','filters','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','intersection','fields','include','create','body','update','find','params','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','end','error','name','send','map','FaxTransferReport','rawAttributes','type','key','query'];(function(_0x3b4cf2,_0xcd14fe){var _0x275256=function(_0x49f7d7){while(--_0x49f7d7){_0x3b4cf2['push'](_0x3b4cf2['shift']());}};_0x275256(++_0xcd14fe);}(_0x00a8,0xff));var _0x800a=function(_0x39fd80,_0x6c3bc5){_0x39fd80=_0x39fd80-0x0;var _0x1a6c57=_0x00a8[_0x39fd80];return _0x1a6c57;};'use strict';var emlformat=require(_0x800a('0x0'));var rimraf=require(_0x800a('0x1'));var zipdir=require(_0x800a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x800a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x800a('0x4'));var util=require(_0x800a('0x5'));var path=require(_0x800a('0x6'));var sox=require(_0x800a('0x7'));var csv=require('to-csv');var ejs=require(_0x800a('0x8'));var fs=require('fs');var fs_extra=require(_0x800a('0x9'));var _=require(_0x800a('0xa'));var squel=require(_0x800a('0xb'));var crypto=require(_0x800a('0xc'));var jsforce=require(_0x800a('0xd'));var deskjs=require(_0x800a('0xe'));var toCsv=require(_0x800a('0xf'));var querystring=require(_0x800a('0x10'));var Papa=require(_0x800a('0x11'));var Redis=require(_0x800a('0x12'));var authService=require(_0x800a('0x13'));var qs=require(_0x800a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x800a('0x15'));var logger=require('../../config/logger')(_0x800a('0x16'));var utils=require('../../config/utils');var config=require(_0x800a('0x17'));var licenseUtil=require(_0x800a('0x18'));var db=require(_0x800a('0x19'))['db'];function respondWithStatusCode(_0x27e033,_0x3649b2){_0x3649b2=_0x3649b2||0xcc;return function(_0x1d6853){if(_0x1d6853){return _0x27e033[_0x800a('0x1a')](_0x3649b2);}return _0x27e033[_0x800a('0x1b')](_0x3649b2)['end']();};}function respondWithResult(_0x143222,_0x3ed0c3){_0x3ed0c3=_0x3ed0c3||0xc8;return function(_0x45bdee){if(_0x45bdee){return _0x143222[_0x800a('0x1b')](_0x3ed0c3)[_0x800a('0x1c')](_0x45bdee);}};}function respondWithFilteredResult(_0x2d38e7,_0x146e36){return function(_0x2269cd){if(_0x2269cd){var _0x342865=typeof _0x146e36[_0x800a('0x1d')]===_0x800a('0x1e')&&typeof _0x146e36['limit']===_0x800a('0x1e');var _0x3354b9=_0x2269cd[_0x800a('0x1f')];var _0x35f21f=_0x342865?0x0:_0x146e36[_0x800a('0x1d')];var _0x2b3cae=_0x342865?_0x2269cd[_0x800a('0x1f')]:_0x146e36[_0x800a('0x1d')]+_0x146e36[_0x800a('0x20')];var _0x49458a;if(_0x2b3cae>=_0x3354b9){_0x2b3cae=_0x3354b9;_0x49458a=0xc8;}else{_0x49458a=0xce;}_0x2d38e7['status'](_0x49458a);return _0x2d38e7[_0x800a('0x21')](_0x800a('0x22'),_0x35f21f+'-'+_0x2b3cae+'/'+_0x3354b9)[_0x800a('0x1c')](_0x2269cd);}return null;};}function patchUpdates(_0xc7a7b4){return function(_0x591520){try{jsonpatch[_0x800a('0x23')](_0x591520,_0xc7a7b4,!![]);}catch(_0x773ae2){return BPromise['reject'](_0x773ae2);}return _0x591520[_0x800a('0x24')]();};}function saveUpdates(_0x416f0a,_0x378be6){return function(_0x217c2a){if(_0x217c2a){return _0x217c2a['update'](_0x416f0a)[_0x800a('0x25')](function(_0x3d60ab){return _0x3d60ab;});}return null;};}function removeEntity(_0x467aaf,_0x4a4493){return function(_0x44e671){if(_0x44e671){return _0x44e671[_0x800a('0x26')]()[_0x800a('0x25')](function(){_0x467aaf[_0x800a('0x1b')](0xcc)[_0x800a('0x27')]();});}};}function handleEntityNotFound(_0x151731,_0x3be692){return function(_0x37527c){if(!_0x37527c){_0x151731['sendStatus'](0x194);}return _0x37527c;};}function handleError(_0x3db217,_0x36a8c8){_0x36a8c8=_0x36a8c8||0x1f4;return function(_0x5ef24d){logger[_0x800a('0x28')](_0x5ef24d['stack']);if(_0x5ef24d[_0x800a('0x29')]){delete _0x5ef24d[_0x800a('0x29')];}_0x3db217[_0x800a('0x1b')](_0x36a8c8)[_0x800a('0x2a')](_0x5ef24d);};}exports['index']=function(_0x498ebd,_0x48b5ab){var _0x384571={},_0x123024={},_0x2702a5={'count':0x0,'rows':[]};var _0x150df5=_[_0x800a('0x2b')](db[_0x800a('0x2c')][_0x800a('0x2d')],function(_0x3b4898){return{'name':_0x3b4898['fieldName'],'type':_0x3b4898[_0x800a('0x2e')][_0x800a('0x2f')]};});_0x123024['model']=_[_0x800a('0x2b')](_0x150df5,_0x800a('0x29'));_0x123024[_0x800a('0x30')]=_[_0x800a('0x31')](_0x498ebd[_0x800a('0x30')]);_0x123024[_0x800a('0x32')]=_['intersection'](_0x123024[_0x800a('0x33')],_0x123024[_0x800a('0x30')]);_0x384571[_0x800a('0x34')]=_['intersection'](_0x123024[_0x800a('0x33')],qs['fields'](_0x498ebd[_0x800a('0x30')]['fields']));_0x384571[_0x800a('0x34')]=_0x384571[_0x800a('0x34')][_0x800a('0x35')]?_0x384571[_0x800a('0x34')]:_0x123024['model'];if(!_0x498ebd['query'][_0x800a('0x36')](_0x800a('0x37'))){_0x384571[_0x800a('0x20')]=qs[_0x800a('0x20')](_0x498ebd[_0x800a('0x30')][_0x800a('0x20')]);_0x384571[_0x800a('0x1d')]=qs[_0x800a('0x1d')](_0x498ebd[_0x800a('0x30')][_0x800a('0x1d')]);}_0x384571[_0x800a('0x38')]=qs[_0x800a('0x39')](_0x498ebd[_0x800a('0x30')][_0x800a('0x39')]);_0x384571[_0x800a('0x3a')]=qs['filters'](_['pick'](_0x498ebd[_0x800a('0x30')],_0x123024[_0x800a('0x32')]),_0x150df5);if(_0x498ebd[_0x800a('0x30')][_0x800a('0x3b')]){_0x384571[_0x800a('0x3a')]=_[_0x800a('0x3c')](_0x384571[_0x800a('0x3a')],{'$or':_[_0x800a('0x2b')](_0x150df5,function(_0x39696d){if(_0x39696d[_0x800a('0x2e')]!==_0x800a('0x3d')){var _0x29acaf={};_0x29acaf[_0x39696d[_0x800a('0x29')]]={'$like':'%'+_0x498ebd[_0x800a('0x30')][_0x800a('0x3b')]+'%'};return _0x29acaf;}})});}_0x384571=_[_0x800a('0x3c')]({},_0x384571,_0x498ebd[_0x800a('0x3e')]);var _0x4c4a43={'where':_0x384571[_0x800a('0x3a')]};return db[_0x800a('0x2c')][_0x800a('0x1f')](_0x4c4a43)['then'](function(_0x462d51){_0x2702a5[_0x800a('0x1f')]=_0x462d51;if(_0x498ebd[_0x800a('0x30')][_0x800a('0x3f')]){_0x384571['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0x800a('0x40')](_0x384571);})[_0x800a('0x25')](function(_0x5a2a8c){_0x2702a5[_0x800a('0x41')]=_0x5a2a8c;return _0x2702a5;})[_0x800a('0x25')](respondWithFilteredResult(_0x48b5ab,_0x384571))[_0x800a('0x42')](handleError(_0x48b5ab,null));};exports['show']=function(_0x5961a8,_0x32c5f3){var _0x1e52f8={'raw':!![],'where':{'id':_0x5961a8['params']['id']}},_0x1cfec6={};_0x1cfec6[_0x800a('0x33')]=_[_0x800a('0x31')](db[_0x800a('0x2c')][_0x800a('0x2d')]);_0x1cfec6[_0x800a('0x30')]=_[_0x800a('0x31')](_0x5961a8[_0x800a('0x30')]);_0x1cfec6[_0x800a('0x32')]=_[_0x800a('0x43')](_0x1cfec6[_0x800a('0x33')],_0x1cfec6[_0x800a('0x30')]);_0x1e52f8[_0x800a('0x34')]=_[_0x800a('0x43')](_0x1cfec6[_0x800a('0x33')],qs[_0x800a('0x44')](_0x5961a8[_0x800a('0x30')][_0x800a('0x44')]));_0x1e52f8[_0x800a('0x34')]=_0x1e52f8[_0x800a('0x34')][_0x800a('0x35')]?_0x1e52f8[_0x800a('0x34')]:_0x1cfec6[_0x800a('0x33')];if(_0x5961a8[_0x800a('0x30')]['includeAll']){_0x1e52f8[_0x800a('0x45')]=[{'all':!![]}];}_0x1e52f8=_[_0x800a('0x3c')]({},_0x1e52f8,_0x5961a8[_0x800a('0x3e')]);return db[_0x800a('0x2c')]['find'](_0x1e52f8)['then'](handleEntityNotFound(_0x32c5f3,null))[_0x800a('0x25')](respondWithResult(_0x32c5f3,null))[_0x800a('0x42')](handleError(_0x32c5f3,null));};exports[_0x800a('0x46')]=function(_0x2bd367,_0x4253bd){return db['FaxTransferReport'][_0x800a('0x46')](_0x2bd367[_0x800a('0x47')],{})[_0x800a('0x25')](respondWithResult(_0x4253bd,0xc9))[_0x800a('0x42')](handleError(_0x4253bd,null));};exports[_0x800a('0x48')]=function(_0x145214,_0x1bd136){if(_0x145214['body']['id']){delete _0x145214[_0x800a('0x47')]['id'];}return db[_0x800a('0x2c')][_0x800a('0x49')]({'where':{'id':_0x145214['params']['id']}})[_0x800a('0x25')](handleEntityNotFound(_0x1bd136,null))['then'](saveUpdates(_0x145214[_0x800a('0x47')],null))[_0x800a('0x25')](respondWithResult(_0x1bd136,null))[_0x800a('0x42')](handleError(_0x1bd136,null));};exports[_0x800a('0x26')]=function(_0x410085,_0x5c400a){return db[_0x800a('0x2c')][_0x800a('0x49')]({'where':{'id':_0x410085[_0x800a('0x4a')]['id']}})[_0x800a('0x25')](handleEntityNotFound(_0x5c400a,null))['then'](removeEntity(_0x5c400a,null))['catch'](handleError(_0x5c400a,null));};exports['describe']=function(_0x2847b5,_0x194dc3){return db[_0x800a('0x2c')][_0x800a('0x4b')]()[_0x800a('0x25')](respondWithResult(_0x194dc3,null))[_0x800a('0x42')](handleError(_0x194dc3,null));};
\ No newline at end of file