CRM
CRM copied to clipboard
Group Member Properties Editor issues:
edit a person's group properties via GroupPropsEditor.php?GroupID=13&PersonID=670
- Date type does not show calendar picker
- save does not save
@crossan007 looks like when we converted the add person to group API we did not add the user to the custom group table
see
$this->post('/{groupID:[0-9]+}/adduser/{userID:[0-9]+}', function ($request, $response, $args) {
$groupID = $args['groupID'];
$userID = $args['userID'];
$group = GroupQuery::create()->findOneById($groupID);
$p2g2r = new ChurchCRM\Person2group2roleP2g2r();
$p2g2r->setGroupId($groupID);
$p2g2r->setPersonId($userID);
$p2g2r->setRoleId($group->getDefaultRole());
$p2g2r->save();
$members = ChurchCRM\Person2group2roleP2g2rQuery::create()
->joinWithPerson()
->filterByPersonId($userID)
->findByGroupId($groupID);
echo $members->toJSON();
});
vs
function addUserToGroup($iGroupID, $iPersonID, $iRoleID)
{
requireUserGroupMembership("bManageGroups");
//
// Adds a person to a group with specified role.
// Returns false if the operation fails. (such as person already in group)
//
global $cnInfoCentral;
// Was a RoleID passed in?
if ($iRoleID == 0) {
// No, get the Default Role for this Group
$sSQL = "SELECT grp_DefaultRole FROM group_grp WHERE grp_ID = " . $iGroupID;
$rsRoleID = RunQuery($sSQL);
$Row = mysql_fetch_row($rsRoleID);
$iRoleID = $Row[0];
}
$sSQL = "INSERT INTO person2group2role_p2g2r (p2g2r_per_ID, p2g2r_grp_ID, p2g2r_rle_ID) VALUES (" . $iPersonID . ", " . $iGroupID . ", " . $iRoleID . ")";
$result = RunQuery($sSQL, false);
if ($result) {
// Check if this group has special properties
$sSQL = "SELECT grp_hasSpecialProps FROM group_grp WHERE grp_ID = " . $iGroupID;
$rsTemp = RunQuery($sSQL);
$rowTemp = mysql_fetch_row($rsTemp);
$bHasProp = $rowTemp[0];
if ($bHasProp == 'true') {
$sSQL = "INSERT INTO groupprop_" . $iGroupID . " (per_ID) VALUES ('" . $iPersonID . "')";
RunQuery($sSQL);
}
}
return $this->getGroupMembers($iGroupID, $iPersonID);
}
we need a way to do the following with ORM as right now we can't support group properties or on we can move that logic to the set prop section and not create the data unless it is needed which is what i think i rather do.
if ($bHasProp == 'true') {
$sSQL = "INSERT INTO groupprop_" . $iGroupID . " (per_ID) VALUES ('" . $iPersonID . "')";
RunQuery($sSQL);
}
I propose this:
- Abandon the idea of having a separate table for every group that has specific properties
- Create a column in the group table. the column will contain a JSON blob containing what properties are enabled / set for that group
- Create a column in the person2group2role table that contains a JSON blob for each person's group specific properties.
We could use the MySQL JSON column type: https://dev.mysql.com/doc/refman/5.7/en/json.html
I like it less strange db mapping
I won't have time to build it by this Sunday though. Probably include with 2.3.0. At end of October.
ok we will know that it is broken in 2.2.3 for now
or we can have a 2.2.4 with just that
It will be a db change. Should we increment to 2.3 anyway? Just sooner?
Let's do that after in done with self registration
tracking this in https://github.com/ChurchCRM/CRM/tree/1092_group_specific_properties
Probably won't be done by end of month though.
@crossan007 is that branch is still active?
Date picker works...
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 15 days with no activity.