Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / api / saInvoiceNumber / saInvoiceNumber.controller.js
index 48eba09..60f3477 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf649=['../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','filter','where','map','VIRTUAL','options','includeAll','include','SAInvoiceNumber','findAll','rows','catch','params','rawAttributes','fields','length','merge','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','papaparse','ioredis'];(function(_0x43005f,_0x1947d2){var _0x52425b=function(_0x5a6597){while(--_0x5a6597){_0x43005f['push'](_0x43005f['shift']());}};_0x52425b(++_0x1947d2);}(_0xf649,0x1a0));var _0x9f64=function(_0x1f8d22,_0x455c10){_0x1f8d22=_0x1f8d22-0x0;var _0xdf4158=_0xf649[_0x1f8d22];return _0xdf4158;};'use strict';var pdf=require(_0x9f64('0x0'));var emlformat=require(_0x9f64('0x1'));var rimraf=require(_0x9f64('0x2'));var zipdir=require(_0x9f64('0x3'));var jsonpatch=require(_0x9f64('0x4'));var rp=require(_0x9f64('0x5'));var moment=require(_0x9f64('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x9f64('0x7'));var util=require(_0x9f64('0x8'));var path=require(_0x9f64('0x9'));var sox=require(_0x9f64('0xa'));var csv=require(_0x9f64('0xb'));var ejs=require(_0x9f64('0xc'));var fs=require('fs');var _=require(_0x9f64('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9f64('0xe'));var Redis=require(_0x9f64('0xf'));var authService=require(_0x9f64('0x10'));var qs=require(_0x9f64('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f64('0x12'))(_0x9f64('0x13'));var utils=require(_0x9f64('0x14'));var config=require('../../config/environment');var db=require(_0x9f64('0x15'))['db'];function respondWithStatusCode(_0x281412,_0xba42b7){_0xba42b7=_0xba42b7||0xcc;return function(_0xf35488){if(_0xf35488){return _0x281412[_0x9f64('0x16')](_0xba42b7);}return _0x281412[_0x9f64('0x17')](_0xba42b7)[_0x9f64('0x18')]();};}function respondWithResult(_0x3114f1,_0x352efe){_0x352efe=_0x352efe||0xc8;return function(_0x298061){if(_0x298061){return _0x3114f1[_0x9f64('0x17')](_0x352efe)['json'](_0x298061);}};}function respondWithFilteredResult(_0x2cd9d8,_0x310272){return function(_0x4177f3){if(_0x4177f3){var _0x13033b=_0x4177f3[_0x9f64('0x19')],_0x105b96=_0x310272['offset'],_0x5256a9=_0x310272['offset']+_0x310272['limit'],_0x231196;if(_0x5256a9>=_0x13033b){_0x5256a9=_0x13033b;_0x231196=0xc8;}else{_0x231196=0xce;}_0x2cd9d8[_0x9f64('0x17')](_0x231196);return _0x2cd9d8[_0x9f64('0x1a')](_0x9f64('0x1b'),_0x105b96+'-'+_0x5256a9+'/'+_0x13033b)[_0x9f64('0x1c')](_0x4177f3);}return null;};}function patchUpdates(_0x16b1f4){return function(_0x2a0a37){try{jsonpatch[_0x9f64('0x1d')](_0x2a0a37,_0x16b1f4,!![]);}catch(_0x36c1ae){return BPromise[_0x9f64('0x1e')](_0x36c1ae);}return _0x2a0a37[_0x9f64('0x1f')]();};}function saveUpdates(_0x5043d6,_0x3ee8fb){return function(_0x1d8455){if(_0x1d8455){return _0x1d8455[_0x9f64('0x20')](_0x5043d6)[_0x9f64('0x21')](function(_0x6499d4){return _0x6499d4;});}return null;};}function removeEntity(_0x241f82,_0x3d56b8){return function(_0x36ad27){if(_0x36ad27){return _0x36ad27[_0x9f64('0x22')]()[_0x9f64('0x21')](function(){_0x241f82[_0x9f64('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x156b82,_0x5e2897){return function(_0x44b194){if(!_0x44b194){_0x156b82[_0x9f64('0x16')](0x194);}return _0x44b194;};}function handleError(_0x144f59,_0x395809){_0x395809=_0x395809||0x1f4;return function(_0x3e4b0e){logger[_0x9f64('0x23')](_0x3e4b0e[_0x9f64('0x24')]);if(_0x3e4b0e[_0x9f64('0x25')]){delete _0x3e4b0e[_0x9f64('0x25')];}_0x144f59[_0x9f64('0x17')](_0x395809)[_0x9f64('0x26')](_0x3e4b0e);};}exports['index']=function(_0x2b3f00,_0x529682){var _0x1c5aaa={},_0x5755d0={},_0x37ed72={'count':0x0,'rows':[]};var _0x28b975=db['SAInvoiceNumber']['rawAttributes'];_0x5755d0[_0x9f64('0x27')]=_['keys'](_0x28b975);_0x5755d0[_0x9f64('0x28')]=_[_0x9f64('0x29')](_0x2b3f00[_0x9f64('0x28')]);_0x5755d0[_0x9f64('0x2a')]=_[_0x9f64('0x2b')](_0x5755d0[_0x9f64('0x27')],_0x5755d0[_0x9f64('0x28')]);_0x1c5aaa[_0x9f64('0x2c')]=_[_0x9f64('0x2b')](_0x5755d0['model'],qs['fields'](_0x2b3f00[_0x9f64('0x28')]['fields']));_0x1c5aaa[_0x9f64('0x2c')]=_0x1c5aaa[_0x9f64('0x2c')]['length']?_0x1c5aaa[_0x9f64('0x2c')]:_0x5755d0[_0x9f64('0x27')];if(!_0x2b3f00['query'][_0x9f64('0x2d')](_0x9f64('0x2e'))){_0x1c5aaa[_0x9f64('0x2f')]=qs[_0x9f64('0x2f')](_0x2b3f00[_0x9f64('0x28')][_0x9f64('0x2f')]);_0x1c5aaa[_0x9f64('0x30')]=qs[_0x9f64('0x30')](_0x2b3f00['query']['offset']);}_0x1c5aaa[_0x9f64('0x31')]=qs[_0x9f64('0x32')](_0x2b3f00[_0x9f64('0x28')][_0x9f64('0x32')]);_0x1c5aaa['where']=qs[_0x9f64('0x2a')](_[_0x9f64('0x33')](_0x2b3f00['query'],_0x5755d0['filters']));if(_0x2b3f00[_0x9f64('0x28')][_0x9f64('0x34')]){_0x1c5aaa[_0x9f64('0x35')]=_['merge'](_0x1c5aaa[_0x9f64('0x35')],{'$or':_[_0x9f64('0x36')](_0x28b975,function(_0x43baf2){if(_0x43baf2['type']['key']!==_0x9f64('0x37')){var _0x52e21f={};_0x52e21f[_0x43baf2['field']]={'$like':'%'+_0x2b3f00['query'][_0x9f64('0x34')]+'%'};return _0x52e21f;}})});}_0x1c5aaa=_['merge']({},_0x1c5aaa,_0x2b3f00[_0x9f64('0x38')]);var _0x5a7aaf={'where':_0x1c5aaa[_0x9f64('0x35')]};return db['SAInvoiceNumber'][_0x9f64('0x19')](_0x5a7aaf)[_0x9f64('0x21')](function(_0x1cf3c7){_0x37ed72['count']=_0x1cf3c7;if(_0x2b3f00[_0x9f64('0x28')][_0x9f64('0x39')]){_0x1c5aaa[_0x9f64('0x3a')]=[{'all':!![]}];}return db[_0x9f64('0x3b')][_0x9f64('0x3c')](_0x1c5aaa);})[_0x9f64('0x21')](function(_0x2807ea){_0x37ed72[_0x9f64('0x3d')]=_0x2807ea;return _0x37ed72;})[_0x9f64('0x21')](respondWithFilteredResult(_0x529682,_0x1c5aaa))[_0x9f64('0x3e')](handleError(_0x529682,null));};exports['show']=function(_0x5a80e0,_0x586dd6){var _0x5cca33={'raw':![],'where':{'id':_0x5a80e0[_0x9f64('0x3f')]['id']}},_0x8b2073={};_0x8b2073[_0x9f64('0x27')]=_['keys'](db[_0x9f64('0x3b')][_0x9f64('0x40')]);_0x8b2073[_0x9f64('0x28')]=_['keys'](_0x5a80e0[_0x9f64('0x28')]);_0x8b2073[_0x9f64('0x2a')]=_[_0x9f64('0x2b')](_0x8b2073[_0x9f64('0x27')],_0x8b2073[_0x9f64('0x28')]);_0x5cca33[_0x9f64('0x2c')]=_[_0x9f64('0x2b')](_0x8b2073['model'],qs['fields'](_0x5a80e0[_0x9f64('0x28')][_0x9f64('0x41')]));_0x5cca33[_0x9f64('0x2c')]=_0x5cca33[_0x9f64('0x2c')][_0x9f64('0x42')]?_0x5cca33[_0x9f64('0x2c')]:_0x8b2073['model'];if(_0x5a80e0[_0x9f64('0x28')][_0x9f64('0x39')]){_0x5cca33[_0x9f64('0x3a')]=[{'all':!![]}];}_0x5cca33=_[_0x9f64('0x43')]({},_0x5cca33,_0x5a80e0[_0x9f64('0x38')]);return db[_0x9f64('0x3b')]['find'](_0x5cca33)['then'](handleEntityNotFound(_0x586dd6,null))['then'](respondWithResult(_0x586dd6,null))[_0x9f64('0x3e')](handleError(_0x586dd6,null));};exports[_0x9f64('0x44')]=function(_0x1879c8,_0x19e867){return db['SAInvoiceNumber'][_0x9f64('0x44')](_0x1879c8[_0x9f64('0x45')],{})[_0x9f64('0x21')](respondWithResult(_0x19e867,0xc9))['catch'](handleError(_0x19e867,null));};exports[_0x9f64('0x20')]=function(_0x132a54,_0x265785){if(_0x132a54[_0x9f64('0x45')]['id']){delete _0x132a54['body']['id'];}return db[_0x9f64('0x3b')][_0x9f64('0x46')]({'where':{'id':_0x132a54[_0x9f64('0x3f')]['id']}})['then'](handleEntityNotFound(_0x265785,null))['then'](saveUpdates(_0x132a54[_0x9f64('0x45')],null))[_0x9f64('0x21')](respondWithResult(_0x265785,null))[_0x9f64('0x3e')](handleError(_0x265785,null));};exports[_0x9f64('0x22')]=function(_0x447da7,_0x2e0564){return db[_0x9f64('0x3b')]['find']({'where':{'id':_0x447da7[_0x9f64('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2e0564,null))[_0x9f64('0x21')](removeEntity(_0x2e0564,null))['catch'](handleError(_0x2e0564,null));};exports[_0x9f64('0x47')]=function(_0x27242d,_0x3b4cfb){return db[_0x9f64('0x3b')][_0x9f64('0x47')]()[_0x9f64('0x21')](respondWithResult(_0x3b4cfb,null))[_0x9f64('0x3e')](handleError(_0x3b4cfb,null));};
\ No newline at end of file
+var _0x7630=['include','findAll','catch','show','params','includeAll','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','update','then','error','stack','name','send','index','SAInvoiceNumber','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','filters','pick','merge','map','type','key','VIRTUAL','options'];(function(_0x5a3c3c,_0x2740df){var _0x29a9ac=function(_0x4444d9){while(--_0x4444d9){_0x5a3c3c['push'](_0x5a3c3c['shift']());}};_0x29a9ac(++_0x2740df);}(_0x7630,0x1ee));var _0x0763=function(_0x2b0551,_0x5b6e78){_0x2b0551=_0x2b0551-0x0;var _0x1ee36f=_0x7630[_0x2b0551];return _0x1ee36f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0763('0x0'));var rimraf=require(_0x0763('0x1'));var zipdir=require(_0x0763('0x2'));var jsonpatch=require(_0x0763('0x3'));var rp=require(_0x0763('0x4'));var moment=require(_0x0763('0x5'));var BPromise=require(_0x0763('0x6'));var Mustache=require('mustache');var util=require(_0x0763('0x7'));var path=require('path');var sox=require(_0x0763('0x8'));var csv=require(_0x0763('0x9'));var ejs=require(_0x0763('0xa'));var fs=require('fs');var _=require(_0x0763('0xb'));var squel=require('squel');var crypto=require(_0x0763('0xc'));var jsforce=require(_0x0763('0xd'));var deskjs=require(_0x0763('0xe'));var toCsv=require(_0x0763('0x9'));var querystring=require(_0x0763('0xf'));var Papa=require(_0x0763('0x10'));var Redis=require(_0x0763('0x11'));var authService=require(_0x0763('0x12'));var qs=require(_0x0763('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x0763('0x14'));var config=require(_0x0763('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b9b69,_0x44d228){_0x44d228=_0x44d228||0xcc;return function(_0x32f94a){if(_0x32f94a){return _0x4b9b69[_0x0763('0x16')](_0x44d228);}return _0x4b9b69[_0x0763('0x17')](_0x44d228)[_0x0763('0x18')]();};}function respondWithResult(_0x4b5e70,_0x5d466f){_0x5d466f=_0x5d466f||0xc8;return function(_0x20c99d){if(_0x20c99d){return _0x4b5e70[_0x0763('0x17')](_0x5d466f)[_0x0763('0x19')](_0x20c99d);}};}function respondWithFilteredResult(_0x42ca86,_0x16df35){return function(_0x11f9fa){if(_0x11f9fa){var _0x391ee3=_0x11f9fa[_0x0763('0x1a')],_0xda92b4=_0x16df35[_0x0763('0x1b')],_0xb2393b=_0x16df35[_0x0763('0x1b')]+_0x16df35['limit'],_0x14441d;if(_0xb2393b>=_0x391ee3){_0xb2393b=_0x391ee3;_0x14441d=0xc8;}else{_0x14441d=0xce;}_0x42ca86[_0x0763('0x17')](_0x14441d);return _0x42ca86[_0x0763('0x1c')](_0x0763('0x1d'),_0xda92b4+'-'+_0xb2393b+'/'+_0x391ee3)[_0x0763('0x19')](_0x11f9fa);}return null;};}function patchUpdates(_0x5f4fb3){return function(_0x304a4d){try{jsonpatch['apply'](_0x304a4d,_0x5f4fb3,!![]);}catch(_0x16925a){return BPromise['reject'](_0x16925a);}return _0x304a4d['save']();};}function saveUpdates(_0x4384a0,_0x5743a4){return function(_0x4aa286){if(_0x4aa286){return _0x4aa286[_0x0763('0x1e')](_0x4384a0)[_0x0763('0x1f')](function(_0x4c9774){return _0x4c9774;});}return null;};}function removeEntity(_0x2f1b4c,_0x25dc6b){return function(_0x179da7){if(_0x179da7){return _0x179da7['destroy']()[_0x0763('0x1f')](function(){_0x2f1b4c[_0x0763('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5713b2,_0xa69172){return function(_0xabb62d){if(!_0xabb62d){_0x5713b2[_0x0763('0x16')](0x194);}return _0xabb62d;};}function handleError(_0x5be13a,_0x13b1eb){_0x13b1eb=_0x13b1eb||0x1f4;return function(_0x3151cc){logger[_0x0763('0x20')](_0x3151cc[_0x0763('0x21')]);if(_0x3151cc[_0x0763('0x22')]){delete _0x3151cc[_0x0763('0x22')];}_0x5be13a[_0x0763('0x17')](_0x13b1eb)[_0x0763('0x23')](_0x3151cc);};}exports[_0x0763('0x24')]=function(_0x11db1c,_0x256834){var _0x46ce76={},_0x14f802={},_0x15d8b0={'count':0x0,'rows':[]};var _0x312300=db[_0x0763('0x25')][_0x0763('0x26')];_0x14f802[_0x0763('0x27')]=_[_0x0763('0x28')](_0x312300);_0x14f802[_0x0763('0x29')]=_[_0x0763('0x28')](_0x11db1c[_0x0763('0x29')]);_0x14f802['filters']=_[_0x0763('0x2a')](_0x14f802[_0x0763('0x27')],_0x14f802['query']);_0x46ce76[_0x0763('0x2b')]=_[_0x0763('0x2a')](_0x14f802[_0x0763('0x27')],qs['fields'](_0x11db1c[_0x0763('0x29')][_0x0763('0x2c')]));_0x46ce76['attributes']=_0x46ce76[_0x0763('0x2b')][_0x0763('0x2d')]?_0x46ce76[_0x0763('0x2b')]:_0x14f802['model'];if(!_0x11db1c[_0x0763('0x29')][_0x0763('0x2e')]('nolimit')){_0x46ce76[_0x0763('0x2f')]=qs[_0x0763('0x2f')](_0x11db1c[_0x0763('0x29')][_0x0763('0x2f')]);_0x46ce76['offset']=qs['offset'](_0x11db1c[_0x0763('0x29')][_0x0763('0x1b')]);}_0x46ce76['order']=qs[_0x0763('0x30')](_0x11db1c[_0x0763('0x29')][_0x0763('0x30')]);_0x46ce76[_0x0763('0x31')]=qs[_0x0763('0x32')](_[_0x0763('0x33')](_0x11db1c[_0x0763('0x29')],_0x14f802[_0x0763('0x32')]));if(_0x11db1c[_0x0763('0x29')]['filter']){_0x46ce76[_0x0763('0x31')]=_[_0x0763('0x34')](_0x46ce76[_0x0763('0x31')],{'$or':_[_0x0763('0x35')](_0x312300,function(_0x2c2b7f){if(_0x2c2b7f[_0x0763('0x36')][_0x0763('0x37')]!==_0x0763('0x38')){var _0x53f36a={};_0x53f36a[_0x2c2b7f['field']]={'$like':'%'+_0x11db1c[_0x0763('0x29')]['filter']+'%'};return _0x53f36a;}})});}_0x46ce76=_[_0x0763('0x34')]({},_0x46ce76,_0x11db1c[_0x0763('0x39')]);var _0x1753d1={'where':_0x46ce76[_0x0763('0x31')]};return db['SAInvoiceNumber'][_0x0763('0x1a')](_0x1753d1)[_0x0763('0x1f')](function(_0x35d2e5){_0x15d8b0[_0x0763('0x1a')]=_0x35d2e5;if(_0x11db1c['query']['includeAll']){_0x46ce76[_0x0763('0x3a')]=[{'all':!![]}];}return db[_0x0763('0x25')][_0x0763('0x3b')](_0x46ce76);})[_0x0763('0x1f')](function(_0x572cea){_0x15d8b0['rows']=_0x572cea;return _0x15d8b0;})['then'](respondWithFilteredResult(_0x256834,_0x46ce76))[_0x0763('0x3c')](handleError(_0x256834,null));};exports[_0x0763('0x3d')]=function(_0x4593df,_0x417c2a){var _0x3ae4cd={'raw':![],'where':{'id':_0x4593df[_0x0763('0x3e')]['id']}},_0x4831ea={};_0x4831ea['model']=_[_0x0763('0x28')](db[_0x0763('0x25')][_0x0763('0x26')]);_0x4831ea[_0x0763('0x29')]=_[_0x0763('0x28')](_0x4593df[_0x0763('0x29')]);_0x4831ea['filters']=_['intersection'](_0x4831ea[_0x0763('0x27')],_0x4831ea[_0x0763('0x29')]);_0x3ae4cd[_0x0763('0x2b')]=_[_0x0763('0x2a')](_0x4831ea[_0x0763('0x27')],qs[_0x0763('0x2c')](_0x4593df[_0x0763('0x29')][_0x0763('0x2c')]));_0x3ae4cd[_0x0763('0x2b')]=_0x3ae4cd['attributes'][_0x0763('0x2d')]?_0x3ae4cd[_0x0763('0x2b')]:_0x4831ea[_0x0763('0x27')];if(_0x4593df[_0x0763('0x29')][_0x0763('0x3f')]){_0x3ae4cd[_0x0763('0x3a')]=[{'all':!![]}];}_0x3ae4cd=_[_0x0763('0x34')]({},_0x3ae4cd,_0x4593df[_0x0763('0x39')]);return db[_0x0763('0x25')][_0x0763('0x40')](_0x3ae4cd)[_0x0763('0x1f')](handleEntityNotFound(_0x417c2a,null))[_0x0763('0x1f')](respondWithResult(_0x417c2a,null))[_0x0763('0x3c')](handleError(_0x417c2a,null));};exports[_0x0763('0x41')]=function(_0x4a69ee,_0x606146){return db[_0x0763('0x25')][_0x0763('0x41')](_0x4a69ee[_0x0763('0x42')],{})['then'](respondWithResult(_0x606146,0xc9))[_0x0763('0x3c')](handleError(_0x606146,null));};exports[_0x0763('0x1e')]=function(_0x4d1313,_0x123ca3){if(_0x4d1313['body']['id']){delete _0x4d1313[_0x0763('0x42')]['id'];}return db[_0x0763('0x25')][_0x0763('0x40')]({'where':{'id':_0x4d1313[_0x0763('0x3e')]['id']}})['then'](handleEntityNotFound(_0x123ca3,null))['then'](saveUpdates(_0x4d1313['body'],null))[_0x0763('0x1f')](respondWithResult(_0x123ca3,null))['catch'](handleError(_0x123ca3,null));};exports[_0x0763('0x43')]=function(_0x68bca9,_0x606418){return db[_0x0763('0x25')][_0x0763('0x40')]({'where':{'id':_0x68bca9[_0x0763('0x3e')]['id']}})[_0x0763('0x1f')](handleEntityNotFound(_0x606418,null))['then'](removeEntity(_0x606418,null))[_0x0763('0x3c')](handleError(_0x606418,null));};exports[_0x0763('0x44')]=function(_0x5b9b61,_0x212ad9){return db[_0x0763('0x25')]['describe']()[_0x0763('0x1f')](respondWithResult(_0x212ad9,null))[_0x0763('0x3c')](handleError(_0x212ad9,null));};
\ No newline at end of file