* Enh #5169: Enable more than 50 groups to a user

* - Enh #5049: Required profile field should not be required in administration (Fix for checkbox field type)
This commit is contained in:
Marc Farré 2021-07-21 11:16:09 +02:00 committed by GitHub
parent 91d4b03b7a
commit 9b47fee4d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -4,6 +4,7 @@
- Fix #5174: Tour module crashes with enabled tags field - Fix #5174: Tour module crashes with enabled tags field
- Fix #5176: Closing the action confirmation modal window on top close icon - Fix #5176: Closing the action confirmation modal window on top close icon
- Fix #5177: Move directory widgets - Fix #5177: Move directory widgets
- Enh #5049: Required profile field should not be required in administration (Fix for checkbox field type)
1.9.0-beta.2 (July 14, 2021) 1.9.0-beta.2 (July 14, 2021)

View File

@ -8,6 +8,7 @@
namespace humhub\modules\user\models\fieldtype; namespace humhub\modules\user\models\fieldtype;
use humhub\modules\user\models\Profile;
use Yii; use Yii;
/** /**
@ -29,7 +30,7 @@ class Checkbox extends BaseType
/** /**
* Rules for validating the Field Type Settings Form * Rules for validating the Field Type Settings Form
* *
* @return type * @return array
*/ */
public function rules() public function rules()
{ {
@ -41,7 +42,7 @@ class Checkbox extends BaseType
/** /**
* Returns Form Definition for edit/create this field. * Returns Form Definition for edit/create this field.
* *
* @return Array Form Definition * @return array Form Definition
*/ */
public function getFormDefinition($definition = []) public function getFormDefinition($definition = [])
{ {
@ -81,8 +82,8 @@ class Checkbox extends BaseType
/** /**
* Returns the Field Rules, to validate users input * Returns the Field Rules, to validate users input
* *
* @param type $rules * @param array $rules
* @return type * @return array rules
*/ */
public function getFieldRules($rules = []) public function getFieldRules($rules = [])
{ {
@ -92,7 +93,7 @@ class Checkbox extends BaseType
if (!$this->$attribute) { if (!$this->$attribute) {
$this->addError($attribute, Yii::t('UserModule.profile', '{attribute} is required!', ['{attribute}' => $profileField->title])); $this->addError($attribute, Yii::t('UserModule.profile', '{attribute} is required!', ['{attribute}' => $profileField->title]));
} }
}]; }, 'except' => Profile::SCENARIO_EDIT_ADMIN];
} else { } else {
$rules[] = [$profileField->internal_name, 'in', 'range' => [0, 1]]; $rules[] = [$profileField->internal_name, 'in', 'range' => [0, 1]];
} }
@ -126,4 +127,4 @@ class Checkbox extends BaseType
return $value; return $value;
} }
} }