Skip to content

Category Report: "Duration of Memberships" column does not list roles with multiple memberships (past and present membership) #1867

@kainhofer

Description

@kainhofer

Describe the bug
In the category report the "Duration of membership" column should list the duration of ALL current memberships. If a user was member of a role some time in the past, and then became a member of that role for a second time, that current role will not be included in the durations.

To Reproduce
Steps to reproduce the behavior:

  1. set up a category report config with the "Duration of membership" (internal ID "ddummy") content
  2. Add/modify a user so they had a role assigned in the past with an end date, and a second role membership of the same role, which is still valid
  3. Create the corresponding category report
  4. See error: The "Role: ..." column type (rNN type) will list the user as a member, the "Role memberships" (a type) will show the user as a member, but the "Duration of membership" (ddummy type) column will not list that role membership.
    Expected behavior
    The role membership of the role with a past and a present membership should be included.

Screenshots

Image Image

System (please complete the following information):

  • Admidio-Version: git master

Cause of the problem
Cause of the problem is that the category report uses direct sql statements to check role memberships (so the rNN and a types are correct), but to extract membership data, it calls
$membership->readDataByColumns(array('mem_rol_id' => $rol_id, 'mem_usr_id' => $member));
which is documented to return false if two or more DB entries with the role and user id are found.

Unfortunately, I could not find any method in the User, Membership or Entity classes that could deal with double entries or is based on the mem_id as opposed to the (non-unique) combination or rol_id and usr_id.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions