diff --git a/applications/workeffort/servicedef/services.xml b/applications/workeffort/servicedef/services.xml index 4703e63475..ef9578a7aa 100644 --- a/applications/workeffort/servicedef/services.xml +++ b/applications/workeffort/servicedef/services.xml @@ -806,10 +806,6 @@ under the License. - - Migrate work effort event reminders. Run this service to update work effort reminders. - emailCtx = UtilMisc.toMap("sendFrom", fromAddress, "sendTo", toAddress, "subject", subject, "bodyParameters", parameters, "bodyScreenUri", screenLocation); - try { - dispatcher.runAsync("sendMailFromScreen", emailCtx); - } catch (Exception e) { - Debug.logWarning("Error while emailing event reminder - workEffortId = " + reminder.get("workEffortId") + ", contactMechId = " + reminder.get("contactMechId") + ": " + e, module); - } + Debug.logError("No email template (WEFF_EVENT_REMINDER) has been configured, reminder cannot be send.", module); } return ServiceUtil.returnSuccess(); } @@ -1066,55 +1057,6 @@ public class WorkEffortServices { return ServiceUtil.returnSuccess(); } - @Deprecated - protected static void processEventReminder(DispatchContext ctx, GenericValue reminder, Map parameters) throws GenericEntityException { - LocalDispatcher dispatcher = ctx.getDispatcher(); - Delegator delegator = ctx.getDelegator(); - GenericValue contactMech = reminder.getRelatedOne("ContactMech", false); - if (contactMech != null && "EMAIL_ADDRESS".equals(contactMech.get("contactMechTypeId"))) { - String screenLocation = EntityUtilProperties.getPropertyValue("EventReminders", "eventReminders.emailScreenWidgetLocation", delegator); - String fromAddress = EntityUtilProperties.getPropertyValue("EventReminders", "eventReminders.emailFromAddress", delegator); - String toAddress = contactMech.getString("infoString"); - String subject = UtilProperties.getMessage("WorkEffortUiLabels", "WorkEffortEventReminder", (Locale) parameters.get("locale")); - Map emailCtx = UtilMisc.toMap("sendFrom", fromAddress, "sendTo", toAddress, "subject", subject, "bodyParameters", parameters, "bodyScreenUri", screenLocation); - try { - dispatcher.runAsync("sendMailFromScreen", emailCtx); - } catch (Exception e) { - Debug.logWarning("Error while emailing event reminder - workEffortId = " + reminder.get("workEffortId") + ", contactMechId = " + reminder.get("contactMechId") + ": " + e, module); - } - return; - } - // TODO: Other contact mechanism types - Debug.logWarning("Invalid event reminder contact mech, workEffortId = " + reminder.get("workEffortId") + ", contactMechId = " + reminder.get("contactMechId"), module); - } - - /** Migrate work effort event reminders. - * @param ctx the dispatch context - * @param context the context - * @return returns the result of the service execution - */ - public static Map migrateWorkEffortEventReminders(DispatchContext ctx, Map context) { - Delegator delegator = ctx.getDelegator(); - Locale locale = (Locale) context.get("locale"); - ModelEntity modelEntity = delegator.getModelEntity("WorkEffortEventReminder"); - if (modelEntity != null && modelEntity.getField("recurrenceOffset") != null) { - List eventReminders = null; - try { - eventReminders = EntityQuery.use(delegator).from("WorkEffortEventReminder").queryList(); - for (GenericValue reminder : eventReminders) { - if (UtilValidate.isNotEmpty(reminder.get("recurrenceOffset"))) { - reminder.set("reminderOffset", reminder.get("recurrenceOffset")); - reminder.store(); - } - } - } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, - "WorkEffortEventRemindersMigrationError", UtilMisc.toMap("errorString", e), locale)); - } - } - return ServiceUtil.returnSuccess(); - } - public static Map removeDuplicateWorkEfforts(DispatchContext ctx, Map context) { List resultList = null; EntityListIterator eli = (EntityListIterator) context.get("workEffortIterator");