@dhyasama/totem-models 9.27.0 → 9.28.0
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.
- package/lib/Financials.js +35 -29
- package/package.json +1 -1
package/lib/Financials.js
CHANGED
|
@@ -451,7 +451,7 @@ module.exports = function(mongoose, config) {
|
|
|
451
451
|
|
|
452
452
|
if(conditions) {
|
|
453
453
|
|
|
454
|
-
var recipients = snapshot.notifications.company.sendTo.map(function(sendTo) {
|
|
454
|
+
var recipients = snapshot.notifications.company.initial.sendTo.map(function(sendTo) {
|
|
455
455
|
return sendTo.email;
|
|
456
456
|
});
|
|
457
457
|
|
|
@@ -499,27 +499,30 @@ module.exports = function(mongoose, config) {
|
|
|
499
499
|
|
|
500
500
|
_.each(financial.snapshots, function(snapshot) {
|
|
501
501
|
|
|
502
|
-
|
|
503
|
-
|
|
502
|
+
_.each(snapshot.notifications.company.reminders, function(reminder) {
|
|
503
|
+
|
|
504
|
+
var hasSendTo = reminder.sendTo && reminder.sendTo.length > 0;
|
|
504
505
|
var hasSendOnLessThanNow = reminder.sendOn && reminder.sendOn < now;
|
|
505
506
|
var hasSentOn = reminder.sentOn;
|
|
506
507
|
var hasSentToQueue = reminder.sentToQueue;
|
|
507
|
-
return hasSendTo && hasSendOnLessThanNow && !hasSentOn && !hasSentToQueue;
|
|
508
|
-
});
|
|
509
508
|
|
|
510
|
-
|
|
509
|
+
var conditions = hasSendTo && hasSendOnLessThanNow && !hasSentOn && !hasSentToQueue;
|
|
511
510
|
|
|
512
|
-
|
|
513
|
-
return sendTo.email;
|
|
514
|
-
});
|
|
511
|
+
if(conditions) {
|
|
515
512
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
'recipients': recipients
|
|
520
|
-
});
|
|
513
|
+
var recipients = reminder.sendTo.map(function(sendTo) {
|
|
514
|
+
return sendTo.email;
|
|
515
|
+
});
|
|
521
516
|
|
|
522
|
-
|
|
517
|
+
results.push({
|
|
518
|
+
'financials': financial,
|
|
519
|
+
'uuid': snapshot.uuid,
|
|
520
|
+
'recipients': recipients
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
});
|
|
523
526
|
|
|
524
527
|
});
|
|
525
528
|
|
|
@@ -557,27 +560,30 @@ module.exports = function(mongoose, config) {
|
|
|
557
560
|
|
|
558
561
|
_.each(financial.snapshots, function(snapshot) {
|
|
559
562
|
|
|
560
|
-
|
|
561
|
-
|
|
563
|
+
_.each(snapshot.notifications.company.rejections, function(rejection) {
|
|
564
|
+
|
|
565
|
+
var hasSendTo = rejection.sendTo && rejection.sendTo.length > 0;
|
|
562
566
|
var hasSendOnLessThanNow = rejection.sendOn && rejection.sendOn < now;
|
|
563
567
|
var hasSentOn = rejection.sentOn;
|
|
564
568
|
var hasSentToQueue = rejection.sentToQueue;
|
|
565
|
-
|
|
566
|
-
|
|
569
|
+
|
|
570
|
+
var conditions = hasSendTo && hasSendOnLessThanNow && !hasSentOn && !hasSentToQueue;
|
|
567
571
|
|
|
568
|
-
|
|
572
|
+
if(conditions) {
|
|
569
573
|
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
574
|
+
var recipients = rejection.sendTo.map(function(sendTo) {
|
|
575
|
+
return sendTo.email;
|
|
576
|
+
});
|
|
573
577
|
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
578
|
+
results.push({
|
|
579
|
+
'financials': financial,
|
|
580
|
+
'uuid': snapshot.uuid,
|
|
581
|
+
'recipients': recipients
|
|
582
|
+
});
|
|
579
583
|
|
|
580
|
-
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
});
|
|
581
587
|
|
|
582
588
|
});
|
|
583
589
|
|