only show employ positions in the HR tree which are active: status and from/thru dates

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1189692 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hans Bakker
2011-10-27 09:46:18 +00:00
parent 7f1e47817e
commit fa99376e69
2 changed files with 26 additions and 6 deletions
@@ -32,10 +32,15 @@ import javolution.util.FastMap;
import net.sf.json.JSONObject;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilDateTime;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.condition.EntityCondition;
import org.ofbiz.entity.condition.EntityExpr;
import org.ofbiz.entity.condition.EntityOperator;
import org.ofbiz.entity.util.EntityUtil;
public class HumanResEvents {
@@ -183,11 +188,21 @@ public class HumanResEvents {
}
List<GenericValue> childOfEmpls = delegator.findByAnd("EmplPosition", UtilMisc.toMap(
"partyId", partyId));
if (UtilValidate.isNotEmpty(childOfEmpls)) {
for (GenericValue childOfEmpl : childOfEmpls ) {
Map emplMap = FastMap.newInstance();
List<EntityExpr> exprs = FastList.newInstance();
exprs.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId));
exprs.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "EMPL_POS_INACTIVE"));
List<GenericValue> isEmpls = null;
try {
isEmpls = delegator.findList("EmplPosition", EntityCondition.makeCondition(exprs, EntityOperator.AND), null, null, null, false);
} catch (GenericEntityException e) {
Debug.logError(e, module);
}
isEmpls = EntityUtil.filterByDate(isEmpls, UtilDateTime.nowTimestamp(), "actualFromDate", "actualThruDate", true);
if (UtilValidate.isNotEmpty(isEmpls)) {
for (GenericValue childOfEmpl : isEmpls ) {
Map emplMap = FastMap.newInstance();
Map emplAttrMap = FastMap.newInstance();
Map empldataMap = FastMap.newInstance();
Map emplDataAttrMap = FastMap.newInstance();
@@ -65,7 +65,7 @@ under the License.
<field use-when="emplPosition==null&amp;&amp;emplPositionId!=null" name="emplPositionId" title="${uiLabelMap.HumanResEmplPositionId}" tooltip="${uiLabelMap.CommonCannotBeFound}: [${emplPositionId}]"><display/></field>
<field name="partyId" use-when="emplPosition!=null" parameter-name="partyId" title="organization partyId">
<drop-down allow-empty="false">
<entity-options description="${partyId}" entity-name="PartyRole" key-field-name="partyId">
<entity-options description="${groupName}" entity-name="PartyRoleAndPartyDetail" key-field-name="partyId">
<entity-constraint name="roleTypeId" value="INTERNAL_ORGANIZATIO"/>
<entity-order-by field-name="partyId"/>
</entity-options>
@@ -303,6 +303,11 @@ under the License.
<form name="EmplPositionInfo" type="single" default-map-name="emplPosition" paginate-target="FindEmplPositions"
header-row-style="header-row" default-table-style="basic-table">
<auto-fields-service service-name="updateEmplPosition" default-field-type="display"/>
<field name="partyId"><display-entity entity-name="PartyGroup" description="${groupName}">
<sub-hyperlink target="EmployeeProfile" description="[${emplPosition.partyId}]">
<parameter param-name="partyId" from-field="emplPosition.partyId"/>
</sub-hyperlink>
</display-entity></field>
<field name="emplPositionTypeId"><display-entity entity-name="EmplPositionType" description="${description}">
<sub-hyperlink target="EditEmplPositionTypes" description="[${emplPosition.emplPositionTypeId}]">
<parameter param-name="emplPositionTypeId" from-field="emplPosition.emplPositionTypeId"/>