From 2ebe2e686a87338a11602f70ef60851ab5399c81 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Barrois?= Date: Tue, 18 May 2010 17:42:59 +0200 Subject: [PATCH] Add option for checking unknown emails for axletter MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit And fixes a bug in email to uid mapping Signed-off-by: Raphaël Barrois --- include/emails.inc.php | 2 +- modules/axletter.php | 17 +++++++++++++++++ templates/axletter/edit.tpl | 3 +++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/include/emails.inc.php b/include/emails.inc.php index 37582e6..b06df66 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 a664705..2d3761e 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 b1bfe70..23cda37 100644 --- a/templates/axletter/edit.tpl +++ b/templates/axletter/edit.tpl @@ -109,6 +109,9 @@ {/if} + {if $subset} + + {/if} {if !$new} {/if} -- 2.1.4