Fixed handling of user options without a default value
authorAlexander Ebert <ebert@woltlab.com>
Sat, 15 Dec 2012 21:25:38 +0000 (22:25 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 15 Dec 2012 21:25:38 +0000 (22:25 +0100)
wcfsetup/install/files/lib/data/user/option/UserOptionEditor.class.php
wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php

index f38a366a5df444d1f9bef48b08dab398e8fa2779..e9ee004415d72a6a2740bb00a27cfcaa22242ccd 100644 (file)
@@ -29,7 +29,7 @@ class UserOptionEditor extends DatabaseObjectEditor {
                WCF::getDB()->getEditor()->addColumn('wcf'.WCF_N.'_user_option_value', 'userOption'.$userOption->optionID, self::getColumnDefinition($parameters['optionType']));
                
                // add the default value to this column
-               if (isset($parameters['defaultValue'])) {
+               if (isset($parameters['defaultValue']) && $parameters['defaultValue'] !== null) {
                        $sql = "UPDATE  wcf".WCF_N."_user_option_value
                                SET     userOption".$userOption->optionID." = ?";
                        $statement = WCF::getDB()->prepareStatement($sql);
index 856c793df9ee6e11a2239f4e706ab76abc2becc0..213ee90a2ca7210439fd15df0b386b6e8548c6ba 100644 (file)
@@ -62,9 +62,9 @@ class UserOptionPackageInstallationPlugin extends AbstractOptionPackageInstallat
         */
        protected function saveOption($option, $categoryName, $existingOptionID = 0) {
                // default values
-               $optionName = $optionType = $defaultValue = $validationPattern = $outputClass = $selectOptions = $enableOptions = $permissions = $options = '';
+               $optionName = $optionType = $validationPattern = $outputClass = $selectOptions = $enableOptions = $permissions = $options = '';
                $required = $editable = $visible = $searchable = $disabled = $askDuringRegistration = 0;
-               $showOrder = null;
+               $defaultValue = $showOrder = null;
                
                // get values
                if (isset($option['name'])) $optionName = $option['name'];