| Line 558... |
Line 558... |
| 558 |
|
558 |
|
| 559 |
if (ActivityType.SEND_EMAIL_TO_CUSTOMER.equals(activity.getType())) {
|
559 |
if (ActivityType.SEND_EMAIL_TO_CUSTOMER.equals(activity.getType())) {
|
| 560 |
log.info("Sending mail");
|
560 |
log.info("Sending mail");
|
| 561 |
Client helperClient = new HelperClient().getClient();
|
561 |
Client helperClient = new HelperClient().getClient();
|
| 562 |
activity.setUserEmailId(helperClient.saveUserEmailForSending(
|
562 |
activity.setUserEmailId(helperClient.saveUserEmailForSending(
|
| 563 |
customerEmailId, CRMConstants.CRM_EMAIL_SENDOR,
|
563 |
Arrays.asList(customerEmailId), CRMConstants.CRM_EMAIL_SENDOR,
|
| 564 |
subject, body, null, CRMConstants.CRM_EMAIL_TYPE));
|
564 |
subject, body, null, CRMConstants.CRM_EMAIL_TYPE, null, null));
|
| 565 |
|
565 |
|
| 566 |
String plainTextbody = new Source(body).getTextExtractor().toString();
|
566 |
String plainTextbody = new Source(body).getTextExtractor().toString();
|
| 567 |
|
567 |
|
| 568 |
// We change activityType to OTHER when pop up box for email
|
568 |
// We change activityType to OTHER when pop up box for email
|
| 569 |
// closes
|
569 |
// closes
|
| Line 582... |
Line 582... |
| 582 |
if (ActivityType.ESCALATE_TICKET.equals(activity.getType())) {
|
582 |
if (ActivityType.ESCALATE_TICKET.equals(activity.getType())) {
|
| 583 |
log.info("Sending escalation mail");
|
583 |
log.info("Sending escalation mail");
|
| 584 |
EscalationMatrix escalation = CRMConstants.EscalationMatrix.valueOf(escalate);
|
584 |
EscalationMatrix escalation = CRMConstants.EscalationMatrix.valueOf(escalate);
|
| 585 |
List<Integer> escalationReceipients = escalation.getAgentIds();
|
585 |
List<Integer> escalationReceipients = escalation.getAgentIds();
|
| 586 |
|
586 |
|
| 587 |
String toMailIds = "";
|
587 |
List<String> toMailIds = new ArrayList<String>();
|
| 588 |
for (Integer agentId : escalationReceipients) {
|
588 |
for (Integer agentId : escalationReceipients) {
|
| 589 |
toMailIds += CRMAuthorizingRealm.getAgent(agentId).getEmailId() + ";";
|
589 |
toMailIds.add(CRMAuthorizingRealm.getAgent(agentId).getEmailId());
|
| 590 |
|
590 |
|
| 591 |
// Setting last agent as assignee
|
591 |
// Setting last agent as assignee
|
| 592 |
ticket.setAssigneeId(agentId);
|
592 |
ticket.setAssigneeId(agentId);
|
| 593 |
activity.setTicketAssigneeId(agentId);
|
593 |
activity.setTicketAssigneeId(agentId);
|
| 594 |
}
|
594 |
}
|
| Line 598... |
Line 598... |
| 598 |
String escalationMailBody = createEscalationMailBody(ticket, escalation);
|
598 |
String escalationMailBody = createEscalationMailBody(ticket, escalation);
|
| 599 |
|
599 |
|
| 600 |
activity.setUserEmailId(helperClient.saveUserEmailForSending(
|
600 |
activity.setUserEmailId(helperClient.saveUserEmailForSending(
|
| 601 |
toMailIds, CRMConstants.CRM_EMAIL_SENDOR,
|
601 |
toMailIds, CRMConstants.CRM_EMAIL_SENDOR,
|
| 602 |
escalationMailSubject, escalationMailBody,
|
602 |
escalationMailSubject, escalationMailBody,
|
| 603 |
null, CRMConstants.CRM_EMAIL_TYPE));
|
603 |
null, CRMConstants.CRM_EMAIL_TYPE, null, null));
|
| 604 |
|
604 |
|
| 605 |
// We change activityType to OTHER when pop up box for email
|
605 |
// We change activityType to OTHER when pop up box for email
|
| 606 |
// closes
|
606 |
// closes
|
| 607 |
activity.setDescription("To: " + toMailIds + "\n\nSubject: " + escalationMailSubject + "\n\n"
|
607 |
activity.setDescription("To: " + toMailIds + "\n\nSubject: " + escalationMailSubject + "\n\n"
|
| 608 |
+ "Body: " + escalationMailBody);
|
608 |
+ "Body: " + escalationMailBody);
|