Merge pull request #8484 from nibou230/copy-request-email-8451

Send email even if copy request is refused
This commit is contained in:
Tim Donohue
2022-10-28 14:39:07 -05:00
committed by GitHub
2 changed files with 19 additions and 7 deletions

View File

@@ -154,9 +154,9 @@ public class RequestItemEmailNotifier {
email.setContent("body", message);
email.setSubject(subject);
email.addRecipient(ri.getReqEmail());
if (ri.isAccept_request()) {
// Attach bitstreams.
try {
// Attach bitstreams.
try {
if (ri.isAccept_request()) {
if (ri.isAllfiles()) {
Item item = ri.getItem();
List<Bundle> bundles = item.getBundles("ORIGINAL");
@@ -179,11 +179,19 @@ public class RequestItemEmailNotifier {
bitstream.getFormat(context).getMIMEType());
}
email.send();
} catch (MessagingException | IOException | SQLException | AuthorizeException e) {
LOG.warn(LogHelper.getHeader(context,
"error_mailing_requestItem", e.getMessage()));
throw new IOException("Reply not sent: " + e.getMessage());
} else {
boolean sendRejectEmail = configurationService
.getBooleanProperty("request.item.reject.email", true);
// Not all sites want the "refusal" to be sent back to the requester via
// email. However, by default, the rejection email is sent back.
if (sendRejectEmail) {
email.send();
}
}
} catch (MessagingException | IOException | SQLException | AuthorizeException e) {
LOG.warn(LogHelper.getHeader(context,
"error_mailing_requestItem", e.getMessage()));
throw new IOException("Reply not sent: " + e.getMessage());
}
LOG.info(LogHelper.getHeader(context,
"sent_attach_requestItem", "token={}"), ri.getToken());

View File

@@ -1549,6 +1549,10 @@ log.report.dir = ${dspace.dir}/log
request.item.type = all
# Should all Request Copy emails go to the helpdesk instead of the item submitter?
request.item.helpdesk.override = false
# Should a rejection of a copy request send an email back to the requester?
# Defaults to "true", which means a rejection email is sent back.
# Setting it to "false" results in a silent rejection.
request.item.reject.email = true
#------------------------------------------------------------------#
#------------------SUBMISSION CONFIGURATION------------------------#