You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by nm...@apache.org on 2015/06/21 22:09:32 UTC

svn commit: r1686754 - in /ofbiz/trunk/applications/workeffort: servicedef/services.xml src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java

Author: nmalin
Date: Sun Jun 21 20:09:31 2015
New Revision: 1686754

URL: http://svn.apache.org/r1686754
Log:
 remove old deprecated code in WorkEffortEventReminder services related to issue OFBIZ-6519. Thanks Gil Portenseigne for this cleaning

Modified:
    ofbiz/trunk/applications/workeffort/servicedef/services.xml
    ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java

Modified: ofbiz/trunk/applications/workeffort/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/servicedef/services.xml?rev=1686754&r1=1686753&r2=1686754&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/workeffort/servicedef/services.xml Sun Jun 21 20:09:31 2015
@@ -806,10 +806,6 @@ under the License.
         <attribute name="reminder" mode="IN" type="GenericValue"/>
         <attribute name="bodyParameters" mode="IN" type="Map"/>
     </service>
-    <service name="migrateWorkEffortEventReminders" engine="java"
-            location="org.ofbiz.workeffort.workeffort.WorkEffortServices" invoke="migrateWorkEffortEventReminders" auth="true">
-        <description>Migrate work effort event reminders. Run this service to update work effort reminders.</description>
-    </service>
 
     <!-- WorkEffort and Survey Services -->
     <service name="createWorkEffortSurveyAppl" engine="simple" default-entity-name="WorkEffortSurveyAppl"

Modified: ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java?rev=1686754&r1=1686753&r2=1686754&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java (original)
+++ ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java Sun Jun 21 20:09:31 2015
@@ -1048,16 +1048,7 @@ public class WorkEffortServices {
                     Debug.logWarning("Error while emailing event reminder - workEffortId = " + reminder.get("workEffortId") + ", contactMechId = " + reminder.get("contactMechId") + ": " + e, module);
                 }
             } else {
-                // TODO: Remove this block after the next release 2010-11-29
-                String screenLocation = EntityUtilProperties.getPropertyValue("EventReminders", "eventReminders.emailScreenWidgetLocation", delegator);
-                String fromAddress = EntityUtilProperties.getPropertyValue("EventReminders", "eventReminders.emailFromAddress", delegator);
-                String subject = UtilProperties.getMessage("WorkEffortUiLabels", "WorkEffortEventReminder", (Locale) parameters.get("locale"));
-                Map<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> migrateWorkEffortEventReminders(DispatchContext ctx, Map<String, ? extends Object> context) {
-        Delegator delegator = ctx.getDelegator();
-        Locale locale = (Locale) context.get("locale");
-        ModelEntity modelEntity = delegator.getModelEntity("WorkEffortEventReminder");
-        if (modelEntity != null && modelEntity.getField("recurrenceOffset") != null) {
-            List<GenericValue> 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<String, Object> removeDuplicateWorkEfforts(DispatchContext ctx, Map<String, ? extends Object> context) {
         List<GenericValue> resultList = null;
         EntityListIterator eli = (EntityListIterator) context.get("workEffortIterator");