I have been working the civinode's API. Currently I have a test module that when you view its page, the current user is added to a specific group. When I pass the valid group_id and contact_id to civinode_add_contact_to_group(), it returns an error in the SQL in CiviNode_LL_getContactGroup():
Database Error Code: Unknown column 'civicrm_contact.id' in 'where clause', 1054
I believe it's the table name that is in error. When switched to civicrm_group_contact.id, the call to CiviNode_LL_getContactGroup() works without error.
I have attached patch for review. This is my first patch, so if I did something wrong or didn't explain it well enough, please let me know!
Comments
Comment #1
Torenware commentedrobeano,
Thanks for your patch. Good news and bad news: the good news is that you are right, the function is clearly broken, and your patch makes the error message go away. The bad news is that the patch doesn't really fix the function ;-)
The id field of most CiviCRM tables, including civicrm_group_contact, is just a unique ID. What the code *should* be doing is do a select on the contact_id field of the table.
I'm enclosing a patch that does what you really want.
I'm going to check this into the 5.x and 4.7 branches, since as I said, it's a good catch on finding this bug.
Thanks,
Rob
Comment #2
Torenware commentedPatch applied to HEAD and 4.7 and 5.x branches.
Comment #3
robeano commentedWell Shoot! I'm still learning this CiviCRM thing. At least I figured out one part of it. :)
I applied your patch and it is working.
Thanks,
Robin
Comment #4
(not verified) commented