Author: hansbak
Date: Thu Jul 30 08:31:54 2009 New Revision: 799200 URL: http://svn.apache.org/viewvc?rev=799200&view=rev Log: calendar not showing public events as reported in the mailing list Modified: ofbiz/trunk/applications/workeffort/entitydef/entitymodel_view.xml ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java Modified: ofbiz/trunk/applications/workeffort/entitydef/entitymodel_view.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/entitydef/entitymodel_view.xml?rev=799200&r1=799199&r2=799200&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/entitydef/entitymodel_view.xml (original) +++ ofbiz/trunk/applications/workeffort/entitydef/entitymodel_view.xml Thu Jul 30 08:31:54 2009 @@ -235,8 +235,52 @@ <key-map field-name="roleTypeId"/> </relation> </view-entity> - <view-entity entity-name="WorkEffortPartyAssignAndRoleType" - package-name="org.ofbiz.workeffort.workeffort" + <view-entity entity-name="WorkEffortAndPartyAssignAndType" + package-name="org.ofbiz.workeffort.workeffort" + title="Work Effort And Party Assignment Entity"> + <member-entity entity-alias="WE" entity-name="WorkEffort"/> + <member-entity entity-alias="WEPA" entity-name="WorkEffortPartyAssignment"/> + <member-entity entity-alias="WETY" entity-name="WorkEffortType"/> + <alias-all entity-alias="WE"/> + <alias-all entity-alias="WEPA"> + <exclude field="facilityId"/> + </alias-all> + <alias entity-alias="WEPA" name="partyAssignFacilityId" field="facilityId"/> + <alias entity-alias="WETY" name="parentTypeId"/> + <view-link entity-alias="WE" rel-entity-alias="WEPA"> + <key-map field-name="workEffortId"/> + </view-link> + <view-link entity-alias="WE" rel-entity-alias="WETY"> + <key-map field-name="workEffortTypeId"/> + </view-link> + <relation type="one-nofk" rel-entity-name="WorkEffort"> + <key-map field-name="workEffortId"/> + </relation> + <relation type="one-nofk" rel-entity-name="WorkEffortPartyAssignment"> + <key-map field-name="workEffortId"/> + <key-map field-name="partyId"/> + <key-map field-name="roleTypeId"/> + <key-map field-name="fromDate"/> + </relation> + <relation type="one-nofk" rel-entity-name="WorkEffortType"> + <key-map field-name="workEffortTypeId"/> + </relation> + <relation type="one-nofk" rel-entity-name="Party"> + <key-map field-name="partyId"/> + </relation> + <relation type="one-nofk" rel-entity-name="Person"> + <key-map field-name="partyId"/> + </relation> + <relation type="one-nofk" rel-entity-name="PartyRole"> + <key-map field-name="partyId"/> + <key-map field-name="roleTypeId"/> + </relation> + <relation type="one-nofk" rel-entity-name="RoleType"> + <key-map field-name="roleTypeId"/> + </relation> + </view-entity> + <view-entity entity-name="WorkEffortPartyAssignAndRoleType" + package-name="org.ofbiz.workeffort.workeffort" title="Work Effort Party Assignment And Roletype"> <description>To be able to have a dropdown listing with all roles a party has on this workeffort.</description> <member-entity entity-alias="WEPA" entity-name="WorkEffortPartyAssignment"/> 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=799200&r1=799199&r2=799200&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 Thu Jul 30 08:31:54 2009 @@ -50,7 +50,6 @@ import org.ofbiz.entity.condition.EntityJoinOperator; import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.model.ModelEntity; -import org.ofbiz.entity.model.ModelField; import org.ofbiz.entity.util.EntityListIterator; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.security.Security; @@ -350,14 +349,27 @@ return resultMap; } - private static List<EntityCondition> getDefaultWorkEffortExprList(Collection<String> partyIds, String facilityId, String fixedAssetId, String workEffortTypeId) { + private static List<EntityCondition> getDefaultWorkEffortExprList(Collection<String> partyIds, String facilityId, String fixedAssetId, String workEffortTypeId, List<EntityCondition> cancelledCheckAndList) { List<EntityCondition> entityExprList = UtilMisc.<EntityCondition>toList(EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_CANCELLED"), EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "PRUN_CANCELLED")); List<EntityExpr> typesList = FastList.newInstance(); if (UtilValidate.isNotEmpty(workEffortTypeId)) { typesList.add(EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, workEffortTypeId)); } if (UtilValidate.isNotEmpty(partyIds)) { - entityExprList.add(EntityCondition.makeCondition("partyId", EntityOperator.IN, partyIds)); + // (non cancelled) public events, with a startdate + List<EntityCondition> publicEvents = UtilMisc.<EntityCondition>toList( + EntityCondition.makeCondition("scopeEnumId", EntityOperator.EQUALS, "WES_PUBLIC"), + EntityCondition.makeCondition("parentTypeId", EntityOperator.EQUALS, "EVENT") + ); + + if (cancelledCheckAndList != null) { + publicEvents.addAll(cancelledCheckAndList); + } + entityExprList.add( + EntityCondition.makeCondition(UtilMisc.toList( + EntityCondition.makeCondition("partyId", EntityOperator.IN, partyIds), + EntityCondition.makeCondition(publicEvents, EntityJoinOperator.AND) + ), EntityJoinOperator.OR)); } if (UtilValidate.isNotEmpty(facilityId)) { entityExprList.add(EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, facilityId)); @@ -501,16 +513,17 @@ } } - List<EntityCondition> entityExprList = UtilGenerics.checkList(context.get("entityExprList")); - if (entityExprList == null) { - entityExprList = getDefaultWorkEffortExprList(partyIds, facilityId, fixedAssetId, workEffortTypeId); - } - // cancelled status id's List<EntityCondition> cancelledCheckAndList = UtilMisc.<EntityCondition>toList( EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "EVENT_CANCELLED"), EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_CANCELLED")); + + List<EntityCondition> entityExprList = UtilGenerics.checkList(context.get("entityExprList")); + if (entityExprList == null) { + entityExprList = getDefaultWorkEffortExprList(partyIdsToUse, facilityId, fixedAssetId, workEffortTypeId, cancelledCheckAndList); + } + // should have at least a start date EntityCondition startDateRequired = EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList( EntityCondition.makeCondition("estimatedStartDate", EntityOperator.NOT_EQUAL, null), @@ -559,20 +572,9 @@ recurringEvents.addAll(cancelledCheckAndList); } - // (non cancelled) public events, with a startdate - List<EntityCondition> publicEvents = UtilMisc.<EntityCondition>toList( - EntityCondition.makeCondition("scopeEnumId", EntityOperator.EQUALS, "WES_PUBLIC"), - startDateRequired - ); - - if (filterOutCanceledEvents.booleanValue()) { - publicEvents.addAll(cancelledCheckAndList); - } - EntityCondition eclTotal = EntityCondition.makeCondition(UtilMisc.toList( EntityCondition.makeCondition(entityExprList, EntityJoinOperator.AND), - EntityCondition.makeCondition(recurringEvents, EntityJoinOperator.AND), - EntityCondition.makeCondition(publicEvents, EntityJoinOperator.AND) + EntityCondition.makeCondition(recurringEvents, EntityJoinOperator.AND) ), EntityJoinOperator.OR); List<String> orderByList = UtilMisc.toList("estimatedStartDate"); @@ -580,13 +582,8 @@ try { List<GenericValue> tempWorkEfforts = null; if (UtilValidate.isNotEmpty(partyIdsToUse)) { - EntityConditionList<EntityCondition> ecl = - EntityCondition.makeCondition(UtilMisc.toList( - eclTotal, - EntityCondition.makeCondition("partyId", EntityOperator.IN, partyIdsToUse) - ), EntityJoinOperator.AND); - // Debug.log("=====conditions for party: " + ecl); - tempWorkEfforts = EntityUtil.filterByDate(delegator.findList("WorkEffortAndPartyAssign", ecl, null, orderByList, null, false)); + Debug.log("=====conditions for party: " + eclTotal); + tempWorkEfforts = EntityUtil.filterByDate(delegator.findList("WorkEffortAndPartyAssignAndType", eclTotal, null, orderByList, null, false)); } else if (UtilValidate.isNotEmpty(fixedAssetId)) { EntityConditionList<EntityCondition> ecl = EntityCondition.makeCondition(UtilMisc.toList( |
Free forum by Nabble | Edit this page |