From af8e0802f8bd3c7682d1fe6792e8d0cd9f0e654b Mon Sep 17 00:00:00 2001
From: BENKE Charlie <charles.fr@benke.fr>
Date: Sat, 4 Jun 2016 18:15:52 +0200
Subject: [PATCH] fix : login required not verified on update

---
 htdocs/adherents/card.php | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php
index 66de3be2cc5..be81c9b967d 100644
--- a/htdocs/adherents/card.php
+++ b/htdocs/adherents/card.php
@@ -253,7 +253,8 @@ if (empty($reshook))
 		}
 		$lastname=$_POST["lastname"];
 		$firstname=$_POST["firstname"];
-		$morphy=$morphy=$_POST["morphy"];
+		$morphy=$_POST["morphy"];
+		$login=$_POST["login"];
 		if ($morphy != 'mor' && empty($lastname)) {
 			$error++;
 			$langs->load("errors");
@@ -264,7 +265,14 @@ if (empty($reshook))
 			$langs->load("errors");
 			setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Firstname")), null, 'errors');
 		}
-
+		// Test si le login existe deja
+		if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
+		{
+			if (empty($login)) {
+				$error++;
+				setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Login")), null, 'errors');
+			}
+		}
 		// Create new object
 		if ($result > 0 && ! $error)
 		{
-- 
GitLab