diff --git a/applications/workeffort/config/WorkEffortUiLabels.properties b/applications/workeffort/config/WorkEffortUiLabels.properties
index 94de242fc7..8b784c3391 100644
--- a/applications/workeffort/config/WorkEffortUiLabels.properties
+++ b/applications/workeffort/config/WorkEffortUiLabels.properties
@@ -155,6 +155,7 @@ WorkEffortAddTask=Add Task
WorkEffortAddExistingTask=Add An Existing Task (WorkEffortId)
WorkEffortAllPhases=All Phases
WorkEffortAllTasks=All Tasks
+WorkEffortAnyAssocType=Any Assoc Type
WorkEffortApplicationEventsTasksWorkflowActivities=This application is meant for those who maintain and use calendar events tasks and workflow activities
WorkEffortAssignedTasks=Assigned Tasks
WorkEffortAssociatedFromParentToChild=(associated from parent to child)
@@ -274,6 +275,8 @@ WorkEffortProduct=Product
WorkEffortPriorityHigh=High
WorkEffortPriorityLow=Low
WorkEffortProductId=ProductID
+WorkEffortProductId1=ProductID 1
+WorkEffortProductId2=ProductID 2
WorkEffortProject=Project
WorkEffortProjectPhases=ProjectPhases
WorkEffortProjects=Projects
diff --git a/applications/workeffort/entitydef/entitymodel.xml b/applications/workeffort/entitydef/entitymodel.xml
index cddcf77b63..2c4ad59a9e 100644
--- a/applications/workeffort/entitydef/entitymodel.xml
+++ b/applications/workeffort/entitydef/entitymodel.xml
@@ -732,7 +732,7 @@ under the License.
-
+
diff --git a/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearch.java b/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearch.java
index bad95f1bb9..d935947cbc 100644
--- a/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearch.java
+++ b/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearch.java
@@ -199,7 +199,7 @@ public class WorkEffortSearch {
long startMillis = System.currentTimeMillis();
// do the query
- EntityListIterator eli = this.doQuery(delegator);
+ EntityListIterator eli = this.doQuery(delegator);
ArrayList workEffortIds = this.makeWorkEffortIdList(eli);
if (eli != null) {
try {
@@ -545,7 +545,7 @@ public class WorkEffortSearch {
workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "WorkEffortAssocTypeId", "workEffortAssocTypeId", null, null, null, null);
workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "FromDate", "fromDate", null, null, null, null);
workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "ThruDate", "thruDate", null, null, null, null);
- workEffortSearchContext.dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("workEffortIdFrom"));
+ workEffortSearchContext.dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("workEffortId","workEffortIdFrom"));
workEffortSearchContext.entityConditionList.add(new EntityExpr(prefix + "WorkEffortIdTo", EntityOperator.IN, workEffortIdSet));
if (UtilValidate.isNotEmpty(workEffortAssocTypeId)) {
@@ -565,7 +565,7 @@ public class WorkEffortSearch {
workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "WorkEffortAssocTypeId", "workEffortAssocTypeId", null, null, null, null);
workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "FromDate", "fromDate", null, null, null, null);
workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "ThruDate", "thruDate", null, null, null, null);
- workEffortSearchContext.dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("workEffortIdTo"));
+ workEffortSearchContext.dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("workEffortId","workEffortIdTo"));
workEffortSearchContext.entityConditionList.add(new EntityExpr(prefix + "WorkEffortIdFrom", EntityOperator.IN, workEffortIdSet));
if (UtilValidate.isNotEmpty(workEffortAssocTypeId)) {
@@ -1016,18 +1016,50 @@ public class WorkEffortSearch {
public LastUpdatedRangeConstraint(Timestamp fromDate, Timestamp thruDate) {
this.fromDate = fromDate;
- this.thruDate = thruDate;
+ this.thruDate = thruDate;
}
public void addConstraint(WorkEffortSearchContext workEffortSearchContext) {
- // TODO: implement LastUpdatedRangeConstraint makeEntityCondition
+ workEffortSearchContext.dynamicViewEntity.addAlias("WEFF", "lastModifiedDate", "lastModifiedDate", null, null, null, null);
+
+ EntityConditionList dateConditions = null;
+ EntityExpr dateCondition=null;
+ if(fromDate !=null && thruDate!=null) {
+ dateConditions= new EntityConditionList(UtilMisc.toList(
+ new EntityExpr("lastModifiedDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate),
+ new EntityExpr("lastModifiedDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate)), EntityOperator.AND);
+ } if(fromDate !=null) {
+ dateCondition=new EntityExpr("lastModifiedDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate);
+ } else if (thruDate != null) {
+ dateCondition = new EntityExpr("lastModifiedDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate);
+ }
+ EntityConditionList conditions = null;
+ if(fromDate !=null && thruDate!=null) {
+ conditions=new EntityConditionList(UtilMisc.toList(
+ dateConditions,
+ new EntityExpr("lastModifiedDate", EntityOperator.EQUALS, null)),
+ EntityOperator.OR);
+ } else {
+ conditions=new EntityConditionList(UtilMisc.toList(
+ dateCondition,
+ new EntityExpr("lastModifiedDate", EntityOperator.EQUALS, null)),
+ EntityOperator.OR);
+ }
+
+ workEffortSearchContext.entityConditionList.add(conditions);
+
+ // add in workEffortSearchConstraint, don't worry about the workEffortSearchResultId or constraintSeqId, those will be fill in later
+ workEffortSearchContext.workEffortSearchConstraintList.add(workEffortSearchContext.getDelegator().makeValue("WorkEffortSearchConstraint", UtilMisc.toMap("constraintName", constraintName, "infoString","fromDate : " + fromDate + " thruDate : " + thruDate)));
}
/** pretty print for log messages and even UI stuff */
public String prettyPrintConstraint(GenericDelegator delegator, boolean detailed, Locale locale) {
- // TODO: implement the pretty print for log messages and even UI stuff
- return null;
+ StringBuffer ppBuf = new StringBuffer();
+ ppBuf.append(UtilProperties.getMessage(resource, "WorkEffortLastModified", locale) + ": \"");
+ ppBuf.append(fromDate +"-" +thruDate + "\", " + UtilProperties.getMessage(resource, "WorkEffortLastModified", locale) + " ");
+ return ppBuf.toString();
}
+
public boolean equals(Object obj) {
WorkEffortSearchConstraint psc = (WorkEffortSearchConstraint) obj;
diff --git a/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearchSession.java b/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearchSession.java
index ec213a237c..a5f8834abb 100644
--- a/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearchSession.java
+++ b/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearchSession.java
@@ -16,6 +16,7 @@
*/
package org.ofbiz.workeffort.workeffort;
+import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
@@ -27,6 +28,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilDateTime;
import org.ofbiz.base.util.UtilHttp;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.entity.GenericDelegator;
@@ -187,6 +189,48 @@ public class WorkEffortSearchSession {
searchAddConstraint(new WorkEffortSearch.WorkEffortReviewConstraint(reviewText), session);
constraintsChanged = true;
}
+// add a Work Effort Assoc Type to the search
+ if (UtilValidate.isNotEmpty((String) parameters.get("SEARCH_WORK_EFFORT_ID"))) {
+ String workEffortId=(String) parameters.get("SEARCH_WORK_EFFORT_ID");
+ String workEffortAssocTypeId=(String) parameters.get("workEffortAssocTypeId");
+ boolean includeAllSubWorkEfforts =!"N".equalsIgnoreCase((String) parameters.get("SEARCH_SUB_WORK_EFFORTS"));
+ searchAddConstraint(new WorkEffortSearch.WorkEffortAssocConstraint(workEffortId,workEffortAssocTypeId,includeAllSubWorkEfforts), session);
+ constraintsChanged = true;
+ }
+// add a Work Effort Party Assignment to the search
+ if (UtilValidate.isNotEmpty((String) parameters.get("partyId"))) {
+ String partyId=(String) parameters.get("partyId");
+ String roleTypeId=(String) parameters.get("roleTypeId");
+ searchAddConstraint(new WorkEffortSearch.PartyAssignmentConstraint(partyId,roleTypeId), session);
+ constraintsChanged = true;
+ }
+
+// add a Product Set to the search
+ if (UtilValidate.isNotEmpty((String) parameters.get("productId_1"))) {
+ List productSet = new ArrayList();
+ productSet.add(parameters.get("productId_1"));
+ if (UtilValidate.isNotEmpty((String) parameters.get("productId_2"))) {
+ productSet.add(parameters.get("productId_2"));
+ }
+ searchAddConstraint(new WorkEffortSearch.ProductSetConstraint(productSet), session);
+ constraintsChanged = true;
+ }
+
+// add a WorkEfort fromDate thruDate to the search
+ if (UtilValidate.isNotEmpty((String) parameters.get("fromDate")) || UtilValidate.isNotEmpty((String) parameters.get("thruDate")) ) {
+ Timestamp fromDate =null;
+ if (UtilValidate.isNotEmpty((String) parameters.get("fromDate"))) {
+ fromDate=Timestamp.valueOf((String) parameters.get("fromDate"));
+ }
+
+ Timestamp thruDate = null;
+ if (UtilValidate.isNotEmpty((String) parameters.get("thruDate"))) {
+ thruDate = Timestamp.valueOf((String) parameters.get("thruDate"));
+ }
+ searchAddConstraint(new WorkEffortSearch.LastUpdatedRangeConstraint(fromDate,thruDate), session);
+ constraintsChanged = true;
+ }
+
// if keywords were specified, add a constraint for them
if (UtilValidate.isNotEmpty((String) parameters.get("SEARCH_STRING"))) {
String keywordString = (String) parameters.get("SEARCH_STRING");
diff --git a/applications/workeffort/webapp/workeffort/WEB-INF/actions/find/WorkEffortSearchOptions.bsh b/applications/workeffort/webapp/workeffort/WEB-INF/actions/find/WorkEffortSearchOptions.bsh
index 40eb29a6e2..92bb0fc474 100644
--- a/applications/workeffort/webapp/workeffort/WEB-INF/actions/find/WorkEffortSearchOptions.bsh
+++ b/applications/workeffort/webapp/workeffort/WEB-INF/actions/find/WorkEffortSearchOptions.bsh
@@ -16,6 +16,7 @@
*/
import org.ofbiz.base.util.*;
+import java.sql.Timestamp;
import org.ofbiz.workeffort.workeffort.*;
searchOperator = parameters.get("SEARCH_OPERATOR");
@@ -23,9 +24,38 @@ if (!"AND".equals(searchOperator) && !"OR".equals(searchOperator)) {
searchOperator = "OR";
}
+//create the fromDate for calendar
+fromCal = Calendar.getInstance();
+fromCal.setTime(new java.util.Date());
+//fromCal.set(Calendar.DAY_OF_WEEK, fromCal.getActualMinimum(Calendar.DAY_OF_WEEK));
+fromCal.set(Calendar.HOUR_OF_DAY, fromCal.getActualMinimum(Calendar.HOUR_OF_DAY));
+fromCal.set(Calendar.MINUTE, fromCal.getActualMinimum(Calendar.MINUTE));
+fromCal.set(Calendar.SECOND, fromCal.getActualMinimum(Calendar.SECOND));
+fromCal.set(Calendar.MILLISECOND, fromCal.getActualMinimum(Calendar.MILLISECOND));
+fromTs = new Timestamp(fromCal.getTimeInMillis());
+fromStr = fromTs.toString();
+fromStr = fromStr.substring(0, fromStr.indexOf('.'));
+context.put("fromDateStr", fromStr);
+
+// create the thruDate for calendar
+toCal = Calendar.getInstance();
+toCal.setTime(new java.util.Date());
+//toCal.set(Calendar.DAY_OF_WEEK, toCal.getActualMaximum(Calendar.DAY_OF_WEEK));
+toCal.set(Calendar.HOUR_OF_DAY, toCal.getActualMaximum(Calendar.HOUR_OF_DAY));
+toCal.set(Calendar.MINUTE, toCal.getActualMaximum(Calendar.MINUTE));
+toCal.set(Calendar.SECOND, toCal.getActualMaximum(Calendar.SECOND));
+toCal.set(Calendar.MILLISECOND, toCal.getActualMaximum(Calendar.MILLISECOND));
+toTs = new Timestamp(toCal.getTimeInMillis());
+toStr = toTs.toString();
+context.put("thruDateStr", toStr);
+
searchConstraintStrings = WorkEffortSearchSession.searchGetConstraintStrings(false, session, delegator);
searchSortOrderString = WorkEffortSearchSession.searchGetSortOrderString(false, request);
+workEffortAssocTypes=delegator.findAll("WorkEffortAssocType");
+roleTypes=delegator.findAll("RoleType");
context.put("searchOperator", searchOperator);
context.put("searchConstraintStrings", searchConstraintStrings);
context.put("searchSortOrderString", searchSortOrderString);
+context.put("workEffortAssocTypes", workEffortAssocTypes);
+context.put("roleTypes", roleTypes);
\ No newline at end of file
diff --git a/applications/workeffort/webapp/workeffort/find/WorkEffortSearchOptions.ftl b/applications/workeffort/webapp/workeffort/find/WorkEffortSearchOptions.ftl
index fa35156653..e57ef22320 100644
--- a/applications/workeffort/webapp/workeffort/find/WorkEffortSearchOptions.ftl
+++ b/applications/workeffort/webapp/workeffort/find/WorkEffortSearchOptions.ftl
@@ -42,7 +42,106 @@ under the License.
-
+
+ |
+ ${uiLabelMap.FormFieldTitle_workEffortId}:
+ |
+
+
+
+ 
+
+ |
+
+
+ |
+ ${uiLabelMap.FormFieldTitle_workEffortAssocTypeId}:
+ |
+
+
+
+ ${uiLabelMap.WorkEffortIncludeAllSubWorkEfforts}?
+ ${uiLabelMap.CommonYes}
+ ${uiLabelMap.CommonNo}
+
+ |
+
+
+ |
+ ${uiLabelMap.PartyPartyId}:
+ |
+
+
+
+ 
+
+ |
+
+
+ |
+ ${uiLabelMap.PartyRoleTypeId}:
+ |
+
+
+
+
+ |
+
+
+ |
+ ${uiLabelMap.WorkEffortProductId1}:
+ |
+
+
+
+ 
+
+ |
+
+
+ |
+ ${uiLabelMap.WorkEffortProductId2}:
+ |
+
+
+
+ 
+
+ |
+
+
+ |
+ ${uiLabelMap.CommonDateFilter}
+ |
+
+
+ |
+
|
${uiLabelMap.CommonSortedBy}:
diff --git a/applications/workeffort/webapp/workeffort/find/WorkEffortSearchResults.ftl b/applications/workeffort/webapp/workeffort/find/WorkEffortSearchResults.ftl
index 28e5c4250b..429b33003c 100644
--- a/applications/workeffort/webapp/workeffort/find/WorkEffortSearchResults.ftl
+++ b/applications/workeffort/webapp/workeffort/find/WorkEffortSearchResults.ftl
@@ -17,10 +17,10 @@ under the License.
${uiLabelMap.WorkEffortSearchWorkEfforts}, ${uiLabelMap.ProductSearchFor}:
<#list searchConstraintStrings as searchConstraintString>
- [X] ${searchConstraintString}
+ X ${searchConstraintString}
#list>
${uiLabelMap.CommonSortedBy}: ${searchSortOrderString}
-
+
<#if !workEffortIds?has_content>
${uiLabelMap.ProductNoResultsFound}.
@@ -55,7 +55,7 @@ under the License.
<#assign workEffort = delegator.findByPrimaryKey("WorkEffort", Static["org.ofbiz.base.util.UtilMisc"].toMap("workEffortId", workEffortId))>
|
|
- [${workEffortId}] ${(workEffort.workEffortName)?if_exists}
+ ${workEffortId} ${(workEffort.workEffortName)?if_exists}
|
#list>