X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fvalidations%2Fhomonymes.inc.php;h=7f181ef217afb405127300e962537a0e220ae4e4;hb=4371e993d51f10d655c4b453563c730b613b490e;hp=5f3e4d8fdcc593224bdfa052de3600fe7fc7530e;hpb=483da16573717c21c7e6da3eacc094048ab7d72f;p=platal.git diff --git a/include/validations/homonymes.inc.php b/include/validations/homonymes.inc.php index 5f3e4d8..7f181ef 100644 --- a/include/validations/homonymes.inc.php +++ b/include/validations/homonymes.inc.php @@ -1,6 +1,6 @@ warning = $warning; @@ -122,10 +121,24 @@ est ambigu pour des raisons d'homonymie et signalera ton email exact."; public function commit() { Platal::load('admin', 'homonyms.inc.php'); - switch_bestalias($this->user, $this->loginbis); if (!$this->warning) { - XDB::execute("UPDATE aliases SET type = 'homonyme', expire = NOW() WHERE alias = {?}", $this->loginbis); - XDB::execute("REPLACE INTO homonymes (homonyme_id, user_id) VALUES({?}, {?})", $this->user->id(), $this->user->id()); + global $globals; + require_once 'emails.inc.php'; + + XDB::execute('DELETE e + FROM email_source_account AS e + INNER JOIN email_virtual_domains AS d ON (e.domain = d.id) + WHERE e.email = {?} AND d.name = {?}', + $this->loginbis, $globals->mail->domain); + XDB::execute('INSERT INTO email_source_other (hrmid, email, domain, type, expire) + SELECT CONCAT(\'h.\', {?}, \'.\', {?}), {?}, id, \'homonym\', NOW() + FROM email_virtual_domains + WHERE name = {?}', + $this->loginbis, $globals->mail->domain, $this->loginbis, $globals->mail->domain); + XDB::execute('INSERT IGNORE INTO homonyms_list (hrmid, uid) + VALUES ({?}, {?})', + 'h.' . $this->loginbis . '.' . $globals->mail->domain, $this->user->id()); + fix_bestalias($this->user); } return true;