-
-
Notifications
You must be signed in to change notification settings - Fork 150
Description
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:
- set up a category report config with the "Duration of membership" (internal ID "ddummy") content
- 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
- Create the corresponding category report
- 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
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.