$promo_max = Post::i('promo_max');
$subset_to = preg_split("/[ ,;\:\n\r]+/", Post::v('subset_to'), -1, PREG_SPLIT_NO_EMPTY);
$subset = (count($subset_to) > 0);
+ $subset_rm = Post::b('subset_rm');
$echeance = Post::has('echeance_date') ?
preg_replace('/^(\d\d\d\d)(\d\d)(\d\d)$/', '\1-\2-\3', Post::v('echeance_date')) . ' ' . Post::v('echeance_time')
: Post::v('echeance');
case 'Aperçu':
$this->load('axletter.inc.php');
$al = new AXLetter(array($id, $short_name, $subject, $title, $body, $signature,
- $promo_min, $promo_max, $subset, $echeance, 0, 'new'));
+ $promo_min, $promo_max, $subset, $subset_rm, $echeance, 0, 'new'));
$al->toHtml($page, S::v('prenom'), S::v('nom'), S::v('femme'));
break;
case 'Confirmer':
XDB::execute("REPLACE INTO axletter
SET id = {?}, short_name = {?}, subject = {?}, title = {?}, body = {?},
- signature = {?}, promo_min = {?}, promo_max = {?}, echeance = {?}, subset = {?}",
- $id, $short_name, $subject, $title, $body, $signature, $promo_min, $promo_max, $echeance, $subset ? implode("\n", $subset_to) : null);
+ signature = {?}, promo_min = {?}, promo_max = {?}, echeance = {?}, subset = {?}, subset_rm = {?}",
+ $id, $short_name, $subject, $title, $body, $signature, $promo_min, $promo_max, $echeance, $subset ? implode("\n", $subset_to) : null, $subset_rm);
if (!$saved) {
global $globals;
$mailer = new PlMailer();
$page->assign('promo_max', $promo_max);
$page->assign('subset_to', implode("\n", $subset_to));
$page->assign('subset', $subset);
+ $page->assign('subset_rm', $subset_rm);
$page->assign('echeance', $echeance);
$page->assign('echeance_date', $echeance_date);
$page->assign('echeance_time', $echeance_time);
public $_promo_max;
public $_subset;
public $_subset_to;
+ public $_subset_rm;
public $_echeance;
public $_date;
public $_bits;
}
list($this->_id, $this->_shortname, $this->_title_mail, $this->_title,
$this->_body, $this->_signature, $this->_promo_min, $this->_promo_max,
- $this->_subset_to, $this->_echeance, $this->_date, $this->_bits) = $id;
+ $this->_subset_to, $this->_subset_rm, $this->_echeance, $this->_date, $this->_bits) = $id;
if ($this->_date == '0000-00-00') {
$this->_date = 0;
}
$ids = ids_from_mails($this->_subset_to);
$ids_list = implode(',', $ids);
if(count($ids) > 0) {
- $where[] = "ni.user_id IN ($ids_list)";
+ if ($this->_subset_rm) {
+ $where[] = "ni.user_id NOT IN ($ids_list)";
+ } else {
+ $where[] = "ni.user_id IN ($ids_list)";
+ }
} else {
// No valid email
$where[] = "0";
{include file="include/field.promo.tpl" prefix=""}
<tr>
<td class="titre">Envoyer à une liste d'adresses</td>
- <td><textarea name="subset_to" rows="7" cols="78">{$subset_to}</textarea><br />
+ <td>
+ <textarea name="subset_to" rows="7" cols="78">{$subset_to}</textarea><br />
<span class="smaller">Indiquez une liste d'adresses emails : la lettre sera envoyée uniquement aux personnes des promotions sélectionnées, dont l'adresse figure dans la liste, et qui souhaitent recevoir les emails de l'AX.</span>
</td>
</tr>
+ <tr>
+ <td class="titre">Sélection inversée</td>
+ <td>
+ <input type="checkbox" name="subset_rm" {if $subset_rm}checked{/if} /><span class="smaller">En cochant cette case, la liste sera envoyée à tous les inscrits de l'intervalle de promotions sélectionné, sauf ceux indiqués dans la liste ci-dessus.</span>
+ </td>
+ </tr>
{if !$saved}
<tr>
<td class="titre">Echéance d'envoi</td>