Skip to content

Commit

Permalink
Merge pull request #8 from mlibrary/issue-working7
Browse files Browse the repository at this point in the history
request copy change and DataCite Schema 4 change
  • Loading branch information
blancoj authored Aug 22, 2024
2 parents 5875ea9 + cb6bc50 commit 844b310
Show file tree
Hide file tree
Showing 9 changed files with 178 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
import org.dspace.handle.service.HandleService;
import org.dspace.services.ConfigurationService;


// import org.dspace.content.service.ItemService;
// import org.dspace.content.MetadataSchemaEnum;

/**
* Send item requests and responses by email.
Expand Down Expand Up @@ -62,6 +63,11 @@ public class RequestItemEmailNotifier {

protected final RequestItemAuthorExtractor requestItemAuthorExtractor;


// @Inject
// protected ItemService itemService;


@Inject
public RequestItemEmailNotifier(RequestItemAuthorExtractor requestItemAuthorExtractor) {
this.requestItemAuthorExtractor = requestItemAuthorExtractor;
Expand Down Expand Up @@ -165,8 +171,14 @@ public void sendResponse(Context context, RequestItem ri, String subject,
grantors = List.of();
}

//Need Grantor name and email, this would be the following metadata requestitem.email and requestitem.name

String grantorName;
String grantorAddress;

//grantorAddress = itemService.getMetadataFirstValue(ri.getItem(), MetadataSchemaEnum.DC.getName(), "requestcopy", "email", Item.ANY);
//grantorName = itemService.getMetadataFirstValue(ri.getItem(), MetadataSchemaEnum.DC.getName(), "requestcopy", "name", Item.ANY);

if (grantors.isEmpty()) {
grantorName = configurationService.getProperty("mail.admin.name");
grantorAddress = configurationService.getProperty("mail.admin");
Expand Down Expand Up @@ -221,13 +233,31 @@ public void sendResponse(Context context, RequestItem ri, String subject,
context.restoreAuthSystemState();
}
email.send();

//Send email to grantor to let grantor know that email was sent out.
Email email_grantor = Email.getEmail(I18nUtil.getEmailFilename(context.getCurrentLocale(),
"request_item.grantor" ));
//email_grantor.setSubject("Your email was sent out.");
email_grantor.addRecipient(grantorAddress);
email_grantor.addArgument(ri.getReqName());
email_grantor.addArgument(ri.getReqEmail());
email_grantor.send();

} 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();

Email email_grantor = Email.getEmail(I18nUtil.getEmailFilename(context.getCurrentLocale(),
"request_item.grantor" ));
//email_grantor.setSubject("Your email was sent out.");
email_grantor.addRecipient(grantorAddress);
email_grantor.addArgument(ri.getReqName());
email_grantor.addArgument(ri.getReqEmail());
email_grantor.send();
}
}
} catch (MessagingException | IOException | SQLException | AuthorizeException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,16 @@ protected void notifyOfArchive(Context context, Item item, Collection coll)
}
email.addRecipient(ep.getEmail());

// If configed, send email to Deep Blue that shows deposit
// item was deposited.
boolean sendToAdmin = configurationService.getBooleanProperty(
"deposit.notify.admin", false);
if ( sendToAdmin )
{
email.addRecipient(configurationService.getProperty("feedback.recipient"));
}


// UM Change To find out if there was a proxy depositor.
// For Proxie depoist.
String SubmitterMsg = "You submitted";
Expand Down
Loading

0 comments on commit 844b310

Please sign in to comment.