From e2529e9e39a5f5be8007814bf29933e474b35dcd Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 24 Jun 2010 07:15:36 +0000 Subject: [PATCH] check if we have a default/forced value from the settings hook, which is NOT stored as default currently --> store it as default, to allow to propagate defaults to existing installations --- preferences/inc/class.bosettings.inc.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/preferences/inc/class.bosettings.inc.php b/preferences/inc/class.bosettings.inc.php index 807cfce649..e3713dfa3a 100644 --- a/preferences/inc/class.bosettings.inc.php +++ b/preferences/inc/class.bosettings.inc.php @@ -111,9 +111,28 @@ $this->settings = array_merge($this->settings,$GLOBALS['settings']); } } + // check if we have a default/forced value from the settings hook, + // which is NOT stored as default currently + // --> store it as default, to allow to propagate defaults to existing installations + if ($appname == 'preferences') $appname = 'common'; + foreach ($this->settings as $name => $data) + { + if ((string)$GLOBALS['egw']->preferences->default[$appname][$name] === '' && + ((string)$data['default'] !== '' || (string)$data['forced'] !== '')) + { + $default = (string)$data['forced'] !== '' ? $data['forced'] : $data['default']; + //echo "

".__METHOD__."($appname) $this->appname/$appname/$name=$default NOT yet set!

\n"; + $GLOBALS['egw']->preferences->default[$appname][$name] = $default; + $need_update = true; + } + } + if ($need_update) + { + $GLOBALS['egw']->preferences->save_repository(false,'default',true); + } if($this->debug) { - // _debug_array($this->settings); + _debug_array($this->settings); } return True; }