diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/CoreController.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/CoreController.php
index 73e03010..e365fbed 100644
--- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/CoreController.php
+++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/CoreController.php
@@ -102,8 +102,19 @@ class CoreController extends Controller
}
}
}
+
+ // Si niveau01 commence par autre = alors niveau01other obligatoire
+ $message="";
+ $niveau01=strtolower($user->getNiveau01()->getLabel());
+ if(stripos($niveau01,"autre")===0) {
+ if(!$user->getNiveau01other()) {
+ $toprofil=true;
+ $message="
Merci d'indiquer votre ".$this->getParameter("labelniveau01");
+ }
+ }
+
if($toprofil) {
- return $this->redirect($this->generateUrl('cadoles_core_user',array("info"=>"Merci de compléter votre profil")));
+ return $this->redirect($this->generateUrl('cadoles_core_user',array("info"=>"Merci de compléter votre profil".$message)));
}
}
diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/RegistrationController.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/RegistrationController.php
index bdbbf465..7e5a3a90 100755
--- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/RegistrationController.php
+++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/RegistrationController.php
@@ -159,7 +159,7 @@ class RegistrationController extends Controller
$action,
$data->getUsername(),
$data->getEmail(),
- $data->getNiveau01()->getLabel(),
+ $data->getNiveau01()->getLabel()."
".$data->getNiveau01other(),
$data->getStatut()->getLabel(),
(is_null($data->getKeyexpire())?"":$data->getKeyexpire()->format('d/m/Y H:i:s'))
));
@@ -859,6 +859,14 @@ class RegistrationController extends Controller
if($this->getUserBy("username",$data->getUsername())||$this->getUserBy("email",$data->getEmail())) {
$form->addError(new FormError('Un utilisateur utilise déjà ce login ou cet email'));
}
+
+ // Si niveau01 commence par autre = niveau01other obligatoire
+ $niveau01=strtolower($data->getNiveau01()->getLabel());
+ if(stripos($niveau01,"autre")===0) {
+ if(!$data->getNiveau01other()) {
+ $form->addError(new FormError("Merci d'indiquer votre ".$this->getParameter("labelniveau01")));
+ }
+ }
}
if ($form->get('submit')->isClicked() && !$form->isValid()) {
diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/UserController.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/UserController.php
index 5f14647d..ceb21eaf 100644
--- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/UserController.php
+++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/UserController.php
@@ -303,7 +303,7 @@ class UserController extends Controller
array_push($tmp,$data->getFirstname());
array_push($tmp,"".$data->getEmail()."");
array_push($tmp,$data->getTelephonenumber());
- array_push($tmp,$data->getNiveau01()->getLabel());
+ array_push($tmp,$data->getNiveau01()->getLabel()."
".$data->getNiveau01other());
if($viewniveau02) array_push($tmp,($data->getNiveau02()!==null?$data->getNiveau02()->getLabel():""));
array_push($tmp,$groups);
array_push($tmp,$data->getJob());
@@ -1262,6 +1262,14 @@ class UserController extends Controller
if($this->getRegistrationBy("username",$data->getUsername())||$this->getRegistrationBy("email",$data->getEmail())) {
$form->addError(new FormError('Une inscription utilise déjà ce login ou cet email'));
}
+
+ // Si niveau01 commence par autre = niveau01other obligatoire
+ $niveau01=strtolower($data->getNiveau01()->getLabel());
+ if(stripos($niveau01,"autre")===0) {
+ if(!$data->getNiveau01other()) {
+ $form->addError(new FormError("Merci d'indiquer votre ".$this->getParameter("labelniveau01")));
+ }
+ }
}
diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/Registration.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/Registration.php
index 585473b2..5fb07eb6 100644
--- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/Registration.php
+++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/Registration.php
@@ -123,6 +123,11 @@ class Registration implements UserInterface, \Serializable
*/
private $position;
+ /**
+ * @ORM\Column(type="string", length=150, nullable=true)
+ */
+ private $niveau01other;
+
/**
* @ORM\Column(type="integer", length=60, nullable=true)
*/
@@ -738,4 +743,28 @@ class Registration implements UserInterface, \Serializable
{
return $this->groupid;
}
+
+ /**
+ * Set niveau01other
+ *
+ * @param string $niveau01other
+ *
+ * @return Registration
+ */
+ public function setNiveau01other($niveau01other)
+ {
+ $this->niveau01other = $niveau01other;
+
+ return $this;
+ }
+
+ /**
+ * Get niveau01other
+ *
+ * @return string
+ */
+ public function getNiveau01other()
+ {
+ return $this->niveau01other;
+ }
}
diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/User.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/User.php
index ff193744..2006ebd8 100644
--- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/User.php
+++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/User.php
@@ -173,6 +173,11 @@ class User implements UserInterface, \Serializable
*/
private $visitecpt;
+ /**
+ * @ORM\Column(type="string", length=150, nullable=true)
+ */
+ private $niveau01other;
+
/**
* @ORM\ManyToOne(targetEntity="Country", inversedBy="users")
* @ORM\JoinColumn(nullable=true)
@@ -1854,4 +1859,28 @@ class User implements UserInterface, \Serializable
{
return $this->visitecpt;
}
+
+ /**
+ * Set niveau01other
+ *
+ * @param string $niveau01other
+ *
+ * @return User
+ */
+ public function setNiveau01other($niveau01other)
+ {
+ $this->niveau01other = $niveau01other;
+
+ return $this;
+ }
+
+ /**
+ * Get niveau01other
+ *
+ * @return string
+ */
+ public function getNiveau01other()
+ {
+ return $this->niveau01other;
+ }
}
diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/RegistrationType.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/RegistrationType.php
index 2b3e2a85..18d12520 100644
--- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/RegistrationType.php
+++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/RegistrationType.php
@@ -76,10 +76,21 @@ class RegistrationType extends AbstractType
EntityType::class,
array("class" => "CadolesCoreBundle:Niveau01",
"label" => $session->get('labelniveau01'),
+ 'placeholder' => '== Choisir '.$session->get('labelniveau01').' ==',
"choice_label" => "label",
- "disabled" => ($options["mode"]=="delete"?true:false),
+ "disabled" => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px","readonly" => ($options["mode"]=="delete"?true:false))));
+
+ $builder->add('niveau01other',
+ TextType::class, array(
+ "label" =>"Autre ".$session->get('labelniveau01'),
+ "disabled" => ($options["mode"]=="delete"?true:false),
+ "required" => false,
+ "attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
+ )
+ );
+
# Password
if($options["mode"]!="delete"&&$options["mode"]!="send") {
$builder->add('password',
diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/UserType.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/UserType.php
index 6820d2c5..a787af90 100644
--- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/UserType.php
+++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/UserType.php
@@ -84,6 +84,7 @@ class UserType extends AbstractType
EntityType::class,
array("class" => "CadolesCoreBundle:Niveau01",
"label" => $session->get('labelniveau01'),
+ 'placeholder' => '== Choisir '.$session->get('labelniveau01').' ==',
"choice_label" => "label",
"query_builder"=> function (EntityRepository $er) use($access,$perm,$userid) {
if($access=="config") {
@@ -102,7 +103,17 @@ class UserType extends AbstractType
},
"disabled" => ($options["mode"]=="delete"||$options["masteridentity"]!="SQL"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px","readonly" => ($options["mode"]=="delete"?true:false))));
-
+
+
+ $builder->add('niveau01other',
+ TextType::class, array(
+ "label" =>"Autre ".$session->get('labelniveau01'),
+ "disabled" => ($options["mode"]=="delete"?true:false),
+ "required" => false,
+ "attr" => array("class" => "form-control", "style" => "margin-bottom:15px")
+ )
+ );
+
if($options["mode"]!="delete"&&$options["masteridentity"]=="SQL") {
$builder->add('password',
RepeatedType::class, array(
diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Registration/edit.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Registration/edit.html.twig
index 53ca6ac7..aec4396a 100755
--- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Registration/edit.html.twig
+++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Registration/edit.html.twig
@@ -105,6 +105,7 @@
{% if form.job is defined %} {{ form_row(form.job) }} {% endif %}
{% if form.position is defined %} {{ form_row(form.position) }} {% endif %}
{{ form_row(form.niveau01) }}
+