You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by bi...@apache.org on 2008/06/16 15:19:26 UTC

svn commit: r668152 - in /ofbiz/trunk/applications/workeffort: servicedef/ src/org/ofbiz/workeffort/workeffort/ webapp/workeffort/WEB-INF/actions/calendar/ webapp/workeffort/calendar/ widget/

Author: bibryam
Date: Mon Jun 16 06:19:25 2008
New Revision: 668152

URL: http://svn.apache.org/viewvc?rev=668152&view=rev
Log:
Added possibility to filter WorkEfforts by type in WorkEffort -> Calendar screen.

Modified:
    ofbiz/trunk/applications/workeffort/servicedef/services.xml
    ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java
    ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Days.groovy
    ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy
    ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Upcoming.groovy
    ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Week.groovy
    ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/eventsByForms.ftl
    ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/upcoming.ftl
    ofbiz/trunk/applications/workeffort/widget/CommonScreens.xml

Modified: ofbiz/trunk/applications/workeffort/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/servicedef/services.xml?rev=668152&r1=668151&r2=668152&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/workeffort/servicedef/services.xml Mon Jun 16 06:19:25 2008
@@ -227,6 +227,7 @@
         <attribute name="partyIds" type="java.util.Collection" mode="IN" optional="true"/>
         <attribute name="facilityId" type="String" mode="IN" optional="true"/>
         <attribute name="fixedAssetId" type="String" mode="IN" optional="true"/>
+        <attribute name="workEffortTypeId" type="String" mode="IN" optional="true"/>
         <attribute name="start" type="java.sql.Timestamp" mode="IN" optional="false"/>
         <attribute name="numPeriods" type="java.lang.Integer" mode="IN" optional="false"/>
         <attribute name="periodType" type="java.lang.Integer" mode="IN" optional="false"/>

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=668152&r1=668151&r2=668152&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 Mon Jun 16 06:19:25 2008
@@ -338,9 +338,12 @@
         return resultMap;
     } 
         
-    private static List getDefaultWorkEffortExprList(Collection partyIds, String facilityId, String fixedAssetId) {
+    private static List getDefaultWorkEffortExprList(Collection partyIds, String facilityId, String fixedAssetId, String workEffortTypeId) {
         List entityExprList = UtilMisc.toList(EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_CANCELLED"), EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "PRUN_CANCELLED"));
-        List typesList = UtilMisc.toList(EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, "EVENT"));
+        List typesList = FastList.newInstance();
+        if (UtilValidate.isNotEmpty(workEffortTypeId)) {
+            typesList.add(EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, workEffortTypeId));
+        }        
         if (partyIds != null && partyIds.size() > 0) {
             entityExprList.add(EntityCondition.makeCondition("partyId", EntityOperator.IN, partyIds));
         }
@@ -359,7 +362,9 @@
             entityExprList.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "PRUN_CLOSED"));
         }
         EntityCondition typesCondition = null;
