mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-10-31 09:18:24 +00:00 
			
		
		
		
	Add an email address ot UserGroup entity
This commit is contained in:
		| @@ -19,6 +19,7 @@ use Doctrine\Common\Collections\ReadableCollection; | ||||
| use Doctrine\Common\Collections\Selectable; | ||||
| use Doctrine\ORM\Mapping as ORM; | ||||
| use Symfony\Component\Serializer\Annotation\DiscriminatorMap; | ||||
| use Symfony\Component\Validator\Constraints as Assert; | ||||
|  | ||||
| #[ORM\Entity] | ||||
| #[ORM\Table(name: 'chill_main_user_group')] | ||||
| @@ -66,6 +67,10 @@ class UserGroup | ||||
|     #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])] | ||||
|     private string $excludeKey = ''; | ||||
|  | ||||
|     #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])] | ||||
|     #[Assert\Email] | ||||
|     private string $email = ''; | ||||
|  | ||||
|     public function __construct() | ||||
|     { | ||||
|         $this->adminUsers = new ArrayCollection(); | ||||
| @@ -187,6 +192,23 @@ class UserGroup | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     public function getEmail(): string | ||||
|     { | ||||
|         return $this->email; | ||||
|     } | ||||
|  | ||||
|     public function setEmail(string $email): self | ||||
|     { | ||||
|         $this->email = $email; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     public function hasEmail(): bool | ||||
|     { | ||||
|         return '' !== $this->email; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Checks if the current object is an instance of the UserGroup class. | ||||
|      * | ||||
|   | ||||
| @@ -15,6 +15,7 @@ use Chill\MainBundle\Form\Type\PickUserDynamicType; | ||||
| use Chill\MainBundle\Form\Type\TranslatableStringFormType; | ||||
| use Symfony\Component\Form\AbstractType; | ||||
| use Symfony\Component\Form\Extension\Core\Type\ColorType; | ||||
| use Symfony\Component\Form\Extension\Core\Type\EmailType; | ||||
| use Symfony\Component\Form\Extension\Core\Type\TextType; | ||||
| use Symfony\Component\Form\FormBuilderInterface; | ||||
|  | ||||
| @@ -34,6 +35,11 @@ class UserGroupType extends AbstractType | ||||
|             ->add('foregroundColor', ColorType::class, [ | ||||
|                 'label' => 'user_group.ForegroundColor', | ||||
|             ]) | ||||
|             ->add('email', EmailType::class, [ | ||||
|                 'label' => 'user_group.Email', | ||||
|                 'help' => 'user_group.EmailHelp', | ||||
|                 'empty_data' => '', | ||||
|             ]) | ||||
|             ->add('excludeKey', TextType::class, [ | ||||
|                 'label' => 'user_group.ExcludeKey', | ||||
|                 'help' => 'user_group.ExcludeKeyHelp', | ||||
|   | ||||
| @@ -0,0 +1,33 @@ | ||||
| <?php | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| /* | ||||
|  * Chill is a software for social workers | ||||
|  * | ||||
|  * For the full copyright and license information, please view | ||||
|  * the LICENSE file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace Chill\Migrations\Main; | ||||
|  | ||||
| use Doctrine\DBAL\Schema\Schema; | ||||
| use Doctrine\Migrations\AbstractMigration; | ||||
|  | ||||
| final class Version20241015142142 extends AbstractMigration | ||||
| { | ||||
|     public function getDescription(): string | ||||
|     { | ||||
|         return 'Add an email address to user groups'; | ||||
|     } | ||||
|  | ||||
|     public function up(Schema $schema): void | ||||
|     { | ||||
|         $this->addSql('ALTER TABLE chill_main_user_group ADD email TEXT DEFAULT \'\' NOT NULL'); | ||||
|     } | ||||
|  | ||||
|     public function down(Schema $schema): void | ||||
|     { | ||||
|         $this->addSql('ALTER TABLE chill_main_user_group DROP COLUMN email'); | ||||
|     } | ||||
| } | ||||
| @@ -69,6 +69,8 @@ user_group: | ||||
|     me_only: Uniquement moi | ||||
|     me: Moi | ||||
|     append_users: Ajouter des utilisateurs | ||||
|     Email: Adresse email du groupe | ||||
|     EmailHelp: Si rempli, des notifications supplémentaires seront envoyées à l'adresse email du groupe (workflow en attente, etc.) | ||||
|  | ||||
| inactive: inactif | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user