Applied patch from Ashish to extend WorkEffort advanced search UI, from Jira #OFBIZ-580; small change to not comment out the 2-way WorkEffortAssoc search
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@493684 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -732,7 +732,7 @@ under the License.
|
||||
<field name="constraintSeqId" type="id-ne"></field>
|
||||
<field name="constraintName" type="long-varchar"></field>
|
||||
<field name="infoString" type="long-varchar"></field>
|
||||
<field name="includeSubCategories" type="indicator"></field>
|
||||
<field name="includeSubWorkEfforts" type="indicator"></field>
|
||||
<field name="isAnd" type="indicator"></field>
|
||||
<field name="anyPrefix" type="indicator"></field>
|
||||
<field name="anySuffix" type="indicator"></field>
|
||||
|
||||
@@ -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;
|
||||
|
||||
+44
@@ -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");
|
||||
|
||||
+30
@@ -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);
|
||||
@@ -42,7 +42,106 @@ under the License.
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right" valign="middle">
|
||||
<div class="tabletext">${uiLabelMap.FormFieldTitle_workEffortId}:</div>
|
||||
</td>
|
||||
<td valign="middle">
|
||||
<div class="tabletext">
|
||||
<input type="text" class="inputBox" name="SEARCH_WORK_EFFORT_ID" size="40" value="${requestParameters.SEARCH_WORK_EFFORT_ID?if_exists}"/>
|
||||
<a href="javascript:call_fieldlookup2(document.advToKeyWordSearchForm.SEARCH_WORK_EFFORT_ID,'LookupWorkEffort');"><img src='/images/fieldlookup.gif' width='15' height='14' border='0' alt='Click here For Field Lookup'/></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" valign="middle" nowrap>
|
||||
<div class="tabletext">${uiLabelMap.FormFieldTitle_workEffortAssocTypeId}:</div>
|
||||
</td>
|
||||
<td valign="middle" nowrap>
|
||||
<div class="tabletext">
|
||||
<select class="selectBox" name="workEffortAssocTypeId">
|
||||
<option value="">- ${uiLabelMap.WorkEffortAnyAssocType} -</option>
|
||||
<#list workEffortAssocTypes as workEffortAssocType>
|
||||
<option value="${workEffortAssocType.workEffortAssocTypeId}">${workEffortAssocType.description}</option>
|
||||
</#list>
|
||||
</select>
|
||||
${uiLabelMap.WorkEffortIncludeAllSubWorkEfforts}?
|
||||
${uiLabelMap.CommonYes}<input type="radio" name="SEARCH_SUB_WORK_EFFORTS" value="Y" checked/>
|
||||
${uiLabelMap.CommonNo}<input type="radio" name="SEARCH_SUB_WORK_EFFORTS" value="N"/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" valign="middle">
|
||||
<div class="tabletext">${uiLabelMap.PartyPartyId}:</div>
|
||||
</td>
|
||||
<td valign="middle">
|
||||
<div class="tabletext">
|
||||
<input type="text" class="inputBox" name="partyId" size="40" value="${requestParameters.partyId?if_exists}"/>
|
||||
<a href="javascript:call_fieldlookup2(document.advToKeyWordSearchForm.partyId,'LookupPartyName');"><img src='/images/fieldlookup.gif' width='15' height='14' border='0' alt='Click here For Field Lookup'/></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" valign="middle">
|
||||
<div class="tabletext">${uiLabelMap.PartyRoleTypeId}:</div>
|
||||
</td>
|
||||
<td valign="middle">
|
||||
<div class="tabletext">
|
||||
<select class="selectBox" name="partyRoleTypeId">
|
||||
<option value="">- ${uiLabelMap.CommonAnyRoleType} -</option>
|
||||
<#list roleTypes as roleType>
|
||||
<option value="${roleType.roleTypeId}">${roleType.description}</option>
|
||||
</#list>
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" valign="middle">
|
||||
<div class="tabletext">${uiLabelMap.WorkEffortProductId1}:</div>
|
||||
</td>
|
||||
<td valign="middle">
|
||||
<div class="tabletext">
|
||||
<input type="text" class="inputBox" name="productId_1" size="40" value="${requestParameters.productId_1?if_exists}"/>
|
||||
<a href="javascript:call_fieldlookup2(document.advToKeyWordSearchForm.productId_1,'LookupProduct');"><img src='/images/fieldlookup.gif' width='15' height='14' border='0' alt='Click here For Field Lookup'/></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" valign="middle">
|
||||
<div class="tabletext">${uiLabelMap.WorkEffortProductId2}:</div>
|
||||
</td>
|
||||
<td valign="middle">
|
||||
<div class="tabletext">
|
||||
<input type="text" class="inputBox" name="productId_2" size="40" value="${requestParameters.productId_2?if_exists}"/>
|
||||
<a href="javascript:call_fieldlookup2(document.advToKeyWordSearchForm.productId_2,'LookupProduct');"><img src='/images/fieldlookup.gif' width='15' height='14' border='0' alt='Click here For Field Lookup'/></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width='25%' align='right'>
|
||||
<div class='tableheadtext'>${uiLabelMap.CommonDateFilter}</div>
|
||||
</td>
|
||||
<td>
|
||||
<table border='0' cellspacing='0' cellpadding='0'>
|
||||
<tr>
|
||||
<td nowrap>
|
||||
<input type='text' size='25' class='inputBox' name='fromDate' value='${requestParameters.fromDate?if_exists}'/>
|
||||
<a href="javascript:call_cal(document.advToKeyWordSearchForm.fromDate,'${fromDateStr}');"><img src='/images/cal.gif' width='16' height='16' border='0' alt='Calendar'/></a>
|
||||
<span class='tabletext'>${uiLabelMap.CommonFrom}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap>
|
||||
<input type='text' size='25' class='inputBox' name='thruDate' value='${requestParameters.thruDate?if_exists}'/>
|
||||
<a href="javascript:call_cal(document.advToKeyWordSearchForm.thruDate,'${thruDateStr}');"><img src='/images/cal.gif' width='16' height='16' border='0' alt='Calendar'/></a>
|
||||
<span class='tabletext'>${uiLabelMap.CommonThru}</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" valign="middle">
|
||||
<div class="tabletext">${uiLabelMap.CommonSortedBy}:</div>
|
||||
|
||||
@@ -17,10 +17,10 @@ under the License.
|
||||
|
||||
<div class="head1">${uiLabelMap.WorkEffortSearchWorkEfforts}, <span class="head2">${uiLabelMap.ProductSearchFor}:</span></div>
|
||||
<#list searchConstraintStrings as searchConstraintString>
|
||||
<div class="tabletext"> <a href="<@ofbizUrl>WorkEffortSearchResults?removeConstraint=${searchConstraintString_index}&clearSearch=N</@ofbizUrl>" class="buttontext">[X]</a> ${searchConstraintString}</div>
|
||||
<div class="tabletext"> <a href="<@ofbizUrl>WorkEffortSearchResults?removeConstraint=${searchConstraintString_index}&clearSearch=N</@ofbizUrl>" class="buttontext">X</a> ${searchConstraintString}</div>
|
||||
</#list>
|
||||
<div class="tabletext">${uiLabelMap.CommonSortedBy}: ${searchSortOrderString}</div>
|
||||
<div class="tabletext"><a href="<@ofbizUrl>WorkEffortSearchOptions</@ofbizUrl>" class="buttontext">[${uiLabelMap.CommonRefine} ${uiLabelMap.CommonSearch}]</a></div>
|
||||
<div class="tabletext"><a href="<@ofbizUrl>WorkEffortSearchOptions</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonRefine} ${uiLabelMap.CommonSearch}</a></div>
|
||||
|
||||
<#if !workEffortIds?has_content>
|
||||
<br/><div class="head2"> ${uiLabelMap.ProductNoResultsFound}.</div>
|
||||
@@ -55,7 +55,7 @@ under the License.
|
||||
<#assign workEffort = delegator.findByPrimaryKey("WorkEffort", Static["org.ofbiz.base.util.UtilMisc"].toMap("workEffortId", workEffortId))>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="<@ofbizUrl>EditWorkEffort?workEffortId=${workEffortId}</@ofbizUrl>" class="buttontext">[${workEffortId}] ${(workEffort.workEffortName)?if_exists}</a>
|
||||
<a href="<@ofbizUrl>EditWorkEffort?workEffortId=${workEffortId}</@ofbizUrl>" class="buttontext">${workEffortId} ${(workEffort.workEffortName)?if_exists}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</#list>
|
||||
|
||||
Reference in New Issue
Block a user