CRM: Group-specific properties does not add a new record to groupprop_xx table
ChurchCRM 4.4.5.
Browser doesn’t matter.
mysql Ver 15.1 Distrib 10.5.10-MariaDB, for Linux (x86_64).
AWS t2.micro instance with Amazon Linux amzn2-ami-kernel-5.10-hvm-2.0.20220406.1-x86_64-gp2
Apache/2.4.53
PHP 7.4.28
Workflow:
- add people, create a group, put people into the group
- edit group to enable group-specific properties, define at least one property and enable it to be visible on the person view
- attempt to add a value for that new property on one of the group’s members
- there is no error, but no record is created in groupprop_xx
Explanation: The code in GroupPropsEditor.php only does a DB UPDATE. If you added the group property definition after the person was already in the group, there is no record “automatically” added at that time. Subsequently, if you try to edit (really, add) one, it UI functions as expected for that task, but no data is written to the db because it’s only doing an UPDATE. If you manually add an appropriate record to the DB and go try again, the update works fine.
I have done a temporary fix on my installation by adding in the TEMPORARY FIX lines below. This simply checks and if no row has been retrieved, it adds a row, so that the existing logic later on will always find a row to update.
`// First Pass // we are always editing, because the record for a group member was created when they were added to the group // Get the existing data for this group member $sSQL = ‘SELECT * FROM groupprop_’.$iGroupID.’ WHERE per_ID = '.$iPersonID; $rsPersonProps = RunQuery($sSQL);
// TEMPORARY FIX I added this "if statement, and put the existing line inside its “else” clause
if (mysqli_num_rows($rsPersonProps) == 0) {
$sSQL = ‘INSERT into groupprop_’.$iGroupID.’ (per_ID) values (‘.$iPersonID .’)';
RunQuery($sSQL);
}
else {
$aPersonProps = mysqli_fetch_array($rsPersonProps, MYSQLI_BOTH);
}`
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 16 (4 by maintainers)
Yeah sure Sorry I didn’t commit the code as I was busy. I will upload the code tonight
On Sun, 11 Feb 2024, 9:28 am Arun Philip, @.***> wrote: