From: Raphaël Barrois Date: Tue, 18 May 2010 15:42:59 +0000 (+0200) Subject: Add option for checking unknown emails for axletter X-Git-Tag: xorg/1.0.0~249^2~2 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=813c44f70e287306c02d422c15eabd36067cb69e;p=platal.git Add option for checking unknown emails for axletter And fixes a bug in email to uid mapping Signed-off-by: Raphaël Barrois --- diff --git a/include/emails.inc.php b/include/emails.inc.php index cd7e0a0..c1fd715 100644 --- a/include/emails.inc.php +++ b/include/emails.inc.php @@ -151,7 +151,7 @@ function ids_from_mails(array $emails) WHERE email IN ($list)"); foreach ($res->fetchAllRow() as $row) { list ($email, $uid) = $row; - $uids[$other_mails[$email]] = $uid; + $uids[$email] = $uid; } } diff --git a/modules/axletter.php b/modules/axletter.php index 9eb253a..a890702 100644 --- a/modules/axletter.php +++ b/modules/axletter.php @@ -153,6 +153,23 @@ class AXLetterModule extends PLModule } switch (@Post::v('valid')) { + case 'Vérifier': + // Same as 'preview', but performs a test of all provided emails + if ($subset) { + require_once 'emails.inc.php'; + $ids = ids_from_mails($subset_to); + $has_error = false; + foreach ($subset_to as $e) { + if (!array_key_exists($e, $ids)) { + if (!$has_error) { + $page->trigError("Emails inconnus :"); + $has_error = true; + } + $page->trigError($e); + } + } + } + // XXX : no break here, since Vérifier is a subcase of Aperçu. case 'Aperçu': $this->load('axletter.inc.php'); $al = new AXLetter(array($id, $short_name, $subject, $title, $body, $signature, diff --git a/templates/axletter/edit.tpl b/templates/axletter/edit.tpl index eeb4f72..914b565 100644 --- a/templates/axletter/edit.tpl +++ b/templates/axletter/edit.tpl @@ -109,6 +109,9 @@ {/if} + {if $subset} + + {/if} {if !$new} {/if}