Details
- 
    Type:
Bug
 - 
    Status: Open
 - 
    Priority:
Major
 - 
    Resolution: Unresolved
 - 
    Affects Version/s: 4.7.17
 - 
    Fix Version/s: None
 - 
    Component/s: CiviCRM API
 - 
    Labels:None
 
- 
        Versioning Impact:Patch (backwards-compatible bug fixes)
 - 
        Documentation Required?:Developer Doc
 - 
        Funding Source:Needs Funding
 - 
        Verified?:No
 
Description
If the status of a profile in CivICRM is toggled from being is_reserved, CiviCRM also UNSETS the other attributes for the Profile.
To repeat:
- Query the CiviCRM Profile parameters, eg. is_active flag.
 - Issue command: wp cv api UFGroup.create id=17 is_reserved=0
 - Check is_active flag, it is now unset
 
This causes Profile attributes to be inadvertently removed, profiles marked inactive etc. and a whole lot of issues.
From Eileen McNaughton on mattermost https://chat.civicrm.org/civicrm/pl/q6fohgkak38zdp5xr318oo6ffc
 looks like a bug UFGroup::add starts like this:
public static function add(&$params, $ids = array()) { $fields = array( 'is_active', 'add_captcha', 'is_map', 'is_update_dupe', 'is_edit_link', 'is_uf_link', 'is_cms_user', ); foreach ($fields as $field) { $params[$field] = CRM_Utils_Array::value($field, $params, FALSE); }
those params should ONLY set when id is not present in $params & should not be required really - db defaults make more sense
Agileware Reference SUP-718