on 2018 Jun 20 3:36 PM
Hi!
We're trying to use the Hybris DefaultB2BApproverFacade to find a list of approvers in the approval process, by using the getPagedApproversForUnit method. This method takes a unitUid as parameter, which we assumed would be used for filtering in the query. However, the result of the query seems to ignore this unitUid and returns approvers that exist in every unit that we have. Digging a bit further into the API, we found that the query is performed in the DefaultPagedB2BCustomerDao in the findPagedApproversForUnitByGroupMembership method:
final List<SortQueryData> sortQueries = Arrays.asList(
createSortQueryData("byName", FIND_B2BCUSTOMERS_IN_DESIRED_GROUPS + OR_B2BUNIT_MEMBERS + ORDERBY_CUSTOMER_NAME),
createSortQueryData("byUnit", FIND_B2BCUSTOMERS_IN_DESIRED_GROUPS + OR_B2BUNIT_MEMBERS + ORDERBY_UNIT_NAME));
And these queries look like such:
FIND_B2BCUSTOMERS_IN_DESIRED_GROUPS = "SELECT DISTINCT {b2bcustomer:pk},"
+ " {b2bcustomer:name} as CustomerName, {b2bunit:name} as UnitName FROM { B2BCustomer AS b2bcustomer"
+ " JOIN PrincipalGroupRelation AS b2bunitrelation ON {b2bunitrelation:source} = {b2bcustomer:pk}"
+ " JOIN B2BUnit AS b2bunit ON {b2bunit:pk} = {b2bunitrelation:target}"
+ " JOIN PrincipalGroupRelation AS desiredgrouprelations ON {desiredgrouprelations:source} = {b2bcustomer:pk}"
+ " JOIN UserGroup AS desiredgroups ON {desiredgroups:pk} = {desiredgrouprelations:target}}"
+ " WHERE {desiredgroups:uid} IN (?usergroups)";
OR_B2BUNIT_MEMBERS = " OR {b2bunit:uid} = ?unit ";
From the name getPagedApproversForUnit we would assume that the query would filter so that we get approvers that exist in the given unit.
Is there a reason to why the query gives ALL the approvers, or is it just plain wrong?
Request clarification before answering.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.