diff --git a/api/setup/setup.inc.php b/api/setup/setup.inc.php index 381aa71a75..d8b3079ff2 100644 --- a/api/setup/setup.inc.php +++ b/api/setup/setup.inc.php @@ -11,7 +11,7 @@ /* Basic information about this app */ $setup_info['api']['name'] = 'api'; $setup_info['api']['title'] = 'EGroupware API'; -$setup_info['api']['version'] = '17.1.003'; +$setup_info['api']['version'] = '17.1.004'; $setup_info['api']['versions']['current_header'] = '1.29'; // maintenance release in sync with changelog in doc/rpm-build/debian.changes $setup_info['api']['versions']['maintenance_release'] = '17.1.20180831'; diff --git a/api/setup/tables_update.inc.php b/api/setup/tables_update.inc.php index eeb7639a89..faceb9a689 100644 --- a/api/setup/tables_update.inc.php +++ b/api/setup/tables_update.inc.php @@ -453,3 +453,18 @@ function api_upgrade17_1_002() return $GLOBALS['setup_info']['api']['currentver'] = '17.1.003'; } + +/** + * Fix forced preferences with value '' (casted to from false) to '0' eg. addressbook:private_addressbook + * + * Forced preferences with value '' behave unexpected, false values of type "check" need to be written as "0". + * + * @return type + */ +function api_upgrade17_1_003() +{ + Api\Preferences::change_preference(null, '/.*/', '0', '', 'forced'); + + return $GLOBALS['setup_info']['api']['currentver'] = '17.1.004'; +} + diff --git a/setup/inc/class.setup.inc.php b/setup/inc/class.setup.inc.php index 3ef7d460e4..8a888d45c0 100644 --- a/setup/inc/class.setup.inc.php +++ b/setup/inc/class.setup.inc.php @@ -744,11 +744,11 @@ class setup { if (isset($setting['default'])) { - $default[$name] = (string)$setting['default']; + $default[$name] = $setting['default'] === false && $setting['type'] === 'check' ? '0' : (string)$setting['default']; } if (isset($setting['forced'])) { - $forced[$name] = (string)$setting['forced']; + $forced[$name] = $setting['forced'] === false && $setting['type'] === 'check' ? '0' : (string)$setting['forced']; } } // store default/forced preferences, if any found