[jira] [Commented] (OFBIZ-10510) Employee names appear as "Null" in company tree.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-10510) Employee names appear as "Null" in company tree.

Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-10510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16603882#comment-16603882 ]

Shantanu commented on OFBIZ-10510:
----------------------------------

[~deepak.nigam]
I've solved this issue, there was a bug in the code.
in HumanResEvents.java I made some changes in this method.

private static List<Map<String, Object>> getCurrentEmployeeDetails(Map<String, Object> params) throws GenericEntityException
    {
        Delegator delegator = (Delegator) params.get("delegator");
        String partyId = (String) params.get("partyId");
        String onclickFunction = (String) params.get("onclickFunction");
        String additionParam = (String) params.get("additionParam");
        String hrefString = (String) params.get("hrefString");
        String hrefString2 = (String) params.get("hrefString2");

        List<Map<String, Object>> responseList = new ArrayList<>();

        long emplPosCount;
        try {
            emplPosCount = EntityQuery.use(delegator).from("EmplPosition")
                    .where("emplPositionId", partyId).queryCount();
            if (emplPosCount > 0) {
                String emplId = partyId;
                // Changes Get data by partyId => memberId
                List<GenericValue> emlpfillCtxs = EntityQuery.use(delegator).from("EmplPositionFulfillment")
                        .where("emplPositionId", emplId)
                        .filterByDate().queryList();
                if (UtilValidate.isNotEmpty(emlpfillCtxs)) {
                    for (GenericValue emlpfillCtx : emlpfillCtxs ) {
                        String memberId = emlpfillCtx.getString("partyId");
                        GenericValue memCtx = EntityQuery.use(delegator).from("Person").where("partyId", memberId).queryOne();
                        String title = "Abc"; //debugging
                        if (UtilValidate.isNotEmpty(memCtx)) {
                            String firstname = memCtx.getString("firstName");
                            String lastname = memCtx.getString("lastName");
                            if (UtilValidate.isEmpty(lastname)) {
                                lastname = "";
                            }
                            if (UtilValidate.isEmpty(firstname)) {
                                firstname = "";
                            }
                            title = firstname +" "+ lastname;
                        }
                        GenericValue memGroupCtx = EntityQuery.use(delegator).from("PartyGroup").where("partyId", partyId).queryOne();
                        if (UtilValidate.isNotEmpty(memGroupCtx)) {
                            title = memGroupCtx.getString("groupName");
                        }

                        Map<String,Object> josonMap = new HashMap<String, Object>();
                        Map<String,Object> dataMap = new HashMap<String, Object>();
                        Map<String,Object> dataAttrMap = new HashMap<String, Object>();
                        Map<String,Object> attrMap = new HashMap<String, Object>();

                        dataAttrMap.put("onClick", onclickFunction + "('" + memberId + additionParam + "')");

                        String hrefStr = hrefString + memberId;
                        if (UtilValidate.isNotEmpty(hrefString2)) {
                            hrefStr = hrefStr + hrefString2;
                        }
                        dataAttrMap.put("href", hrefStr);

                        attrMap.put("rel", "P");
                        attrMap.put("id", memberId);

                        dataMap.put("title", title);
                        dataMap.put("attr", dataAttrMap);

                        josonMap.put("attr",attrMap);
                        josonMap.put("data", dataMap);

                        responseList.add(josonMap) ;
                    }
                }
            }
        } catch (GenericEntityException e) {
            e.printStackTrace();
            throw new GenericEntityException(e);
        }

        return responseList;
    }



> Employee names appear as "Null" in company tree.
> ------------------------------------------------
>
>                 Key: OFBIZ-10510
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-10510
>             Project: OFBiz
>          Issue Type: Bug
>          Components: humanres
>    Affects Versions: 16.11.04
>            Reporter: Shantanu
>            Priority: Blocker
>              Labels: beginner, newbie, starter
>         Attachments: Company Tree.jpg, Employee Profile.jpg
>
>
> I've created a sample Internal Organisation called "New Department".
> Made a position within it called "New Postion".
> Then created an Employee named "Adi Singh" and added him the "New Postion" and Employed in "New Department"
> But in the company tree the name of employee appears as Null.
> Please help.
> I've attached two images showing the issues.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)