From fa99376e69e09f285423e05551c1916a7bc61364 Mon Sep 17 00:00:00 2001 From: Hans Bakker Date: Thu, 27 Oct 2011 09:46:18 +0000 Subject: [PATCH] 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 --- .../org/ofbiz/humanres/HumanResEvents.java | 25 +++++++++++++++---- .../widget/forms/EmplPositionForms.xml | 7 +++++- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/applications/humanres/src/org/ofbiz/humanres/HumanResEvents.java b/applications/humanres/src/org/ofbiz/humanres/HumanResEvents.java index 559003ae2e..a5fcf353c0 100644 --- a/applications/humanres/src/org/ofbiz/humanres/HumanResEvents.java +++ b/applications/humanres/src/org/ofbiz/humanres/HumanResEvents.java @@ -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 childOfEmpls = delegator.findByAnd("EmplPosition", UtilMisc.toMap( - "partyId", partyId)); - if (UtilValidate.isNotEmpty(childOfEmpls)) { - for (GenericValue childOfEmpl : childOfEmpls ) { - Map emplMap = FastMap.newInstance(); + List exprs = FastList.newInstance(); + exprs.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId)); + exprs.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "EMPL_POS_INACTIVE")); + + List 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(); diff --git a/applications/humanres/widget/forms/EmplPositionForms.xml b/applications/humanres/widget/forms/EmplPositionForms.xml index b3bf8feb52..57df3894d4 100644 --- a/applications/humanres/widget/forms/EmplPositionForms.xml +++ b/applications/humanres/widget/forms/EmplPositionForms.xml @@ -65,7 +65,7 @@ under the License. - + @@ -303,6 +303,11 @@ under the License.
+ + + + +