@resolveio/server-lib 6.4.3 → 6.4.5-newrole

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -200,116 +200,134 @@ function loadCronJobMethods(methodManager) {
200
200
  sort: sortObj_1
201
201
  };
202
202
  filters_1 = [];
203
- report.fields_filter.filter(function (a) { return !a.field.includes('.$.'); }).forEach(function (filter) {
204
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
205
- if (filter.condition && filter.field && ((filter.value !== null && (!Array.isArray(filter.value) || filter.value.length)) || filter.condition === 'null' || filter.condition === 'nnull')) {
206
- if (filter.condition === 'bw') {
207
- if (filter.fieldType === 'Date' && filter.is_rolling) {
208
- var startDate = null;
209
- var endDate = null;
210
- if (filter.rolling_interval === 'Q1') {
211
- startDate = moment().startOf('year').toDate();
212
- endDate = moment().startOf('year').quarter(2).subtract(1, 'days').toDate();
213
- }
214
- else if (filter.rolling_interval === 'Q2') {
215
- startDate = moment().startOf('year').quarter(2).toDate();
216
- endDate = moment().startOf('year').quarter(3).subtract(1, 'days').toDate();
217
- }
218
- else if (filter.rolling_interval === 'Q3') {
219
- startDate = moment().startOf('year').quarter(3).toDate();
220
- endDate = moment().startOf('year').quarter(4).subtract(1, 'days').toDate();
221
- }
222
- else if (filter.rolling_interval === 'Q4') {
223
- startDate = moment().startOf('year').quarter(4).toDate();
224
- endDate = moment().endOf('year').toDate();
225
- }
226
- else if (filter.rolling_interval === 'Today') {
227
- startDate = moment().startOf('day').toDate();
228
- endDate = moment().endOf('day').toDate();
229
- }
230
- else if (filter.rolling_interval === 'Yesterday') {
231
- startDate = moment().subtract(1, 'days').startOf('day').toDate();
232
- endDate = moment().subtract(1, 'days').endOf('day').toDate();
233
- }
234
- else if (filter.rolling_interval === 'Week') {
235
- startDate = moment().startOf('isoWeek').toDate();
236
- endDate = moment().endOf('day').toDate();
237
- }
238
- else if (filter.rolling_interval === 'Last Week') {
239
- endDate = moment().startOf('isoWeek').subtract(1, 'days').toDate();
240
- startDate = moment(endDate).startOf('isoWeek').toDate();
241
- }
242
- else if (filter.rolling_interval === 'Month') {
243
- startDate = moment().startOf('month').toDate();
244
- endDate = moment().endOf('day').toDate();
245
- }
246
- else if (filter.rolling_interval === 'Last Month') {
247
- endDate = moment().startOf('month').subtract(1, 'days').endOf('day').toDate();
248
- startDate = moment(endDate).startOf('month').toDate();
249
- }
250
- else if (filter.rolling_interval === 'Last 30 Days') {
251
- endDate = moment().endOf('day').toDate();
252
- startDate = moment().subtract(30, 'days').startOf('day').toDate();
253
- }
254
- else if (filter.rolling_interval === 'Quarter') {
255
- startDate = moment().startOf('year').quarter(moment().quarter()).toDate();
256
- endDate = moment().endOf('day').toDate();
257
- }
258
- else if (filter.rolling_interval === 'Last Quarter') {
259
- endDate = moment().startOf('year').quarter(moment().quarter()).subtract(1, 'days').endOf('day').toDate();
260
- startDate = moment(endDate).startOf('quarter').toDate();
261
- }
262
- else if (filter.rolling_interval === 'Year') {
263
- startDate = moment().startOf('year').toDate();
264
- endDate = moment().endOf('day').toDate();
265
- }
266
- else if (filter.rolling_interval === 'Last Year') {
267
- endDate = moment().startOf('year').subtract(1, 'days').endOf('day').toDate();
268
- startDate = moment(endDate).startOf('year').toDate();
203
+ report.fields_filter.forEach(function (filterAnd) {
204
+ var ors = [];
205
+ filterAnd.ors.filter(function (a) { return !a.field.includes('.$.'); }).forEach(function (filter) {
206
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
207
+ if (filter.condition && filter.field && ((filter.value !== null && (!Array.isArray(filter.value) || filter.value.length)) || filter.condition === 'null' || filter.condition === 'nnull')) {
208
+ if (filter.condition === 'bw') {
209
+ if (filter.fieldType === 'Date' && filter.is_rolling) {
210
+ var startDate = null;
211
+ var endDate = null;
212
+ if (filter.rolling_interval === 'Q1') {
213
+ startDate = moment().startOf('year').toDate();
214
+ endDate = moment().startOf('year').quarter(2).subtract(1, 'days').toDate();
215
+ }
216
+ else if (filter.rolling_interval === 'Q2') {
217
+ startDate = moment().startOf('year').quarter(2).toDate();
218
+ endDate = moment().startOf('year').quarter(3).subtract(1, 'days').toDate();
219
+ }
220
+ else if (filter.rolling_interval === 'Q3') {
221
+ startDate = moment().startOf('year').quarter(3).toDate();
222
+ endDate = moment().startOf('year').quarter(4).subtract(1, 'days').toDate();
223
+ }
224
+ else if (filter.rolling_interval === 'Q4') {
225
+ startDate = moment().startOf('year').quarter(4).toDate();
226
+ endDate = moment().endOf('year').toDate();
227
+ }
228
+ else if (filter.rolling_interval === 'Today') {
229
+ startDate = moment().startOf('day').toDate();
230
+ endDate = moment().endOf('day').toDate();
231
+ }
232
+ else if (filter.rolling_interval === 'Yesterday') {
233
+ startDate = moment().subtract(1, 'days').startOf('day').toDate();
234
+ endDate = moment().subtract(1, 'days').endOf('day').toDate();
235
+ }
236
+ else if (filter.rolling_interval === 'Week') {
237
+ startDate = moment().startOf('isoWeek').toDate();
238
+ endDate = moment().endOf('day').toDate();
239
+ }
240
+ else if (filter.rolling_interval === 'Last Week') {
241
+ endDate = moment().startOf('isoWeek').subtract(1, 'days').toDate();
242
+ startDate = moment(endDate).startOf('isoWeek').toDate();
243
+ }
244
+ else if (filter.rolling_interval === 'Month') {
245
+ startDate = moment().startOf('month').toDate();
246
+ endDate = moment().endOf('day').toDate();
247
+ }
248
+ else if (filter.rolling_interval === 'Last Month') {
249
+ endDate = moment().startOf('month').subtract(1, 'days').endOf('day').toDate();
250
+ startDate = moment(endDate).startOf('month').toDate();
251
+ }
252
+ else if (filter.rolling_interval === 'Last 30 Days') {
253
+ endDate = moment().endOf('day').toDate();
254
+ startDate = moment().subtract(30, 'days').startOf('day').toDate();
255
+ }
256
+ else if (filter.rolling_interval === 'Quarter') {
257
+ startDate = moment().startOf('year').quarter(moment().quarter()).toDate();
258
+ endDate = moment().endOf('day').toDate();
259
+ }
260
+ else if (filter.rolling_interval === 'Last Quarter') {
261
+ endDate = moment().startOf('year').quarter(moment().quarter()).subtract(1, 'days').endOf('day').toDate();
262
+ startDate = moment(endDate).startOf('quarter').toDate();
263
+ }
264
+ else if (filter.rolling_interval === 'Year') {
265
+ startDate = moment().startOf('year').toDate();
266
+ endDate = moment().endOf('day').toDate();
267
+ }
268
+ else if (filter.rolling_interval === 'Last Year') {
269
+ endDate = moment().startOf('year').subtract(1, 'days').endOf('day').toDate();
270
+ startDate = moment(endDate).startOf('year').toDate();
271
+ }
272
+ else if (filter.rolling_interval === 'All') {
273
+ startDate = new Date(2017, 0, 1, 0, 0, 0, 0);
274
+ endDate = moment().endOf('day').toDate();
275
+ }
276
+ ors.push({ $and: [(_a = {}, _a[filter.field] = { '$gte': startDate }, _a), (_b = {}, _b[filter.field] = { '$lte': endDate }, _b)] });
269
277
  }
270
- else if (filter.rolling_interval === 'All') {
271
- startDate = new Date(2017, 0, 1, 0, 0, 0, 0);
272
- endDate = moment().endOf('day').toDate();
278
+ else {
279
+ ors.push({ $and: [(_c = {}, _c[filter.field] = { '$gte': filter.value }, _c), (_d = {}, _d[filter.field] = { '$lte': filter.highValue }, _d)] });
273
280
  }
274
- filters_1.push((_a = {}, _a[filter.field] = { '$gte': startDate }, _a));
275
- filters_1.push((_b = {}, _b[filter.field] = { '$lte': endDate }, _b));
276
281
  }
277
- else if (filter.fieldType === 'Date') {
278
- filters_1.push((_c = {}, _c[filter.field] = { '$gte': filter.value }, _c));
279
- filters_1.push((_d = {}, _d[filter.field] = { '$lte': filter.highValue }, _d));
282
+ else if (filter.condition === 'nnull') {
283
+ var and = [];
284
+ and.push((_e = {}, _e[filter.field] = { '$exists': true }, _e));
285
+ and.push((_f = {}, _f[filter.field] = { '$ne': null }, _f));
286
+ if (filter.fieldType === 'String') {
287
+ and.push((_g = {}, _g[filter.field] = { '$ne': '' }, _g));
288
+ }
289
+ ors.push({ $and: and });
280
290
  }
281
- }
282
- else if (filter.condition === 'nnull') {
283
- filters_1.push((_e = {}, _e[filter.field] = { '$exists': true }, _e));
284
- filters_1.push((_f = {}, _f[filter.field] = { '$ne': null }, _f));
285
- if (filter.fieldType === 'String') {
286
- filters_1.push((_g = {}, _g[filter.field] = { '$ne': '' }, _g));
291
+ else if (filter.condition === 'null') {
292
+ ors.push((_h = {}, _h[filter.field] = { '$eq': null }, _h));
287
293
  }
288
- }
289
- else if (filter.condition === 'null') {
290
- filters_1.push((_h = {}, _h[filter.field] = { '$eq': null }, _h));
291
- }
292
- else {
293
- if (Array.isArray(filter.value)) {
294
- if (filter.condition === 'ne') {
295
- filter.value.forEach(function (filt) {
296
- var _a, _b;
297
- filters_1.push((_a = {}, _a[filter.field] = (_b = {}, _b['$' + filter.condition] = (Array.isArray(filt) ? filt[0] : filt), _b), _a));
298
- });
294
+ else {
295
+ if (Array.isArray(filter.value)) {
296
+ if (filter.condition === 'ne') {
297
+ var and_1 = [];
298
+ filter.value.forEach(function (filt) {
299
+ var _a, _b;
300
+ and_1.push((_a = {}, _a[filter.field] = (_b = {}, _b['$' + filter.condition] = (Array.isArray(filt) ? filt[0] : filt), _b), _a));
301
+ });
302
+ if (and_1.length > 1) {
303
+ ors.push({ $and: and_1 });
304
+ }
305
+ else {
306
+ ors.push(and_1[0]);
307
+ }
308
+ }
309
+ else {
310
+ var or_1 = [];
311
+ filter.value.forEach(function (filt) {
312
+ var _a, _b;
313
+ or_1.push((_a = {}, _a[filter.field] = (_b = {}, _b['$' + filter.condition] = (Array.isArray(filt) ? filt[0] : filt), _b), _a));
314
+ });
315
+ if (or_1.length > 1) {
316
+ ors.push({ $or: or_1 });
317
+ }
318
+ else {
319
+ ors.push(or_1[0]);
320
+ }
321
+ }
299
322
  }
300
323
  else {
301
- var or_1 = [];
302
- filter.value.forEach(function (filt) {
303
- var _a, _b;
304
- or_1.push((_a = {}, _a[filter.field] = (_b = {}, _b['$' + filter.condition] = (Array.isArray(filt) ? filt[0] : filt), _b), _a));
305
- });
306
- filters_1.push({ $or: or_1 });
324
+ ors.push((_j = {}, _j[filter.field] = (_k = {}, _k['$' + filter.condition] = filter.value, _k), _j));
307
325
  }
308
326
  }
309
- else {
310
- filters_1.push((_j = {}, _j[filter.field] = (_k = {}, _k['$' + filter.condition] = filter.value, _k), _j));
311
- }
312
327
  }
328
+ });
329
+ if (ors.length) {
330
+ filters_1.push({ $or: ors });
313
331
  }
314
332
  });
315
333
  this.callMethodInternal.call(this, 'reportBuilderBuildTree', report.collection_root, function (errCollTree, collectionTree) {
@@ -321,104 +339,139 @@ function loadCronJobMethods(methodManager) {
321
339
  getTreeLeaves(collectionTree.children, allLeaves_1, true);
322
340
  var filterArrayFields_1 = [];
323
341
  var filterArrays_1 = [];
324
- report.fields_filter.filter(function (a) { return a.field.includes('.$.'); }).forEach(function (filter) {
325
- var _a, _b, _c, _d, _e, _f;
326
- filterArrayFields_1.push(allLeaves_1.filter(function (a) { return a.fieldPath === filter.field; })[0]);
327
- if (filter.condition && filter.field && filter.value !== null) {
328
- if (filter.condition === 'bw') {
329
- if (filter.fieldType === 'Date' && filter.is_rolling) {
330
- var startDate = null;
331
- var endDate = null;
332
- if (filter.rolling_interval === 'Q1') {
333
- startDate = moment().startOf('year').toDate();
334
- endDate = moment().startOf('year').quarter(2).subtract(1, 'days').toDate();
335
- }
336
- else if (filter.rolling_interval === 'Q2') {
337
- startDate = moment().startOf('year').quarter(2).toDate();
338
- endDate = moment().startOf('year').quarter(3).subtract(1, 'days').toDate();
339
- }
340
- else if (filter.rolling_interval === 'Q3') {
341
- startDate = moment().startOf('year').quarter(3).toDate();
342
- endDate = moment().startOf('year').quarter(4).subtract(1, 'days').toDate();
343
- }
344
- else if (filter.rolling_interval === 'Q4') {
345
- startDate = moment().startOf('year').quarter(4).toDate();
346
- endDate = moment().endOf('year').toDate();
347
- }
348
- else if (filter.rolling_interval === 'Today') {
349
- startDate = moment().startOf('day').toDate();
350
- endDate = moment().endOf('day').toDate();
351
- }
352
- else if (filter.rolling_interval === 'Yesterday') {
353
- startDate = moment().subtract(1, 'days').startOf('day').toDate();
354
- endDate = moment().subtract(1, 'days').endOf('day').toDate();
355
- }
356
- else if (filter.rolling_interval === 'Week') {
357
- startDate = moment().startOf('isoWeek').toDate();
358
- endDate = moment().endOf('day').toDate();
359
- }
360
- else if (filter.rolling_interval === 'Last Week') {
361
- endDate = moment().startOf('isoWeek').subtract(1, 'days').toDate();
362
- startDate = moment(endDate).startOf('isoWeek').toDate();
363
- }
364
- else if (filter.rolling_interval === 'Month') {
365
- startDate = moment().startOf('month').toDate();
366
- endDate = moment().endOf('day').toDate();
367
- }
368
- else if (filter.rolling_interval === 'Last Month') {
369
- endDate = moment().startOf('month').subtract(1, 'days').endOf('day').toDate();
370
- startDate = moment(endDate).startOf('month').toDate();
371
- }
372
- else if (filter.rolling_interval === 'Last 30 Days') {
373
- endDate = moment().endOf('day').toDate();
374
- startDate = moment().subtract(30, 'days').startOf('day').toDate();
375
- }
376
- else if (filter.rolling_interval === 'Quarter') {
377
- startDate = moment().startOf('year').quarter(moment().quarter()).toDate();
378
- endDate = moment().endOf('day').toDate();
379
- }
380
- else if (filter.rolling_interval === 'Last Quarter') {
381
- endDate = moment().startOf('year').quarter(moment().quarter()).subtract(1, 'days').endOf('day').toDate();
382
- startDate = moment(endDate).startOf('quarter').toDate();
383
- }
384
- else if (filter.rolling_interval === 'Year') {
385
- startDate = moment().startOf('year').toDate();
386
- endDate = moment().endOf('day').toDate();
387
- }
388
- else if (filter.rolling_interval === 'Last Year') {
389
- endDate = moment().startOf('year').subtract(1, 'days').endOf('day').toDate();
390
- startDate = moment(endDate).startOf('year').toDate();
342
+ report.fields_filter.forEach(function (filterAnd) {
343
+ var ors = [];
344
+ filterAnd.ors.filter(function (a) { return a.field.includes('.$.'); }).forEach(function (filter) {
345
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
346
+ filterArrayFields_1.push(allLeaves_1.filter(function (a) { return a.fieldPath === filter.field; })[0]);
347
+ if (filter.condition && filter.field && filter.value !== null) {
348
+ if (filter.condition === 'bw') {
349
+ if (filter.fieldType === 'Date' && filter.is_rolling) {
350
+ var startDate = null;
351
+ var endDate = null;
352
+ if (filter.rolling_interval === 'Q1') {
353
+ startDate = moment().startOf('year').toDate();
354
+ endDate = moment().startOf('year').quarter(2).subtract(1, 'days').toDate();
355
+ }
356
+ else if (filter.rolling_interval === 'Q2') {
357
+ startDate = moment().startOf('year').quarter(2).toDate();
358
+ endDate = moment().startOf('year').quarter(3).subtract(1, 'days').toDate();
359
+ }
360
+ else if (filter.rolling_interval === 'Q3') {
361
+ startDate = moment().startOf('year').quarter(3).toDate();
362
+ endDate = moment().startOf('year').quarter(4).subtract(1, 'days').toDate();
363
+ }
364
+ else if (filter.rolling_interval === 'Q4') {
365
+ startDate = moment().startOf('year').quarter(4).toDate();
366
+ endDate = moment().endOf('year').toDate();
367
+ }
368
+ else if (filter.rolling_interval === 'Today') {
369
+ startDate = moment().startOf('day').toDate();
370
+ endDate = moment().endOf('day').toDate();
371
+ }
372
+ else if (filter.rolling_interval === 'Yesterday') {
373
+ startDate = moment().subtract(1, 'days').startOf('day').toDate();
374
+ endDate = moment().subtract(1, 'days').endOf('day').toDate();
375
+ }
376
+ else if (filter.rolling_interval === 'Week') {
377
+ startDate = moment().startOf('isoWeek').toDate();
378
+ endDate = moment().endOf('day').toDate();
379
+ }
380
+ else if (filter.rolling_interval === 'Last Week') {
381
+ endDate = moment().startOf('isoWeek').subtract(1, 'days').toDate();
382
+ startDate = moment(endDate).startOf('isoWeek').toDate();
383
+ }
384
+ else if (filter.rolling_interval === 'Month') {
385
+ startDate = moment().startOf('month').toDate();
386
+ endDate = moment().endOf('day').toDate();
387
+ }
388
+ else if (filter.rolling_interval === 'Last Month') {
389
+ endDate = moment().startOf('month').subtract(1, 'days').endOf('day').toDate();
390
+ startDate = moment(endDate).startOf('month').toDate();
391
+ }
392
+ else if (filter.rolling_interval === 'Last 30 Days') {
393
+ endDate = moment().endOf('day').toDate();
394
+ startDate = moment().subtract(30, 'days').startOf('day').toDate();
395
+ }
396
+ else if (filter.rolling_interval === 'Quarter') {
397
+ startDate = moment().startOf('year').quarter(moment().quarter()).toDate();
398
+ endDate = moment().endOf('day').toDate();
399
+ }
400
+ else if (filter.rolling_interval === 'Last Quarter') {
401
+ endDate = moment().startOf('year').quarter(moment().quarter()).subtract(1, 'days').endOf('day').toDate();
402
+ startDate = moment(endDate).startOf('quarter').toDate();
403
+ }
404
+ else if (filter.rolling_interval === 'Year') {
405
+ startDate = moment().startOf('year').toDate();
406
+ endDate = moment().endOf('day').toDate();
407
+ }
408
+ else if (filter.rolling_interval === 'Last Year') {
409
+ endDate = moment().startOf('year').subtract(1, 'days').endOf('day').toDate();
410
+ startDate = moment(endDate).startOf('year').toDate();
411
+ }
412
+ else if (filter.rolling_interval === 'All') {
413
+ startDate = new Date(2017, 0, 1, 0, 0, 0, 0);
414
+ endDate = moment().endOf('day').toDate();
415
+ }
416
+ ors.push({ $and: [(_a = {}, _a[filter.field] = { '$gte': startDate }, _a), (_b = {}, _b[filter.field] = { '$lte': endDate }, _b)] });
391
417
  }
392
- else if (filter.rolling_interval === 'All') {
393
- startDate = new Date(2017, 0, 1, 0, 0, 0, 0);
394
- endDate = moment().endOf('day').toDate();
418
+ else {
419
+ filterArrays_1.push({ $and: [(_c = {}, _c[filter.field] = { '$gte': filter.value }, _c), (_d = {}, _d[filter.field] = { '$lte': filter.highValue }, _d)] });
395
420
  }
396
- filterArrays_1.push((_a = {}, _a[filter.field] = { '$gte': startDate }, _a));
397
- filterArrays_1.push((_b = {}, _b[filter.field] = { '$lte': endDate }, _b));
398
421
  }
399
- else {
400
- filterArrays_1.push((_c = {}, _c[filter.field] = { '$gte': filter.value }, _c));
401
- filterArrays_1.push((_d = {}, _d[filter.field] = { '$lte': filter.highValue }, _d));
422
+ else if (filter.condition === 'nnull') {
423
+ var and = [];
424
+ and.push((_e = {}, _e[filter.field.replace(/\.\$/g, '')] = { '$exists': true }, _e));
425
+ and.push((_f = {}, _f[filter.field.replace(/\.\$/g, '')] = { '$ne': null }, _f));
426
+ if (filter.fieldType === 'String') {
427
+ and.push((_g = {}, _g[filter.field.replace(/\.\$/g, '')] = { '$ne': '' }, _g));
428
+ }
429
+ ors.push({ $and: and });
402
430
  }
403
- }
404
- else {
405
- if (Array.isArray(filter.value)) {
406
- var or_2 = [];
407
- filter.value.forEach(function (filt) {
408
- var _a, _b;
409
- or_2.push((_a = {}, _a[filter.field.replace(/\.\$/g, '')] = (_b = {}, _b['$' + filter.condition] = (Array.isArray(filt) ? filt[0] : filt), _b), _a));
410
- });
411
- filterArrays_1.push({ $or: or_2 });
431
+ else if (filter.condition === 'null') {
432
+ ors.push((_h = {}, _h[filter.field.replace(/\.\$/g, '')] = { '$eq': null }, _h));
412
433
  }
413
434
  else {
414
- filterArrays_1.push((_e = {}, _e[filter.field.replace(/\.\$/g, '')] = (_f = {}, _f['$' + filter.condition] = filter.value, _f), _e));
435
+ if (Array.isArray(filter.value)) {
436
+ if (filter.condition === 'ne') {
437
+ var and_2 = [];
438
+ filter.value.forEach(function (filt) {
439
+ var _a, _b;
440
+ and_2.push((_a = {}, _a[filter.field.replace(/\.\$/g, '')] = (_b = {}, _b['$' + filter.condition] = (Array.isArray(filt) ? filt[0] : filt), _b), _a));
441
+ });
442
+ if (and_2.length > 1) {
443
+ ors.push({ $and: and_2 });
444
+ }
445
+ else {
446
+ ors.push(and_2[0]);
447
+ }
448
+ }
449
+ else {
450
+ var or_2 = [];
451
+ filter.value.forEach(function (filt) {
452
+ var _a, _b;
453
+ or_2.push((_a = {}, _a[filter.field.replace(/\.\$/g, '')] = (_b = {}, _b['$' + filter.condition] = (Array.isArray(filt) ? filt[0] : filt), _b), _a));
454
+ });
455
+ if (or_2.length > 1) {
456
+ ors.push({ $or: or_2 });
457
+ }
458
+ else {
459
+ ors.push(or_2[0]);
460
+ }
461
+ }
462
+ }
463
+ else {
464
+ ors.push((_j = {}, _j[filter.field.replace(/\.\$/g, '')] = (_k = {}, _k['$' + filter.condition] = filter.value, _k), _j));
465
+ }
415
466
  }
416
467
  }
468
+ });
469
+ if (ors.length) {
470
+ filterArrays_1.push({ $or: ors });
417
471
  }
418
472
  });
419
- _this.callMethodInternal.call(_this, 'reportBuilderGetResults', report.type, report.collection_root, rootOptions_1, filters_1, filterArrays_1, filterArrayFields_1, report.fields_selected, report.groups_row, report.fields_total, report.fields_link, report.id_date_field || null, report.date_interval || null, report.group_type, function (err, res) {
473
+ _this.callMethodInternal.call(_this, 'reportBuilderGetResults', report.type, report.collection_root, rootOptions_1, filters_1, filterArrays_1, filterArrayFields_1, report.fields_selected, report.fields_custom, report.groups_row, report.fields_total, report.fields_link, report.id_date_field || null, report.date_interval || null, report.group_type, function (err, res) {
420
474
  if (res && res[0]) {
421
- var fields = [];
422
475
  var results_1 = res[0].results;
423
476
  var reportTotals = res[0].totals;
424
477
  if (report.type === 'Tabular') {
@@ -527,7 +580,7 @@ function loadCronJobMethods(methodManager) {
527
580
  XLSX.utils.book_append_sheet(wb, ws, 'RB Data');
528
581
  var wbout_1 = XLSX.write(wb, { bookType: 'xlsx', type: 'base64' });
529
582
  data['emails'].forEach(function (email) {
530
- _this.sendEmail(email, 'AAIMOS Scheduled Report - ' + report.report_name, '', "\n\t\t\t\t\t\t\t\t\t\t\t\t<b>AAIMOS Automated Report</b><br>\n\t\t\t\t\t\t\t\t\t\t\t\t<b>Report Name: </b>" + report.report_name + "<br>\n\t\t\t\t\t\t\t\t\t\t\t\t<b>Prepared By: </b>" + data['user'] + "<br><br>\n\t\t\t\t\t\t\t\t\t\t\t\tAttached are the results of this automated report.<br><br>\n\t\t\t\t\t\t\t\t\t\t\t\tResolveIO<br><br>", [
583
+ _this.sendEmail(email, _this._serverConfig['CLIENT_NAME'] + ' Scheduled Report - ' + report.report_name, '', "\n\t\t\t\t\t\t\t\t\t\t\t\t<b>" + _this._serverConfig['CLIENT_NAME'] + " Automated Report</b><br>\n\t\t\t\t\t\t\t\t\t\t\t\t<b>Report Name: </b>" + report.report_name + "<br>\n\t\t\t\t\t\t\t\t\t\t\t\t<b>Prepared By: </b>" + data['user'] + "<br><br>\n\t\t\t\t\t\t\t\t\t\t\t\tAttached are the results of this automated report.<br><br>\n\t\t\t\t\t\t\t\t\t\t\t\tResolveIO<br><br>", [
531
584
  {
532
585
  filename: report.report_name + '-' + moment().format('MM-DD-YYYY-hh-mm-A') + '.xlsx',
533
586
  content: wbout_1,
@@ -585,7 +638,7 @@ function loadCronJobMethods(methodManager) {
585
638
  var now_1 = new Date();
586
639
  wb.xlsx.writeBuffer().then(function (buffer) {
587
640
  data['emails'].forEach(function (email) {
588
- _this.sendEmail(email, 'AAIMOS Scheduled Report - ' + report.report_name, '', "\n\t\t\t\t\t\t\t\t\t\t\t\t\t<b>AAIMOS Automated Report</b><br>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<b>Report Name: </b>" + report.report_name + "<br>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<b>Prepared By: </b>" + data['user'] + "<br><br>\n\t\t\t\t\t\t\t\t\t\t\t\t\tAttached are the results of this automated report.<br><br>\n\t\t\t\t\t\t\t\t\t\t\t\t\tHave a great day!<br><br>\n\t\t\t\t\t\t\t\t\t\t\t\t\tResolveIO<br><br>", [
641
+ _this.sendEmail(email, _this._serverConfig['CLIENT_NAME'] + ' Scheduled Report - ' + report.report_name, '', "\n\t\t\t\t\t\t\t\t\t\t\t\t\t<b>" + _this._serverConfig['CLIENT_NAME'] + " Automated Report</b><br>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<b>Report Name: </b>" + report.report_name + "<br>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<b>Prepared By: </b>" + data['user'] + "<br><br>\n\t\t\t\t\t\t\t\t\t\t\t\t\tAttached are the results of this automated report.<br><br>\n\t\t\t\t\t\t\t\t\t\t\t\t\tHave a great day!<br><br>\n\t\t\t\t\t\t\t\t\t\t\t\t\tResolveIO<br><br>", [
589
642
  {
590
643
  filename: 'Tabular_Group_Report_' + report.report_name + '_' + now_1.getFullYear() + '_' + (now_1.getMonth() + 1) + '_' + now_1.getDate() + '.xlsx',
591
644
  content: buffer
@@ -901,7 +954,7 @@ function loadCronJobMethods(methodManager) {
901
954
  }
902
955
  });
903
956
  data['emails'].forEach(function (email) {
904
- _this.sendEmail(email, 'AAIMOS Scheduled Report - ' + report.report_name, '', "\n\t\t\t\t\t\t\t\t\t\t\t\t<b>AAIMOS Automated Report</b><br>\n\t\t\t\t\t\t\t\t\t\t\t\t<b>Report Name: </b>" + report.report_name + "<br>\n\t\t\t\t\t\t\t\t\t\t\t\t<b>Prepared By: </b>" + data['user'] + "<br><br>\n\t\t\t\t\t\t\t\t\t\t\t\tAttached are the results of this automated report.<br><br>\n\t\t\t\t\t\t\t\t\t\t\t\tHave a great day!<br><br>\n\t\t\t\t\t\t\t\t\t\t\t\tResolveIO<br><br>", [
957
+ _this.sendEmail(email, _this._serverConfig['CLIENT_NAME'] + ' Scheduled Report - ' + report.report_name, '', "\n\t\t\t\t\t\t\t\t\t\t\t\t<b>" + _this._serverConfig['CLIENT_NAME'] + " Automated Report</b><br>\n\t\t\t\t\t\t\t\t\t\t\t\t<b>Report Name: </b>" + report.report_name + "<br>\n\t\t\t\t\t\t\t\t\t\t\t\t<b>Prepared By: </b>" + data['user'] + "<br><br>\n\t\t\t\t\t\t\t\t\t\t\t\tAttached are the results of this automated report.<br><br>\n\t\t\t\t\t\t\t\t\t\t\t\tHave a great day!<br><br>\n\t\t\t\t\t\t\t\t\t\t\t\tResolveIO<br><br>", [
905
958
  {
906
959
  filename: report.report_name + '-' + moment().format('MM-DD-YYYY-hh-mm-A') + '.csv',
907
960
  content: newCSV_1