-        if (typesList.size() == 1) {
+        if (typesList.size() == 0) {
+            return entityExprList;
+        } else if (typesList.size() == 1) {
             typesCondition = (EntityExpr) typesList.get(0);
         } else {
             typesCondition = EntityCondition.makeCondition(typesList, EntityJoinOperator.OR);
@@ -421,6 +426,7 @@
         Collection partyIds = (Collection) context.get("partyIds");
         String facilityId = (String) context.get("facilityId");
         String fixedAssetId = (String) context.get("fixedAssetId");
+        String workEffortTypeId = (String) context.get("workEffortTypeId");
         Boolean filterOutCanceledEvents = (Boolean) context.get("filterOutCanceledEvents");
         if (filterOutCanceledEvents == null) {
             filterOutCanceledEvents = Boolean.FALSE;
@@ -467,7 +473,7 @@
 
         List entityExprList = (List) context.get("entityExprList");
         if (entityExprList == null) {
-            entityExprList = getDefaultWorkEffortExprList(partyIds, facilityId, fixedAssetId);
+            entityExprList = getDefaultWorkEffortExprList(partyIds, facilityId, fixedAssetId, workEffortTypeId);
         }
         entityExprList.add(EntityCondition.makeCondition("estimatedCompletionDate", EntityOperator.GREATER_THAN_EQUAL_TO, startStamp));
         entityExprList.add(EntityCondition.makeCondition("estimatedStartDate", EntityOperator.LESS_THAN, endStamp));

Modified: ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Days.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Days.groovy?rev=668152&r1=668151&r2=668152&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Days.groovy (original)
+++ ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Days.groovy Mon Jun 16 06:19:25 2008
@@ -30,6 +30,7 @@
 facilityId = parameters.get("facilityId");
 fixedAssetId = parameters.get("fixedAssetId");
 partyId = parameters.get("partyId");
+workEffortTypeId = parameters.get("workEffortTypeId");
 
 eventsParam = "";
 if (facilityId != null) {
@@ -42,6 +43,10 @@
     eventsParam = "partyId=" + partyId;
 }
 
+if (workEffortTypeId != null) {
+    eventsParam = "workEffortTypeId=" + workEffortTypeId;
+}
+
 Timestamp start = null;
 if(startParam != null) {
     start = new Timestamp(Long.parseLong(startParam));
@@ -56,7 +61,7 @@
 Timestamp next = UtilDateTime.getDayStart(start, 1, timeZone, locale);
 
 Map serviceCtx = UtilMisc.toMap("userLogin", userLogin,"start",start,"numPeriods",new Integer(24),"periodType",new Integer(Calendar.HOUR));
-serviceCtx.putAll(UtilMisc.toMap("partyId", partyId, "facilityId", facilityId, "fixedAssetId", fixedAssetId, "locale", locale, "timeZone", timeZone));
+serviceCtx.putAll(UtilMisc.toMap("partyId", partyId, "facilityId", facilityId, "fixedAssetId", fixedAssetId, "workEffortTypeId", workEffortTypeId, "locale", locale, "timeZone", timeZone));
 
 Map result = dispatcher.runSync("getWorkEffortEventsByPeriod",serviceCtx);
 context.put("periods",result.get("periods"));

Modified: ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy?rev=668152&r1=668151&r2=668152&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy (original)
+++ ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy Mon Jun 16 06:19:25 2008
@@ -31,6 +31,7 @@
 facilityId = parameters.get("facilityId");
 fixedAssetId = parameters.get("fixedAssetId");
 partyId = parameters.get("partyId");
+workEffortTypeId = parameters.get("workEffortTypeId");
 
 eventsParam = "";
 if (facilityId != null) {
@@ -43,6 +44,10 @@
     eventsParam = "partyId=" + partyId;
 }
 
+if (workEffortTypeId != null) {
+    eventsParam = "workEffortTypeId=" + workEffortTypeId;
+}
+
 start = null;
 if(UtilValidate.isNotEmpty(startParam)) {
     start = new Timestamp(Long.parseLong(startParam));
@@ -71,7 +76,7 @@
 context.put("firstWeekNum", new Integer(firstWeekNum));
 
 serviceCtx = UtilMisc.toMap("userLogin", userLogin, "start", getFrom,"numPeriods", new Integer(numDays), "periodType", new Integer(Calendar.DATE));
-serviceCtx.putAll(UtilMisc.toMap("partyId", partyId, "facilityId", facilityId, "fixedAssetId", fixedAssetId, "locale", locale, "timeZone", timeZone));
+serviceCtx.putAll(UtilMisc.toMap("partyId", partyId, "facilityId", facilityId, "fixedAssetId", fixedAssetId, "workEffortTypeId", workEffortTypeId, "locale", locale, "timeZone", timeZone));
 
 result = dispatcher.runSync("getWorkEffortEventsByPeriod", serviceCtx);
 

Modified: ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Upcoming.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Upcoming.groovy?rev=668152&r1=668151&r2=668152&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Upcoming.groovy (original)
+++ ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Upcoming.groovy Mon Jun 16 06:19:25 2008
@@ -27,6 +27,7 @@
 facilityId = parameters.get("facilityId");
 fixedAssetId = parameters.get("fixedAssetId");
 partyId = parameters.get("partyId");
+workEffortTypeId = parameters.get("workEffortTypeId");
 start = nowTimestamp.clone();
 eventsParam = "";
 if (facilityId != null) {
@@ -38,9 +39,12 @@
 if (partyId != null) {
     eventsParam = "partyId=" + partyId;
 }
+if (workEffortTypeId != null) {
+    eventsParam = "workEffortTypeId=" + workEffortTypeId;
+}
 
 Map serviceCtx = UtilMisc.toMap("userLogin", userLogin, "start", start, "numPeriods", new Integer(7), "periodType", new Integer(Calendar.DATE));
-serviceCtx.putAll(UtilMisc.toMap("partyId", partyId, "facilityId", facilityId, "fixedAssetId", fixedAssetId, "locale", locale, "timeZone", timeZone));
+serviceCtx.putAll(UtilMisc.toMap("partyId", partyId, "facilityId", facilityId, "fixedAssetId", fixedAssetId, "workEffortTypeId", workEffortTypeId, "locale", locale, "timeZone", timeZone));
 
 Map result = dispatcher.runSync("getWorkEffortEventsByPeriod",serviceCtx);
 context.put("days", result.get("periods"));

Modified: ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Week.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Week.groovy?rev=668152&r1=668151&r2=668152&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Week.groovy (original)
+++ ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Week.groovy Mon Jun 16 06:19:25 2008
@@ -31,6 +31,7 @@
 facilityId = parameters.get("facilityId");
 fixedAssetId = parameters.get("fixedAssetId");
 partyId = parameters.get("partyId");
+workEffortTypeId = parameters.get("workEffortTypeId");
 
 eventsParam = "";
 if (facilityId != null) {
@@ -42,6 +43,9 @@
 if (partyId != null) {
     eventsParam = "partyId=" + partyId;
 }
+if (workEffortTypeId != null) {
+    eventsParam = "workEffortTypeId=" + workEffortTypeId;
+}
 
 Timestamp start = null;
 if(startParam != null) 
@@ -58,7 +62,7 @@
 Timestamp end = UtilDateTime.getDayStart(start, 6, timeZone, locale);
 
 Map serviceCtx = UtilMisc.toMap("userLogin", userLogin,"start",start,"numPeriods",new Integer(7),"periodType",new Integer(Calendar.DATE));
-serviceCtx.putAll(UtilMisc.toMap("partyId", partyId, "facilityId", facilityId, "fixedAssetId", fixedAssetId, "locale", locale, "timeZone", timeZone));
+serviceCtx.putAll(UtilMisc.toMap("partyId", partyId, "facilityId", facilityId, "fixedAssetId", fixedAssetId, "workEffortTypeId", workEffortTypeId, "locale", locale, "timeZone", timeZone));
 
 Map result = dispatcher.runSync("getWorkEffortEventsByPeriod",serviceCtx);
 context.put("periods",result.get("periods"));

Modified: ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/eventsByForms.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/eventsByForms.ftl?rev=668152&r1=668151&r2=668152&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/eventsByForms.ftl (original)
+++ ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/eventsByForms.ftl Mon Jun 16 06:19:25 2008
@@ -43,7 +43,7 @@
     </form>
     <br/>
     &nbsp; 
-    <form action="<@o...@ofbizUrl>" method="post">
+    <form style="display: inline;" action="<@o...@ofbizUrl>" method="post">
       <input type="hidden" name="start" value="${start.time?string("#")}"/>
       <span class="label">${uiLabelMap.WorkEffortByFixedAsset}</span>
       <select name="fixedAssetId">
@@ -54,5 +54,17 @@
       </select>
       <input type="submit" value="${uiLabelMap.CommonView}"/>
     </form>
+    &nbsp;|
+    <form style="display: inline;" action="<@o...@ofbizUrl>" method="post">
+      <input type="hidden" name="start" value="${start.time?string("#")}"/>
+      <span class="label">${uiLabelMap.CommonType}</span>
+      <select name="workEffortTypeId">
+        <option value=""></option>
+        <#list allWorkEffortTypes as WorkEffortType>
+          <option value="${WorkEffortType.workEffortTypeId}"<#if requestParameters.workEffortTypeId?has_content && requestParameters.workEffortTypeId == WorkEffortType.workEffortTypeId>${uiLabelMap.WorkEffortSelected}</#if>>${WorkEffortType.description}</option>
+        </#list>
+      </select>
+      <input type="submit" value="${uiLabelMap.CommonView}"/>
+    </form>    
   </div>
 </div>
\ No newline at end of file

Modified: ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/upcoming.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/upcoming.ftl?rev=668152&r1=668151&r2=668152&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/upcoming.ftl (original)
+++ ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/upcoming.ftl Mon Jun 16 06:19:25 2008
@@ -26,18 +26,20 @@
       <tr class="header-row">
         <td>${uiLabelMap.CommonStartDateTime}</td>
         <td>${uiLabelMap.CommonEndDateTime}</td>
-        <td>${uiLabelMap.WorkEffortEventName}</td>
+        <td>${uiLabelMap.CommonType}</td>
+        <td>${uiLabelMap.WorkEffortName}</td>        
       </tr>
       <#list days as day>
         <#assign workEfforts = day.calendarEntries>
         <#if workEfforts?has_content>
-          <tr class="header-row"><th colspan="3"><hr/></th></tr>
+          <tr class="header-row"><th colspan="4"><hr/></th></tr>
           <#assign alt_row = false>
           <#list workEfforts as calendarEntry>
             <#assign workEffort = calendarEntry.workEffort>
             <tr<#if alt_row> class="alternate-row"</#if>>
               <td>${workEffort.estimatedStartDate}</td>
               <td>${workEffort.estimatedStartDate}</td>
+              <td>${workEffort.getRelatedOne("WorkEffortType").get("description",locale)}</td>
               <td class="button-col"><a href="<@o...@ofbizUrl>">${workEffort.workEffortName}</a></td>
             </tr>
             <#assign alt_row = !alt_row>

Modified: ofbiz/trunk/applications/workeffort/widget/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/widget/CommonScreens.xml?rev=668152&r1=668151&r2=668152&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/widget/CommonScreens.xml (original)
+++ ofbiz/trunk/applications/workeffort/widget/CommonScreens.xml Mon Jun 16 06:19:25 2008
@@ -142,6 +142,9 @@
                                 <entity-condition entity-name="FixedAsset" list-name="allFixedAssets">
                                     <order-by field-name="fixedAssetId"/>
                                 </entity-condition>
+                                <entity-condition entity-name="WorkEffortType" list-name="allWorkEffortTypes">
+                                    <order-by field-name="description"/>
+                                </entity-condition>
                             </actions>
                             <widgets>
                                 <platform-specific>