From 36908f0676cca69917bf27cd14fd1b59794d6bc7 Mon Sep 17 00:00:00 2001 From: gopalponnusamy Date: Thu, 16 Jun 2016 18:24:37 +0530 Subject: [PATCH] OLE-8923(3.0) generateHoldCourtesyNoticeJob sends email notices even though ntc_snd_typ set to "mail" --- .../main/java/org/kuali/ole/OLEConstants.java | 4 ++++ .../executors/RequestNoticesExecutor.java | 20 ++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/ole-app/olefs/src/main/java/org/kuali/ole/OLEConstants.java b/ole-app/olefs/src/main/java/org/kuali/ole/OLEConstants.java index f5f10d9528..34627b5a06 100644 --- a/ole-app/olefs/src/main/java/org/kuali/ole/OLEConstants.java +++ b/ole-app/olefs/src/main/java/org/kuali/ole/OLEConstants.java @@ -2779,6 +2779,7 @@ public static final class OleHoldings { public static final String ASSIGN_REQUESTOR_INQUIRY = "inquiry.do?methodToCall=start&businessObjectClassName=org.kuali.ole.deliver.bo.OLEPatronEntityViewBo&patronId="; public static final String DESCRIBE_COMPONENT = "Describe"; + public static final String DELIVER_COMPONENT = "Deliver"; public static final String DESCRIBE_EFFECTIVE_DATE = " 00:00:00"; public static final String INSTANCE_EDITOR_DELETE_EINSTANCE = "INSTANCE_EDITOR_DELETE_EINSTANCE"; @@ -3885,6 +3886,9 @@ public static final class OLEPurchaseOrderBulkAmendment { public static final String CR_ITEM_SEARCH_COUNT_BEFORE_ITEM_BILLED="CR_ITEM_SEARCH_COUNT_BEFORE_ITEM_BILLED"; public static final String ERROR_CIRC_DESK_REQUIRED = "error.circulation.desk.required"; public static final String FORGIVE_LOST_FEES = "FORGIVE_LOST_FEES"; + public static final String ON_HOLD_EXP_NOTICE = "On Hold Expiration Notice"; + public static final String HOLD_COUR_NOT_TYP = "HOLDCOURTESY_NOTICE_TYPE"; + public static final String EMAIL_NOT_TYP = "email"; public static final String ERROR_FROM_DATE = "error.from.date"; public static final String ERROR_TO_DATE = "error.to.date"; public static final String REPLACMENT_FEE="REPL_FEE"; diff --git a/ole-app/olefs/src/main/java/org/kuali/ole/deliver/notice/executors/RequestNoticesExecutor.java b/ole-app/olefs/src/main/java/org/kuali/ole/deliver/notice/executors/RequestNoticesExecutor.java index 2500f00566..6309d40e92 100644 --- a/ole-app/olefs/src/main/java/org/kuali/ole/deliver/notice/executors/RequestNoticesExecutor.java +++ b/ole-app/olefs/src/main/java/org/kuali/ole/deliver/notice/executors/RequestNoticesExecutor.java @@ -10,6 +10,9 @@ import org.kuali.ole.deliver.notice.bo.OleNoticeContentConfigurationBo; import org.kuali.ole.deliver.notice.noticeFormatters.RequestEmailContentFormatter; import org.kuali.ole.deliver.service.NoticesExecutor; +import org.kuali.rice.coreservice.api.CoreServiceApiServiceLocator; +import org.kuali.rice.coreservice.api.parameter.Parameter; +import org.kuali.rice.coreservice.api.parameter.ParameterKey; import org.kuali.rice.kim.impl.identity.type.EntityTypeContactInfoBo; import java.util.*; @@ -151,7 +154,15 @@ public void run() { if (StringUtils.isNotBlank(mailContent)) { System.out.println(mailContent); - sendMail(mailContent); + if (noticeContentConfigName.equals(OLEConstants.ON_HOLD_EXP_NOTICE)) { + if (getParameterValue(OLEConstants.HOLD_COUR_NOT_TYP).equals(OLEConstants.EMAIL_NOT_TYP)) { + sendMail(mailContent); + } + } else { + sendMail(mailContent); + } + + saveOLEDeliverNoticeHistory(filteredDeliverNotices, mailContent); @@ -187,5 +198,12 @@ public Map buildMapForIndexToSolr(String noticeType, String noticeContent, List< return parameterMap; } + public String getParameterValue(String key) { + ParameterKey parameterKey = ParameterKey.create(org.kuali.ole.OLEConstants.APPL_ID, org.kuali.ole.OLEConstants.DLVR_NMSPC,"Deliver" , key); + //org.kuali.ole.OLEConstants.DELIVER_COMPONENT + Parameter parameter = CoreServiceApiServiceLocator.getParameterRepositoryService().getParameter(parameterKey); + return parameter != null ? parameter.getValue() : null; + } + }