Closed (fixed)
Project:
Open Atrium
Version:
7.x-2.19
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
17 Feb 2015 at 17:05 UTC
Updated:
4 Mar 2015 at 19:24 UTC
Jump to comment: Most recent
See function oa_teams_remove_member($team, $uid), oa_teams.module line 166
$wrapper->{OA_TEAM_USERS_FIELD}->set($users);
$wrapper->save();If $users is an empty array, this will cause an exception in profiles/openatrium/contrib/entity/includes/entity.wrapper.inc, line 122.
Including error handling, I believe lines 166 and 167 should be changed to:
try {
if (empty($users)) {
$wrapper->{OA_TEAM_USERS_FIELD}[0]->set(NULL);
} else {
$wrapper->{OA_TEAM_USERS_FIELD}->set($users);
}
$wrapper->save();
} catch (EntityMetadataWrapperException $exc) {
// error handling
}I opened the bug against 2.19, which is where I'm seeing this, but the code is the same in latest.
Comments
Comment #1
mpotter commentedThe actual problem here is that the Users field of a Team is a *required* field in Drupal, so Drupal doesn't allow it to be empty. Just wrapping it with the exception handler doesn't change that issue. The correct way to fix this will be to make the users list optional, which I'll look into.
Comment #2
mpotter commentedCommitted fix to 38fedbb. Will require reverting the oa_teams feature to change the required setting on the field.