Beispiel #1
0
/**
 * Certain updates to the IE account need to be reflected in the related SugarFolder since they are
 * created automatically.  Only valid for IE accounts with auto import turned on.
 *
 * @param string $fieldName The field name that changed
 * @param SugarBean $focus The InboundEmail bean being saved.
 */
function syncSugarFoldersWithBeanChanges($fieldName, $focus)
{
    $f = new SugarFolder();
    $f->retrieve($focus->groupfolder_id);
    switch ($fieldName) {
        case 'name':
        case 'team_id':
        case 'team_set_id':
            $f->{$fieldName} = $focus->{$fieldName};
            $f->save();
            break;
        case 'status':
            if ($focus->status == 'Inactive') {
                $f->clearSubscriptionsForFolder($focus->groupfolder_id);
            } else {
                if ($focus->mailbox_type != 'bounce') {
                    $f->addSubscriptionsToGroupFolder();
                }
            }
            break;
    }
}