1 |
1 |
package eu.dnetlib.goldoa.service.utils;
|
2 |
2 |
|
3 |
3 |
import eu.dnetlib.goldoa.domain.BudgetInfo;
|
|
4 |
import eu.dnetlib.goldoa.domain.Comment;
|
4 |
5 |
import eu.dnetlib.goldoa.domain.Person;
|
5 |
6 |
import eu.dnetlib.goldoa.domain.Publisher;
|
6 |
7 |
import eu.dnetlib.goldoa.domain.RequestInfo;
|
... | ... | |
173 |
174 |
"If no invoice has been uploaded, or the publisher bank information is missing, our accounting office may put the request on hold until all information is in the system.\n" +
|
174 |
175 |
"\n";
|
175 |
176 |
|
176 |
|
if (requestInfo.getComments() != null && requestInfo.getComments().size() > 0)
|
177 |
|
text += requestInfo.getComments().get(requestInfo.getComments().size() - 1).getComment() + "\n\n";
|
178 |
|
|
|
177 |
text += formatComments(requestInfo);
|
179 |
178 |
text += "You may click on the link below at any time to follow the status of your request:\n" +
|
180 |
179 |
link + "\n" +
|
181 |
180 |
" \n" +
|
... | ... | |
211 |
210 |
"If no invoice has been uploaded, or the publisher bank information is missing, our accounting office may put the request on hold until all information is in the system.\n" +
|
212 |
211 |
"\n";
|
213 |
212 |
|
214 |
|
if (requestInfo.getComments() != null && requestInfo.getComments().size() > 0)
|
215 |
|
text += requestInfo.getComments().get(requestInfo.getComments().size() - 1).getComment() + "\n\n";
|
216 |
|
|
|
213 |
text += formatComments(requestInfo);
|
217 |
214 |
text += "You may click on the link below at any time to follow the status of your request:\n" +
|
218 |
215 |
link + "\n" +
|
219 |
216 |
" \n" +
|
... | ... | |
246 |
243 |
text += "Publisher: " + requestInfo.getPublication().getPublisher().getName() + "\n";
|
247 |
244 |
|
248 |
245 |
text += "Requested funding: " + requestInfo.getFundingRequested() + " " + requestInfo.getCurrency().getName() + "\n" +
|
249 |
|
"\n" +
|
250 |
|
"Reason: ";
|
251 |
|
|
252 |
|
if (requestInfo.getComments() != null && requestInfo.getComments().size() > 0)
|
253 |
|
text += requestInfo.getComments().get(requestInfo.getComments().size() - 1).getComment() + "\n\n";
|
254 |
|
else
|
255 |
|
text += "-\n\n";
|
256 |
|
|
|
246 |
"\n";
|
|
247 |
text += formatComments(requestInfo);
|
257 |
248 |
text += "You may click on the link below at any time to find more information:\n" +
|
258 |
249 |
link + "\n" +
|
259 |
250 |
" \n" +
|
... | ... | |
485 |
476 |
"Phone: +30 210 6875 300 Fax +30 210 6875 485\n" +
|
486 |
477 |
"VAT NUMBER: EL999723442\n" +
|
487 |
478 |
"\n";
|
488 |
|
|
489 |
|
if (requestInfo.getComments() != null && requestInfo.getComments().size() > 0)
|
490 |
|
text += requestInfo.getComments().get(requestInfo.getComments().size() - 1).getComment() + "\n\n";
|
491 |
|
|
|
479 |
text += formatComments(requestInfo);
|
492 |
480 |
text += "Click on the link below at any time to follow the status of your request:\n" +
|
493 |
481 |
requestLink + "\n" +
|
494 |
482 |
"\n" +
|
... | ... | |
554 |
542 |
"VAT NUMBER: EL999723442\n" +
|
555 |
543 |
"\n";
|
556 |
544 |
|
557 |
|
if (requestInfo.getComments() != null && requestInfo.getComments().size() > 0)
|
558 |
|
text += requestInfo.getComments().get(requestInfo.getComments().size() - 1).getComment() + "\n\n";
|
559 |
|
|
|
545 |
text += formatComments(requestInfo);
|
560 |
546 |
text += "Click on the link below at any time to follow the status of this request:\n" +
|
561 |
547 |
requestLink + "\n" +
|
562 |
548 |
"\n" +
|
... | ... | |
631 |
617 |
"1. update the DOI in our system, and \n" +
|
632 |
618 |
"2. deposit the final manuscript in an OpenAIRE compliant repository (see list here)\n" +
|
633 |
619 |
"\n";
|
634 |
|
if (requestInfo.getComments() != null && requestInfo.getComments().size() > 0)
|
635 |
|
text += requestInfo.getComments().get(requestInfo.getComments().size() - 1).getComment() + "\n\n";
|
636 |
620 |
|
|
621 |
text += formatComments(requestInfo);
|
637 |
622 |
text += "Feel free to contact us at " + contactLink + " if you need further information.\n\n" +
|
638 |
623 |
"Best,\n" +
|
639 |
624 |
"The OpenAIRE team";
|
... | ... | |
689 |
674 |
"1. update the DOI in our system, and \n" +
|
690 |
675 |
"2. deposit the final manuscript in an OpenAIRE compliant repository (see list here)\n" +
|
691 |
676 |
"\n";
|
692 |
|
if (requestInfo.getComments() != null && requestInfo.getComments().size() > 0)
|
693 |
|
text += requestInfo.getComments().get(requestInfo.getComments().size() - 1).getComment() + "\n\n";
|
694 |
|
|
|
677 |
text += formatComments(requestInfo);
|
695 |
678 |
text += "Feel free to contact us at " + contactLink + " if you need further information.\n\n" +
|
696 |
679 |
"Best,\n" +
|
697 |
680 |
"The OpenAIRE team";
|
... | ... | |
701 |
684 |
}
|
702 |
685 |
|
703 |
686 |
@Override
|
|
687 |
public void sendModeratorPaidEmail(Person moderator, RequestInfo requestInfo) throws MessagingException {
|
|
688 |
String subject = "[OpenAIRE-FP7-Post-Grant-OA-Pilot] Funding request " + requestInfo.getId() + " for invoice " + requestInfo.getInvoice().getNumber() + " has been paid";
|
|
689 |
String text;
|
|
690 |
|
|
691 |
text = "Dear moderator,\n";
|
|
692 |
text += "\n" +
|
|
693 |
"The following request has been completed and APCs have been paid:\n" +
|
|
694 |
"\n" +
|
|
695 |
"Invoice #: " + requestInfo.getInvoice().getNumber() + "\n" +
|
|
696 |
"Project: " + requestInfo.getProject().getAcronym() + " - " + requestInfo.getProject().getGrant() + "\n" +
|
|
697 |
"Publication: " + requestInfo.getPublication().getTitle() + "\n"; // TODO add authors
|
|
698 |
|
|
699 |
if (requestInfo.getPublication().getJournal() != null) {
|
|
700 |
text += "Journal: " + requestInfo.getPublication().getJournal().getTitle();
|
|
701 |
|
|
702 |
if (requestInfo.getPublication().getJournal().getPublisher() != null)
|
|
703 |
text += " , " + requestInfo.getPublication().getJournal().getPublisher().getName();
|
|
704 |
|
|
705 |
text += "\n";
|
|
706 |
} else if (requestInfo.getPublication().getPublisher() != null)
|
|
707 |
text += "Publisher: " + requestInfo.getPublication().getPublisher().getName() + "\n";
|
|
708 |
|
|
709 |
text += "Requested funding: " + requestInfo.getFundingRequested() + " " + requestInfo.getCurrency().getName() + "\n" +
|
|
710 |
"\n";
|
|
711 |
|
|
712 |
text += "Best,\n" +
|
|
713 |
"The OpenAIRE team";
|
|
714 |
|
|
715 |
mailLibrary.sendEmail(new String[]{moderator.getEmail()}, subject, text);
|
|
716 |
}
|
|
717 |
|
|
718 |
@Override
|
704 |
719 |
public void sendRequesterOnHoldEmail(RequestInfo requestInfo) throws MessagingException {
|
705 |
720 |
String subject = "[OpenAIRE-FP7-Post-Grant-OA-Pilot] Your funding request " + requestInfo.getId() + " has been put on hold";
|
706 |
721 |
String contactLink = baseAddress + "/#home";
|
... | ... | |
725 |
740 |
|
726 |
741 |
text += "Requested funding: " + requestInfo.getFundingRequested() + " " + requestInfo.getCurrency().getName() + "\n" +
|
727 |
742 |
"\n";
|
728 |
|
if (requestInfo.getComments() != null && requestInfo.getComments().size() > 0)
|
729 |
|
text += requestInfo.getComments().get(requestInfo.getComments().size() - 1).getComment() + "\n\n";
|
730 |
|
|
|
743 |
text += formatComments(requestInfo);
|
731 |
744 |
text += "Click on the link below at any time to follow the status of your request:\n" +
|
732 |
745 |
requestLink + "\n" +
|
733 |
746 |
"\n" +
|
... | ... | |
738 |
751 |
mailLibrary.sendEmail(new String[]{requestInfo.getUser().getEmail()}, subject, text);
|
739 |
752 |
}
|
740 |
753 |
|
|
754 |
private String formatComments(RequestInfo requestInfo) {
|
|
755 |
String text = "";
|
|
756 |
|
|
757 |
if (requestInfo.getComments() != null && requestInfo.getComments().size() > 0) {
|
|
758 |
text = "IMPORTANT:\n";
|
|
759 |
|
|
760 |
for (int i = 0; i < requestInfo.getComments().size(); i++) {
|
|
761 |
Comment comment = requestInfo.getComments().get(i);
|
|
762 |
|
|
763 |
if (i > 0)
|
|
764 |
text += "\n";
|
|
765 |
|
|
766 |
text += comment.getComment() + " -" + comment.getPerson().getName() + " " + comment.getPerson().getLastname() + " @ " + new SimpleDateFormat("yyyy-MM-dd").format(comment.getDate());
|
|
767 |
}
|
|
768 |
|
|
769 |
text += "\n\n";
|
|
770 |
}
|
|
771 |
|
|
772 |
return text;
|
|
773 |
}
|
|
774 |
|
741 |
775 |
@Override
|
742 |
776 |
public void sendPublisherOnHoldEmail(RequestInfo requestInfo) throws MessagingException {
|
743 |
777 |
Publisher publisher = requestInfo.getPublication().getPublisher() != null ? requestInfo.getPublication().getPublisher() : requestInfo.getPublication().getJournal().getPublisher();
|
... | ... | |
783 |
817 |
|
784 |
818 |
text += "Requested funding: " + requestInfo.getFundingRequested() + " " + requestInfo.getCurrency().getName() + "\n" +
|
785 |
819 |
"\n";
|
786 |
|
if (requestInfo.getComments() != null && requestInfo.getComments().size() > 0)
|
787 |
|
text += requestInfo.getComments().get(requestInfo.getComments().size() - 1).getComment() + "\n\n";
|
788 |
|
|
|
820 |
text += formatComments(requestInfo);
|
789 |
821 |
text += "Click on the link below at any time to follow the status of your request:\n" +
|
790 |
822 |
requestLink + "\n" +
|
791 |
823 |
"\n" +
|
... | ... | |
822 |
854 |
|
823 |
855 |
text += "Requested funding: " + requestInfo.getFundingRequested() + " " + requestInfo.getCurrency().getName() + "\n" +
|
824 |
856 |
"\n";
|
825 |
|
if (requestInfo.getComments() != null && requestInfo.getComments().size() > 0)
|
826 |
|
text += requestInfo.getComments().get(requestInfo.getComments().size() - 1).getComment() + "\n\n";
|
827 |
|
|
|
857 |
text += formatComments(requestInfo);
|
828 |
858 |
text += "Click on the link below at any time to follow the status of your request:\n" +
|
829 |
859 |
requestLink + "\n" +
|
830 |
860 |
"\n" +
|
- Notifying moderator when a request has been paid.
- Sending all comments in notification emails.