Typo
[platal.git] / modules / axletter.php
index 65358c5..a664705 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2009 Polytechnique.org                              *
+ *  Copyright (C) 2003-2010 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -92,6 +92,7 @@ class AXLetterModule extends PLModule
         $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');
@@ -155,15 +156,15 @@ class AXLetterModule extends PLModule
               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();
@@ -179,7 +180,7 @@ class AXLetterModule extends PLModule
                                       . "https://www.polytechnique.org/ax/edit\n"
                                       . "-- \n"
                                       . "Association Polytechnique.org\n");
-                    $users = User::getBulkUsersWithUIDs(XDB::fetchColumn('SELECT  user_id
+                    $users = User::getBulkUsersWithUIDs(XDB::fetchColumn('SELECT  uid
                                                                             FROM  axletter_rights'));
                     foreach ($users as $user) {
                         $mailer->addTo($user);
@@ -203,6 +204,7 @@ class AXLetterModule extends PLModule
         $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);
@@ -313,13 +315,13 @@ class AXLetterModule extends PLModule
         }
 
         $page->changeTpl('axletter/admin.tpl');
-        $page->assign('admins', User::getBulkUsersWithUIDs(XDB::fetchColumn('SELECT  user_id
+        $page->assign('admins', User::getBulkUsersWithUIDs(XDB::fetchColumn('SELECT  uid
                                                                                FROM  axletter_rights')));
 
         $importer = new CSVImporter('axletter_ins');
-        $importer->registerFunction('user_id', 'email vers Id X.org', array($this, 'idFromMail'));
+        $importer->registerFunction('uid', 'email vers Id X.org', array($this, 'idFromMail'));
         $importer->forceValue('hash', array($this, 'createHash'));
-        $importer->apply($page, "admin/axletter", array('user_id', 'email', 'prenom', 'nom', 'promo', 'flag', 'hash'));
+        $importer->apply($page, "admin/axletter", array('uid', 'email', 'prenom', 'nom', 'promo', 'flag', 'hash'));
     }
 
     function idFromMail($line, $key, $relation = null)