From 48a4525cd47170501882e38a844d5bd850c08976 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Sat, 26 Jun 2010 00:58:14 +0200 Subject: [PATCH] Prevents multiple nationality from the same country (Closes #1097). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- modules/profile/general.inc.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/profile/general.inc.php b/modules/profile/general.inc.php index c0dcfa8..95bd977 100644 --- a/modules/profile/general.inc.php +++ b/modules/profile/general.inc.php @@ -542,10 +542,22 @@ class ProfileSettingGeneral extends ProfilePage $this->values['nationality3'] = NULL; } if ($this->values['nationality1'] == "") { - $this->values['nationality1'] = $this->values['nationality2']; + $this->values['nationality1'] = $this->values['nationality2']; $this->values['nationality2'] = $this->values['nationality3']; $this->values['nationality3'] = NULL; } + if ($this->values['nationality1'] == $this->values['nationality2'] + && $this->values['nationality2'] == $this->values['nationality3']) { + $this->values['nationality2'] = NULL; + $this->values['nationality3'] = NULL; + } else if ($this->values['nationality1'] == $this->values['nationality2']) { + $this->values['nationality2'] = $this->values['nationality3']; + $this->values['nationality3'] = NULL; + } else if ($this->values['nationality2'] == $this->values['nationality3'] + || $this->values['nationality1'] == $this->values['nationality3']) { + $this->values['nationality3'] = NULL; + } + $new_email = ($this->values['email_directory'] == "new@example.org") ? $this->values['email_directory_new'] : $this->values['email_directory']; if ($new_email == "") { -- 2.1.4