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

mpotter’s picture

The 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.

mpotter’s picture

Status: Active » Fixed

Committed fix to 38fedbb. Will require reverting the oa_teams feature to change the required setting on the field.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.