Merge remote branch 'origin/platal-1.0.0'
authorStéphane Jacob <sj@m4x.org>
Fri, 16 Jul 2010 22:18:54 +0000 (00:18 +0200)
committerStéphane Jacob <sj@m4x.org>
Fri, 16 Jul 2010 22:18:54 +0000 (00:18 +0200)
53 files changed:
ChangeLog
bin/cron/profile_modification.php [new file with mode: 0755]
classes/direnum.php
classes/profile.php
classes/user.php
classes/userfilter.php
configs/mails.conf
configs/platal.cron.in
core
include/marketing.inc.php
include/profilefields.inc.php
include/validations.inc.php
include/validations/entreprises.inc.php
include/validations/names.inc.php
modules/admin.php
modules/marketing.php
modules/payment.php
modules/profile.php
modules/profile/addresses.inc.php
modules/profile/decos.inc.php
modules/profile/general.inc.php
modules/profile/groups.inc.php
modules/profile/jobs.inc.php
modules/profile/mentor.inc.php
modules/profile/page.inc.php
modules/profile/skills.inc.php
modules/search.php
modules/xnetevents.php
modules/xnetevents/xnetevents.inc.php
plugins/function.profile.php
templates/admin/user.tpl
templates/admin/useredit.mail.tpl
templates/admin/validation.tpl
templates/gadgets/ig-minifiche.tpl
templates/include/form.valid.edit-entreprises.tpl
templates/include/form.valid.entreprises.tpl
templates/include/minifiche.tpl
templates/include/plview.trombi.entry.tpl
templates/include/trombi.tpl
templates/lists/members.tpl
templates/marketing/broken.tpl
templates/marketing/index.tpl
templates/marketing/marketing.mail.tpl
templates/marketing/promo.tpl
templates/profile/general.tpl
templates/profile/mentor.tpl
templates/profile/notification.mail.tpl [new file with mode: 0644]
templates/profile/profile.tpl
templates/skin/common.title.header.tpl
upgrade/1.0.1/00_job.sql [new file with mode: 0644]
upgrade/1.0.1/01_profiles.sql [new file with mode: 0644]
upgrade/1.0.1/connect.db.inc.php [new symlink]
upgrade/1.0.1/phone.php [new file with mode: 0755]

index eeeefd6..e2a9d63 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,45 @@
 ================================================================================
+VERSION 1.0.1                                                         XX XX XXXX
+
+From 1.0.0 branch:
+    * AXLetter:
+        - Fix unsubscription                                               -XEL
+
+    * Carnet:
+        - Fix inaccessible carnet/panel in case of profile update          -FRU
+        - Fix notification email                                           -JAC
+
+    * Events:
+        - Fix promotion_ml reminder                                        -FRU
+
+    * Lists:
+        - Fix inclusion of banana for achives and moderation preview       -FRU
+
+    * Profile:
+        - Fix entreprise validation                                        -JAC
+        - Fix name validation                                              -XEL
+        - Fix orange validation                                            -XEL
+        - Fix vcards                                                       -FRU
+        - Fix geocoding                                                    -JAC
+
+    * Newsletter:
+        - Fix user selection                                               -FRU
+
+    * Register:
+        - Fix calls to missing functions                                   -JAC
+
+    * Search:
+        - Fix filtering by promotion                                       -XEL
+        - Fix search by address                                            -XEL
+
+    * XnetGrp:
+        - Fix name in unsubscription notification                          -JAC
+        - Fix mailer sending O(n^2) mails                                  -VZA
+
+    * XnetList:
+        - Fix group directory synchronization page                         -JAC
+
+================================================================================
 VERSION 1.0.0                                                         30 06 2010
 
 New:
diff --git a/bin/cron/profile_modification.php b/bin/cron/profile_modification.php
new file mode 100755 (executable)
index 0000000..0aa2172
--- /dev/null
@@ -0,0 +1,88 @@
+#!/usr/bin/php5 -q
+<?php
+/***************************************************************************
+ *  Copyright (C) 2003-2010 Polytechnique.org                              *
+ *  http://opensource.polytechnique.org/                                   *
+ *                                                                         *
+ *  This program is free software; you can redistribute it and/or modify   *
+ *  it under the terms of the GNU General Public License as published by   *
+ *  the Free Software Foundation; either version 2 of the License, or      *
+ *  (at your option) any later version.                                    *
+ *                                                                         *
+ *  This program is distributed in the hope that it will be useful,        *
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
+ *  GNU General Public License for more details.                           *
+ *                                                                         *
+ *  You should have received a copy of the GNU General Public License      *
+ *  along with this program; if not, write to the Free Software            *
+ *  Foundation, Inc.,                                                      *
+ *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
+ ***************************************************************************/
+
+require_once 'connect.db.inc.php';
+require_once 'plmailer.php';
+global $globals;
+
+$res = XDB::iterator('SELECT  p.hrpid, pm.pid, a.full_name, pm.field, pm.oldText, pm.newText, p.sex, pd.yourself, al.alias
+                        FROM  profile_modifications AS pm
+                  INNER JOIN  accounts              AS a  ON (pm.uid = a.uid)
+                  INNER JOIN  profiles              AS p  ON (pm.pid = p.pid)
+                  INNER JOIN  profile_display       AS pd ON (pm.pid = pd.pid)
+                  INNER JOIN  account_profiles      AS ap ON (pm.pid = ap.pid AND FIND_IN_SET(\'owner\', ap.perms))
+                  INNER JOIN  aliases               AS al ON (ap.uid = al.uid AND FIND_IN_SET(\'bestalias\', al.flags))
+                    ORDER BY  pm.pid, pm.field');
+
+$date = time();
+$values = $res->next();
+
+$pid = $values['pid'];
+$sex = ($values['sex'] == 'female') ? 1 : 0;
+$yourself = $values['yourself'];
+$alias = $values['alias'];
+$hrpid = $values['hrpid'];
+$modifications = array();
+$modifications[] = array(
+    'full_name' => $values['full_name'],
+    'field'     => $values['field'],
+    'oldText'   => $values['oldText'],
+    'newText'   => $values['newText'],
+);
+
+while ($values = $res->next()) {
+    if ($values['pid'] != $pid) {
+        $mailer = new PlMailer('profile/notification.mail.tpl');
+        $mailer->addTo($alias . '@' . $globals->mail->domain);
+        $mailer->assign('modifications', $modifications);
+        $mailer->assign('yourself', $yourself);
+        $mailer->assign('hrpid', $hrpid);
+        $mailer->assign('sex', $sex);
+        $mailer->assign('date', $date);
+        $mailer->send();
+        $modifications = array();
+    }
+    $pid = $values['pid'];
+    $sex = ($values['sex'] == 'female') ? 1 : 0;
+    $yourself = $values['yourself'];
+    $alias = $values['alias'];
+    $hrpid = $values['hrpid'];
+    $modifications[] = array(
+        'full_name' => $values['full_name'],
+        'field'     => $values['field'],
+        'oldText'   => $values['oldText'],
+        'newText'   => $values['newText'],
+    );
+}
+$mailer = new PlMailer('profile/notification.mail.tpl');
+$mailer->addTo($alias . '@' . $globals->mail->domain);
+$mailer->assign('modifications', $modifications);
+$mailer->assign('yourself', $yourself);
+$mailer->assign('hrpid', $hrpid);
+$mailer->assign('sex', $sex);
+$mailer->assign('date', $date);
+$mailer->send();
+
+XDB::execute('DELETE FROM  profile_modifications');
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
index e0b485d..7dbf40c 100644 (file)
@@ -51,6 +51,8 @@ class DirEnum
 
     const NETWORKS       = 'networking';
 
+    const MEDALS         = 'medals';
+
     static private $enumerations = array();
 
     static private function init($type)
@@ -238,6 +240,9 @@ abstract class DirEnumeration
     }
     // }}}
 
+    /** Builds a list of query parts for searching @$text in @$field :
+     * field LIKE 'text%', field LIKE '% text%', field LIKE '%-text%'
+     */
     private function mkTests($field, $text)
     {
         $tests = array();
@@ -627,5 +632,17 @@ class DE_Networking extends DirEnumeration
 }
 // }}}
 
+/** MEDALS
+ */
+// {{{ class DE_Medals
+class DE_Medals extends DirEnumeration
+{
+    protected $from = 'profile_medal_enum';
+
+    protected $ac_join = 'INNER JOIN profile_medals ON (profile_medals.mid = profile_medal_enum.id)';
+    protected $ac_unique = 'profile_medals.pid';
+}
+// }}}
+
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
 ?>
index ee23cab..8c791fa 100644 (file)
@@ -198,6 +198,14 @@ class Profile
         return $this->owner;
     }
 
+    public function isActive()
+    {
+        if ($this->owner()) {
+            return $this->owner->isActive();
+        }
+        return false;
+    }
+
     public function promo()
     {
         return $this->promo;
@@ -371,14 +379,15 @@ class Profile
     public function nationalities()
     {
         $nats = array();
+        $countries = DirEnum::getOptions(DirEnum::COUNTRIES);
         if ($this->nationality1) {
-            $nats[] = $this->nationality1;
+            $nats[$this->nationality1] = $countries[$this->nationality1];
         }
         if ($this->nationality2) {
-            $nats[] = $this->nationality2;
+            $nats[$this->nationality2] = $countries[$this->nationality2];
         }
         if ($this->nationality3) {
-            $nats[] = $this->nationality3;
+            $nats[$this->nationality3] = $countries[$this->nationality3];
         }
         return $nats;
     }
@@ -841,8 +850,8 @@ class Profile
 
         $it = XDB::Iterator('SELECT  p.pid, p.hrpid, p.xorg_id, p.ax_id, p.birthdate, p.birthdate_ref,
                                      p.next_birthday, p.deathdate, p.deathdate_rec, p.sex = \'female\' AS sex,
-                                     p.cv, p.medals_pub, p.alias_pub, p.email_directory, p.last_change,
-                                     p.nationality1, p.nationality2, p.nationality3,
+                                     IF ({?}, p.cv, NULL) AS cv, p.medals_pub, p.alias_pub, p.email_directory,
+                                     p.last_change, p.nationality1, p.nationality2, p.nationality3,
                                      IF (p.freetext_pub IN {?}, p.freetext, NULL) AS freetext,
                                      pe.entry_year, pe.grad_year,
                                      IF ({?}, pse.text, NULL) AS section,
@@ -850,8 +859,9 @@ class Profile
                                      IF( {?}, pn_n.name, NULL) AS nickname,
                                      IF(pn_uf.name IS NULL, pn_f.name, pn_uf.name) AS firstname_ordinary,
                                      IF(pn_ul.name IS NULL, pn_l.name, pn_ul.name) AS lastname_ordinary,
-                                     pd.yourself, pd.promo, pd.short_name, pd.directory_name AS full_name,
-                                     pd.directory_name, IF(pp.pub IN {?}, pp.display_tel, NULL) AS mobile,
+                                     pd.yourself, pd.promo, pd.short_name, pd.public_name AS full_name,
+                                     pd.directory_name, pd.public_name, pd.private_name,
+                                     IF(pp.pub IN {?}, pp.display_tel, NULL) AS mobile,
                                      (ph.pub IN {?} AND ph.attach IS NOT NULL) AS has_photo,
                                      ph.x AS photo_width, ph.y AS photo_height,
                                      p.last_change < DATE_SUB(NOW(), INTERVAL 365 DAY) AS is_old,
@@ -878,11 +888,12 @@ class Profile
                               WHERE  p.pid IN {?}
                            GROUP BY  p.pid
                                      ' . $order,
-                           $visibility->levels(),
-                           $visibility->isVisible(ProfileVisibility::VIS_PRIVATE),
-                           $visibility->isVisible(ProfileVisibility::VIS_PRIVATE),
-                           $visibility->levels(),
-                           $visibility->levels(),
+                           $visibility->isVisible(ProfileVisibility::VIS_PRIVATE), // CV
+                           $visibility->levels(), // freetext
+                           $visibility->isVisible(ProfileVisibility::VIS_PRIVATE), // section
+                           $visibility->isVisible(ProfileVisibility::VIS_PRIVATE), // nickname
+                           $visibility->levels(), // mobile
+                           $visibility->levels(), // photo
                            $pids
                        );
         return new ProfileIterator($it, $pids, $fields, $visibility);
index f7f90fa..2a399ad 100644 (file)
@@ -264,6 +264,11 @@ class User extends PlUser
                                    WHERE  a.uid = {?}', $this->id());
     }
 
+    public function isActive()
+    {
+        return $this->state == 'active';
+    }
+
     /** Overload PlUser::promo(): there no promo defined for a user in the current
      * schema. The promo is a field from the profile.
      */
@@ -291,6 +296,22 @@ class User extends PlUser
         return $this->profile()->lastName();
     }
 
+    public function fullName($with_promo = false)
+    {
+        if (!$this->hasProfile()) {
+            return $this->full_name;
+        }
+        return $this->profile()->fullName($with_promo);
+    }
+
+    public function directoryName()
+    {
+        if (!$this->hasProfile()) {
+            return $this->full_name;
+        }
+        return $this->profile()->directory_name;
+    }
+
     /** Return the main profile attached with this account if any.
      */
     public function profile()
@@ -380,32 +401,58 @@ class User extends PlUser
      */
     private function fetchMarketingData()
     {
-        if (isset($this->last_known_email)) {
+        if (isset($this->pending_registration_date)) {
             return;
         }
-        // FIXME: We should fetch the last known email as well as the pending registration email (they aren't the same !)
-        $infos = XDB::fetchOneAssoc('SELECT  IF (MAX(m.last) > p.relance, MAX(m.last), p.relance) AS last_relance,
-                                             p.email AS last_known_email
-                                       FROM  register_pending AS p
-                                  LEFT JOIN  register_marketing AS m ON (p.uid = m.uid)
-                                      WHERE  p.uid = {?}
-                                   GROUP BY  p.uid', $this->id());
-        if (!$infos) {
-            $infos = array('last_relance' => null, 'last_known_email' => null);
+        $infos = XDB::fetchOneAssoc('SELECT  rp.date AS pending_registration_date, rp.email AS pending_registration_email,
+                                             rm.last AS last_marketing_date, rm.email AS last_marketing_email
+                                       FROM  accounts           AS a
+                                  LEFT JOIN  register_pending   AS rp ON (rp.uid = a.uid)
+                                  LEFT JOIN  register_marketing AS rm ON (rm.uid = a.uid AND rm.last != \'0000-00-00\')
+                                      WHERE  a.uid = {?}
+                                   ORDER BY  rm.last DESC', $this->id());
+        if (is_null($infos)) {
+            $infos = array(
+                'pending_registration_date'  => null,
+                'pending_registration_email' => null,
+                'last_marketing_date'        => null,
+                'last_marketing_email'       => null
+            );
         }
         $this->fillFromArray($infos);
     }
 
-    public function lastMarketingRelance()
+    public function pendingRegistrationDate()
     {
         $this->fetchMarketingData();
-        return $this->last_relance;
+        return $this->pending_registration_date;
+    }
+
+    public function pendingRegistrationEmail()
+    {
+        $this->fetchMarketingData();
+        return $this->pending_registration_email;
+    }
+
+    public function lastMarketingDate()
+    {
+        $this->fetchMarketingData();
+        return $this->last_marketing_date;
+    }
+
+    public function lastMarketingEmail()
+    {
+        $this->fetchMarketingData();
+        return $this->last_marketing_email;
     }
 
     public function lastKnownEmail()
     {
         $this->fetchMarketingData();
-        return $this->last_known_email;
+        if ($this->pending_registration_email > $this->last_marketing_date) {
+            return $this->pending_registration_email;
+        }
+        return $this->last_marketing_email;
     }
 
 
index 058def4..e988793 100644 (file)
@@ -939,7 +939,7 @@ class UFC_Job_Company implements UserFilterCondition
     public function buildCondition(PlFilter &$uf)
     {
         $sub = $uf->addJobCompanyFilter();
-        $cond  = $sub . '.' . $this->type . ' = ' . XDB::format('{?}', $this->value);
+        $cond  = $sub . '.' . $this->type . XDB::formatWildcards(XDB::WILDCARD_CONTAINS, $this->value);
         return $cond;
     }
 }
index de5ac1b..059b0d9 100644 (file)
@@ -66,3 +66,8 @@ from="Gestion des groupes X sur Polytechnique.net" <support@polytechnique.org>
 from="Webmaster Polytechnique.org" <web@polytechnique.org>
 to=registration+watch@staff.m4x.org
 replyto=registration+watch@staff.m4x.org
+
+[profile]
+from="Polytechnique.org" <validation_modification@polytechnique.org>
+cc="Polytechnique.org" <validation_modification@polytechnique.org>
+
index efc0a14..bb88941 100644 (file)
@@ -17,6 +17,9 @@ WD=/home/web/prod/platal/bin/cron
 0  2 * * *     web     cd $WD; ./notifs.birthday.php
 0  4 * * 6     web     cd $WD; ./notifs.send.php
 
+# profile modification notifications
+0 23 * * *     web     cd $WD; ./profile_modification.php
+
 # validations
 0 */3 * * *    web     cd $WD; ./cron_validations.php
 
diff --git a/core b/core
index 786bffb..7f6d106 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit 786bffb570bfc2f5ff1dad386a9558501d4c16e8
+Subproject commit 7f6d1063f7543f8e6c0e775dccdeff18626534cc
index 18f02a6..af1ef1f 100644 (file)
@@ -186,18 +186,12 @@ class Marketing
         }
     }
 
-    static public function getAliveUsersCount()
-    {
-        $uf = new UserFilter(new PFC_Not(new UFC_Dead()));
-        return $uf->getTotalCount();
-    }
-
     static public function relance(PlUser &$user, $nbx = -1)
     {
         global $globals;
 
         if ($nbx < 0) {
-            $nbx = self::getAliveUsersCount();
+            $nbx = $globals->core->NbIns;
         }
 
         $res = XDB::fetchOneCell('SELECT  r.date, r.email, r.bestalias
@@ -291,7 +285,6 @@ class AnnuaireMarketing implements MarketingEngine
         $page->assign('intro', $this->getIntro());
         $page->assign('u', $user);
         $page->assign('sign', $this->getSignature());
-        $page->assign('num_users', Marketing::getAliveUsersCount());
         $page->assign('personal_notes', $this->getPersonalNotes());
     }
 
index 75f770c..c170278 100644 (file)
@@ -281,6 +281,11 @@ class Job
             $this->$key = $val;
         }
         $this->company = CompanyList::get($this->jobid);
+        if (is_null($this->company)) {
+            require_once 'validations.inc.php';
+            $entreprise = ProfileValidate::get_typed_requests($this->pid, 'entreprise');
+            $this->company = new Company(array('name' =>  $entreprise[$this->id]->name));
+        }
     }
 
     public function phones()
index dcc4b63..e04596a 100644 (file)
@@ -437,6 +437,7 @@ abstract class ProfileValidate extends Validate
     public $profile;
     public $profileOwner;
     public $userIsProfileOwner;
+    public $ownerIsRegistered;
 
     // }}}
     // {{{ constructor
@@ -453,11 +454,9 @@ abstract class ProfileValidate extends Validate
         parent::__construct($_user, $_unique, $_type);
         $this->profile = &$_profile;
         $this->profileOwner = $this->profile->owner();
-        if (!is_null($this->profileOwner) && $this->profileOwner->id() == $this->user->id()) {
-            $this->userIsProfileOwner = true;
-        } else {
-            $this->userIsProfileOwner = false;
-        }
+        $this->userIsProfileOwner = (!is_null($this->profileOwner)
+                                     && $this->profileOwner->id() == $this->user->id());
+        $this->ownerIsRegistered = $this->profile->isActive();
     }
 
     // }}}
@@ -525,24 +524,23 @@ abstract class ProfileValidate extends Validate
 
     protected function sendmail($isok)
     {
-        global $globals;
-        $mailer = new PlMailer();
-        $mailer->setSubject($this->_mail_subj());
-        $mailer->setFrom("validation+{$this->type}@{$globals->mail->domain}");
-        $mailer->addTo("\"{$this->profile->fullName()}\" <{$this->profileOwner->bestEmail()}>");
-        if (!$this->userIsProfileOwner) {
-            $mailer->addCc("\"{$this->user->fullName()}\" <{$this->user->bestEmail()}>");
-        }
-        $mailer->addCc("validation+{$this->type}@{$globals->mail->domain}");
-
-        $body = ($this->profile->isFemale() ? "Chère camarade,\n\n" : "Cher camarade,\n\n")
-              . $this->_mail_body($isok)
-              . (Env::has('comm') ? "\n\n" . Env::v('comm') : '')
-              . "\n\nCordialement,\n-- \nL'équipe de Polytechnique.org\n"
-              . $this->_mail_ps($isok);
+        // Only sends email if the profile's owner exists and is registered.
+        if ($this->ownerIsRegistered) {
+            global $globals;
 
-        $mailer->setTxtBody(wordwrap($body));
-        $mailer->send();
+            $mailer = new PlMailer();
+            $mailer->setSubject($this->_mail_subj());
+            $mailer->setFrom("validation+{$this->type}@{$globals->mail->domain}");
+            $mailer->addTo("\"{$this->profile->fullName()}\" <{$this->profileOwner->bestEmail()}>");
+            $mailer->addCc("validation+{$this->type}@{$globals->mail->domain}");
+            $body = ($this->profile->isFemale() ? "Chère camarade,\n\n" : "Cher camarade,\n\n")
+                  . $this->_mail_body($isok)
+                  . (Env::has('comm') ? "\n\n" . Env::v('comm') : '')
+                  . "\n\nCordialement,\n-- \nL'équipe de Polytechnique.org\n"
+                  . $this->_mail_ps($isok);
+            $mailer->setTxtBody(wordwrap($body));
+            $mailer->send();
+        }
     }
 
     // }}}
@@ -622,11 +620,7 @@ abstract class ProfileValidate extends Validate
 
     public function id()
     {
-        if (!is_null($this->profile)) {
-            return $this->profile->id() . '_' . $this->type . '_' . $this->stamp;
-        } else {
-            return $this->user->id() . '_' . $this->type . '_' . $this->stamp;
-        }
+        return $this->profile->id() . '_' . $this->type . '_' . $this->stamp;
     }
 
     // }}}
index cff4801..47e6a02 100644 (file)
@@ -68,12 +68,14 @@ class EntrReq extends ProfileValidate
                 $where .= "name LIKE '%" . $name_array[$i] . "%'";
             }
         }
-        $res = XDB::iterator('SELECT  name
-                                FROM  profile_job_enum
-                               WHERE  ' . $where);
-        $this->suggestions = "| ";
-        while ($sug = $res->next()) {
-            $this->suggestions .= $sug['name'] . " | ";
+        if ($where != '') {
+            $res = XDB::iterator('SELECT  name
+                                    FROM  profile_job_enum
+                                   WHERE  ' . $where);
+            $this->suggestions = "| ";
+            while ($sug = $res->next()) {
+                $this->suggestions .= $sug['name'] . " | ";
+            }
         }
     }
 
@@ -98,26 +100,37 @@ class EntrReq extends ProfileValidate
 
     protected function handle_editor()
     {
-        if (Env::has('holdingid')) {
-            $this->holdingid = Env::t('holdingid');
-        }
         if (Env::has('name')) {
             $this->name = Env::t('name');
-            if (Env::has('acronym')) {
-                $this->acronym = Env::t('acronym');
-                if (Env::has('url')) {
-                    $this->url = Env::t('url');
-                    if (Env::has('NAF_code')) {
-                        $this->NAF_code = Env::t('NAF_code');
-                        if (Env::has('AX_code')) {
-                            $this->AX_code = Env::t('AX_code');
-                            return true;
-                        }
-                    }
-                }
-            }
         }
-        return false;
+        if (Env::has('acronym')) {
+            $this->acronym = Env::t('acronym');
+        }
+        if (Env::has('url')) {
+            $this->url = Env::t('url');
+        }
+        if (Env::has('email')) {
+            $this->email = Env::t('email');
+        }
+        if (Env::has('holdingid')) {
+            $this->holdingid = Env::i('holdingid');
+        }
+        if (Env::has('NAF_code')) {
+            $this->NAF_code = Env::t('NAF_code');
+        }
+        if (Env::has('AX_code')) {
+            $this->AX_code = Env::i('AX_code');
+        }
+        if (Env::has('address')) {
+            $this->address['text'] = Env::t('address');
+        }
+        if (Env::has('tel')) {
+            $this->tel = Env::t('tel');
+        }
+        if (Env::has('fax')) {
+            $this->fax = Env::t('fax');
+        }
+        return true;
     }
 
     // }}}
index 08fd85b..712f4e1 100644 (file)
@@ -19,7 +19,7 @@
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
-// {{{ class NamesReq4
+// {{{ class NamesReq
 
 class NamesReq extends ProfileValidate
 {
index 3c0cb27..5f3ba19 100644 (file)
@@ -462,17 +462,43 @@ class AdminModule extends PLModule
             }
         }
         if (!empty($to_update)) {
-            // TODO: fetch the initial values of the fields, and eventually send
-            // a summary of the changes to an admin.
+            $res = XDB::query('SELECT  *
+                                 FROM  accounts
+                                WHERE  uid = {?}', $user->id());
+            $oldValues = $res->fetchAllAssoc();
+            $oldValues = $oldValues[0];
+
             $set = array();
+            $diff = array();
             foreach ($to_update as $k => $value) {
-                $set[] = XDB::format($k . ' = {?}', $value);
+                $value = XDB::format('{?}', $value);
+                $set[] = $k . ' = ' . $value;
+                $diff[$k] = array($oldValues[$k], trim($value, "'"));
+                unset($oldValues[$k]);
             }
             XDB::execute('UPDATE  accounts
                              SET  ' . implode(', ', $set) . ' 
                            WHERE  uid = ' . XDB::format('{?}', $user->id()));
             $page->trigSuccess('Données du compte mise à jour avec succès');
             $user = User::getWithUID($user->id());
+
+            /* Formats the $diff and send it to the site administrators. The rules are the folowing:
+             *  -formats: password, token, weak_password
+             */
+            foreach (array('password', 'token', 'weak_password') as $key) {
+                if (isset($diff[$key])) {
+                    $diff[$key] = array('old value', 'new value');
+                } else {
+                    $oldValues[$key] = 'old value';
+                }
+            }
+
+            $mail = new PlMailer('admin/useredit.mail.tpl');
+            $mail->assign('admin', S::user()->hruid);
+            $mail->assign('hruid', $user->hruid);
+            $mail->assign('diff', $diff);
+            $mail->assign('oldValues', $oldValues);
+            $mail->send();
         }
         // }}}
 
index d5f9ed8..aad7164 100644 (file)
@@ -39,9 +39,62 @@ class MarketingModule extends PLModule
     function handler_marketing(&$page)
     {
         $page->changeTpl('marketing/index.tpl');
-
         $page->setTitle('Marketing');
-        $page->trigWarning("Les statistiques sont momentanéement désactivées");
+
+        $alive = new UserFilter(new PFC_Not(new UFC_Dead()));
+        $registered = new UserFilter(new PFC_And(new UFC_Registered(), new PFC_Not(new UFC_Dead())));
+        $alive72 = new UserFilter(new PFC_And(new UFC_Promo('>=', UserFilter::GRADE_ING, 1972), new PFC_Not(new UFC_Dead())));
+        $registered72 = new UserFilter(new PFC_And(new UFC_Registered(), new UFC_Promo('>=', UserFilter::GRADE_ING, 1972), new PFC_Not(new UFC_Dead())));
+        $aliveWomen = new UserFilter(new PFC_And(new UFC_Sex(User::GENDER_FEMALE) , new PFC_Not(new UFC_Dead())));
+        $registeredWomen = new UserFilter(new PFC_And(new UFC_Registered(), new UFC_Sex(User::GENDER_FEMALE), new PFC_Not(new UFC_Dead())));
+        $statistics = array(
+            'alive'           => $alive->getTotalCount(),
+            'registered'      => $registered->getTotalCount(),
+            'alive72'         => $alive72->getTotalCount(),
+            'registered72'    => $registered72->getTotalCount(),
+            'womenAlive'      => $aliveWomen->getTotalCount(),
+            'womenRegistered' => $registeredWomen->getTotalCount(),
+        );
+        $statistics['registeredRate']      = $statistics['registered'] / $statistics['alive'] * 100;
+        $statistics['registeredRate72']    = $statistics['registered72'] / $statistics['alive72'] * 100;
+        $statistics['womenRegisteredRate'] = $statistics['womenRegistered'] / $statistics['womenAlive'] * 100;
+
+        $registeredWeek = new UserFilter(new PFC_And(new UFC_Registered(false, '>=', strtotime('1 week ago')), new PFC_Not(new UFC_Dead())));
+        $registrationPending = XDB::fetchOneCell('SELECT  COUNT(*)
+                                                    FROM  register_pending');
+        $registrations = array(
+            'week'    => $registeredWeek->getTotalCount(),
+            'pending' => $registrationPending,
+        );
+
+        $ok = XDB::fetchOneCell('SELECT  COUNT(*)
+                                   FROM  register_mstats
+                                  WHERE  success != \'0000-00-00\'');
+        $okWeek = XDB::fetchOneCell('SELECT  COUNT(*)
+                                       FROM  register_mstats
+                                      WHERE  success >= {?}', strtotime('1 week ago'));
+        $res = XDB::fetchAllAssoc('SELECT  type, COUNT(*) as count
+                                     FROM  register_marketing
+                                 GROUP BY  type');
+        $no = array();
+        foreach ($res as $value) {
+            $no[$value['type']] = $value['count'];
+        }
+        $no['week'] = XDB::fetchOneCell('SELECT  COUNT(*)
+                                           FROM  register_marketing
+                                          WHERE  last >= {?}', strtotime('1 week ago'));
+        $marketings = array(
+            'ok'      => $ok,
+            'okWeek'  => $okWeek,
+            'noPerso' => (isset($no['user']) ? $no['user'] : 0),
+            'noXorg'  => (isset($no['staff']) ? $no['staff'] : 0),
+            'noAX'    => (isset($no['ax']) ? $no['ax'] : 0),
+            'noWeek'  => $no['week'],
+        );
+
+        $page->assign('statistics', $statistics);
+        $page->assign('registrations', $registrations);
+        $page->assign('marketings', $marketings);
     }
 
     function handler_private(&$page, $hruid = null,
@@ -317,7 +370,8 @@ class MarketingModule extends PLModule
         $page->changeTpl('marketing/relance.tpl');
 
         if (Post::has('relancer')) {
-            $nbdix = Marketing::getAliveUsersCount();
+            global $globals;
+            $nbdix = $globals->core->NbIns;
 
             $sent  = Array();
             $users = User::getBulkUsersWithUIDs($_POST['relance']);
index e2f57b4..737d9c2 100644 (file)
@@ -226,7 +226,7 @@ class PaymentModule extends PLModule
         if ($eid = $res->fetchOneCell()) {
             require_once dirname(__FILE__) . '/xnetevents/xnetevents.inc.php';
             $evt = get_event_detail($eid);
-            subscribe_lists_event(0, $uid, $evt, $montant, true);
+            subscribe_lists_event($uid, $evt, 1, $montant, true);
         }
 
         /* on genere le mail de confirmation */
@@ -319,7 +319,7 @@ class PaymentModule extends PLModule
         if ($eid = $res->fetchOneCell()) {
             require_once dirname(__FILE__) . '/xnetevents/xnetevents.inc.php';
             $evt = get_event_detail($eid);
-            subscribe_lists_event(0, $user->id(), $evt, $montant, true);
+            subscribe_lists_event($user->id(), $evt, 1, $montant, true);
         }
 
         /* on genere le mail de confirmation */
@@ -414,7 +414,7 @@ class PaymentModule extends PLModule
         if ($eid = $res->fetchOneCell()) {
             require_once dirname(__FILE__) . '/xnetevents/xnetevents.inc.php';
             $evt = get_event_detail($eid);
-            subscribe_lists_event(0, $uid, $evt, $montant, true);
+            subscribe_lists_event($user->id(), $evt, 1, $montant, true);
         }
 
         /* on genere le mail de confirmation */
index 20305e3..473db30 100644 (file)
@@ -259,6 +259,11 @@ class ProfileModule extends PLModule
             $view = 'private';
         }
 
+        // Display pending picture
+        if (S::logged() && Env::v('modif') == 'new') {
+            $page->assign('with_pending_pic', true);
+        }
+
         // Fetches profile's and profile's owner information and redirects to
         // marketing if the owner has not subscribed and the requirer has logged in.
         $profile = Profile::get($pid, Profile::FETCH_ALL, $view);
index 4e6d51b..37deea8 100644 (file)
@@ -127,6 +127,19 @@ class ProfileSettingAddress extends ProfileSettingGeocoding
             $profiletel->saveTels($page->pid(), 'tel', $address['tel']);
         }
     }
+
+    public function getText($value) {
+        $addresses = array();
+        foreach ($value as $addrid => $address) {
+            $phones = new ProfileSettingPhones('address', $addrid);
+            $addresses[] = 'Adresse : ' . $address['text'] . ', affichage : ' . $address['pub']
+                         . ', commentaire : ' . $address['comment'] . ', actuelle : ' . ($address['current'] ? 'oui' : 'non')
+                         . ', temporaire : ' . ($address['temporary'] ? 'oui' : 'non') . ', secondaire : '
+                         . ($address['secondary'] ? 'oui' : 'non') . ', conctactable par courier : '
+                         . ($address['mail'] ? 'oui' : 'non') . ', ' . $phones->getText($address['tel']);
+        }
+        return implode(' ; ' , $addresses);
+    }
 }
 
 class ProfileSettingAddresses extends ProfilePage
index 6dfc8e6..a6cfabc 100644 (file)
@@ -82,6 +82,15 @@ class ProfileSettingDeco implements ProfileSetting
             }
         }
     }
+
+    public function getText($value) {
+        $medalsList = DirEnum::getOptions(DirEnum::MEDALS);
+        $medals = array();
+        foreach ($value as $id => $medal) {
+            $medals[] = $medalsList[$id];
+        }
+        return implode(', ', $medals);
+    }
 }
 
 class ProfileSettingDecos extends ProfilePage
index a9afd28..362c5eb 100644 (file)
@@ -126,6 +126,11 @@ class ProfileSettingSearchNames implements ProfileSetting
                     $value[] = $sn;
                 } while ($sn = $sn_all->next());
             }
+            require_once 'validations.inc.php';
+            $namesRequest = ProfileValidate::get_typed_requests($page->pid(), 'usage');
+            if (count($namesRequest) > 0) {
+                Platal::page()->assign('validation', true);
+            }
             $value = $this->clean($value);
         } else {
             require_once 'name.func.inc.php';
@@ -229,6 +234,16 @@ class ProfileSettingSearchNames implements ProfileSetting
             set_profile_display($display_names, $page->pid());
         }
     }
+
+    public function getText($value) {
+        $names = array();
+        foreach ($value as $name) {
+            if ($name['name'] != '') {
+                $names[] = $name['type_name'] . ' : ' . $name['name'];
+            }
+        }
+        return implode(', ' , $names);
+    }
 }
 
 class ProfileSettingEdu implements ProfileSetting
@@ -291,6 +306,21 @@ class ProfileSettingEdu implements ProfileSetting
             }
         }
     }
+
+    public function getText($value) {
+        $schoolsList = DirEnum::getOptions(DirEnum::EDUSCHOOLS);
+        $degreesList = DirEnum::getOptions(DirEnum::EDUDEGREES);
+        $fieldsList = DirEnum::getOptions(DirEnum::EDUFIELDS);
+        $educations = array();
+        foreach ($value as $education) {
+            $educations[] = 'Université : ' . $schoolsList[$education['eduid']]
+                          . ', diplôme : ' . $degreesList[$education['degreeid']]
+                          . ', domaine : ' . $fieldsList[$education['fieldid']]
+                          . ', année d\'obtention : ' . $education['grad_year']
+                          . ', intitulé : ' . $education['program'];
+        }
+        return implode(', ', $educations);
+    }
 }
 
 class ProfileSettingEmailDirectory implements ProfileSetting
@@ -316,6 +346,10 @@ class ProfileSettingEmailDirectory implements ProfileSetting
         }
         return $value;
     }
+
+    public function getText($value) {
+        return $value;
+    }
 }
 
 class ProfileSettingNetworking implements ProfileSetting
@@ -389,6 +423,15 @@ class ProfileSettingNetworking implements ProfileSetting
                          $page->pid(), $id, $network['type'], $network['address'], $network['pub']);
         }
     }
+
+    public function getText($value) {
+        $networkings = array();
+        foreach ($value as $network) {
+            $networkings[] = 'nom : ' . $network['name'] . ', adresse : ' . $network['address']
+                           . ', affichage : ' . $network['pub'];
+        }
+        return implode(' ; ' , $networkings);
+    }
 }
 
 class ProfileSettingPromo implements ProfileSetting
@@ -462,6 +505,10 @@ class ProfileSettingPromo implements ProfileSetting
         }
         return intval($value);
     }
+
+    public function getText($value) {
+        return $value;
+    }
 }
 
 
index 62489ed..0d2df30 100644 (file)
@@ -41,6 +41,11 @@ class ProfileSettingSection implements ProfileSetting
                        WHERE  pid = {?}",
                      $value, $page->pid());
     }
+
+    public function getText($value) {
+        $sectionsList = DirEnum::getOptions(DirEnum::SECTIONS);
+        return $sectionsList[$value];
+    }
 }
 
 class ProfileSettingBinets implements ProfileSetting
@@ -85,6 +90,10 @@ class ProfileSettingBinets implements ProfileSetting
         XDB::execute("INSERT INTO  profile_binets (pid, binet_id)
                            VALUES  " . implode(',', $insert));
     }
+
+    public function getText($value) {
+        return implode(', ', $value);
+    }
 }
 
 class ProfileSettingGroups extends ProfilePage
index f698485..924ebac 100644 (file)
@@ -162,6 +162,7 @@ class ProfileSettingJob extends ProfileSettingGeocoding
                                    $job['hq_email'], $job['hq_fixed'], $job['hq_fax'], $job['hq_address']);
                 $req->submit();
                 $job['jobid'] = null;
+                sleep(1);
             } else {
                 $job['jobid'] = $res->fetchOneCell();
             }
@@ -263,6 +264,19 @@ class ProfileSettingJob extends ProfileSettingGeocoding
             }
         }
     }
+
+    public function getText($value) {
+        $jobs = array();
+        foreach ($value as $id => $job) {
+            $address = new ProfileSettingAddress();
+            $phones = new ProfileSettingPhones('pro', $id);
+            $jobs[] = 'Entreprise : ' . $job['name'] . ', secteur : ' . $job['subSubSectorName']
+                    . ', description : ' . $job['description'] . ', web : ' . $job['w_url']
+                    . ', email : ' . $job['w_email']
+                    . ', ' . $phones->getText($job['w_phone']) . ', ' .  $address->getText($job['w_address']);
+        }
+        return implode(' ; ' , $jobs);
+    }
 }
 
 class ProfileSettingJobs extends ProfilePage
@@ -273,6 +287,7 @@ class ProfileSettingJobs extends ProfilePage
     {
         parent::__construct($wiz);
         $this->settings['cv'] = null;
+        /* TODO: ProfileSettingCorps, required for notifications. */
         $this->settings['corps'] = null;
         $this->settings['jobs'] = new ProfileSettingJob();
         $this->watched = array('cv' => true, 'jobs' => true, 'corps' => true);
index 035bb47..17d9cdd 100644 (file)
@@ -69,6 +69,16 @@ class ProfileSettingSectors implements ProfileSetting
             }
         }
     }
+
+    public function getText($value) {
+        $sectors = array();
+        foreach ($value as $sector) {
+            foreach ($sector as $subsector) {
+                $sectors[] = $subsector;
+            }
+        }
+        return implode(', ', $sectors);
+    }
 }
 
 class ProfileSettingCountry implements ProfileSetting
@@ -107,6 +117,10 @@ class ProfileSettingCountry implements ProfileSetting
                          $page->pid(), $id);
         }
     }
+
+    public function getText($value) {
+        return implode(', ', $value);
+    }
 }
 
 
@@ -157,6 +171,7 @@ class ProfileSettingMentor extends ProfilePage
         $page->assign('countryList', XDB::iterator("SELECT  iso_3166_1_a2, countryFR
                                                       FROM  geoloc_countries
                                                   ORDER BY  countryFR"));
+        $page->assign('hrpid', $this->profile->hrpid);
     }
 }
 
index 9d0521e..8c17a05 100644 (file)
@@ -36,11 +36,19 @@ interface ProfileSetting
     /** Save the new value for the given field.
      */
     public function save(ProfilePage &$page, $field, $new_value);
+
+    /** Get text from the value.
+     */
+    public function getText($value);
 }
 
 abstract class ProfileNoSave implements ProfileSetting
 {
     public function save(ProfilePage &$page, $field, $new_value) { }
+
+    public function getText($value) {
+        return $value;
+    }
 }
 
 class ProfileSettingWeb extends ProfileNoSave
@@ -200,6 +208,17 @@ class ProfileSettingPhones implements ProfileSetting
             $this->saveTel($pid, $telid, $phone);
         }
     }
+
+    public function getText($value) {
+        $phones = array();
+        foreach ($value as $phone) {
+            if ($phone['tel'] != '') {
+                $phones[] = 'type : ' . $phone['type'] .', numéro : ' . $phone['tel']
+                          . ', commentaire : « ' . $phone['comment'] . ' », affichage : ' . $phone['pub'];
+            }
+        }
+        return implode(' ; ' , $phones);
+    }
 }
 
 class ProfileSettingPub extends ProfileNoSave
@@ -217,6 +236,10 @@ class ProfileSettingPub extends ProfileNoSave
         }
         return $value;
     }
+
+    public function getText($value) {
+        return $value;
+    }
 }
 
 class ProfileSettingBool extends ProfileNoSave
@@ -281,6 +304,10 @@ abstract class ProfileSettingGeocoding implements ProfileSetting
             $address = $gmapsGeocoder->stripGeocodingFromAddress($address);
         }
     }
+
+    public function getText($value) {
+        return $value;
+    }
 }
 
 
@@ -336,12 +363,26 @@ abstract class ProfilePage implements PlWizardPage
     protected function saveData()
     {
         require_once 'notifs.inc.php';
+        $changedFields = array();
         foreach ($this->settings as $field=>&$setting) {
-            if (!is_null($setting) && $this->changed[$field]) {
-                $setting->save($this, $field, $this->values[$field]);
-            }
-            if ($this->changed[$field] && @$this->watched[$field]) {
-                WatchProfileUpdate::register($this->profile, $field);
+            if ($this->changed[$field]) {
+                if (!is_null($setting)) {
+                    $changedFields[$field] = array(
+                        str_replace("\n", " - ", $setting->getText($this->orig[$field])),
+                        str_replace("\n", " - ", $setting->getText($this->values[$field])),
+                    );
+                } else {
+                    $changedFields[$field] = array(
+                        str_replace("\n", " - ", $this->orig[$field]),
+                        str_replace("\n", " - ", $this->values[$field]),
+                    );
+                }
+                if (!is_null($setting)) {
+                    $setting->save($this, $field, $this->values[$field]);
+                }
+                if (isset($this->watched[$field]) && $this->watched[$field]) {
+                    WatchProfileUpdate::register($this->profile, $field);
+                }
             }
         }
         $this->_saveData();
@@ -352,6 +393,20 @@ abstract class ProfilePage implements PlWizardPage
                        WHERE  pid = {?}', $this->pid());
         global $platal;
         S::logger()->log('profil', $platal->pl_self(2));
+
+        /** If the update was made by a third party and the profile corresponds
+         * to a registered user, stores both former and new text.
+         * This will be daily sent to the user.
+         */
+        $owner = $this->profile->owner();
+        $user = S::user();
+        if ($owner->isActive() && $owner->id() != $user->id()) {
+            foreach ($changedFields as $field => $values) {
+                XDB::execute('REPLACE INTO  profile_modifications (pid, uid, field, oldText, newText)
+                                    VALUES  ({?}, {?}, {?}, {?}, {?})',
+                             $this->pid(), $user->id(), $field, $values[0], $values[1]);
+            }
+        }
     }
 
     protected function checkChanges()
index 4a8c579..1f18133 100644 (file)
@@ -76,6 +76,14 @@ class ProfileSettingSkill implements ProfileSetting
                          $page->pid(), $id, $skill['level']);
         }
     }
+
+    public function getText($value) {
+        $skills = array();
+        foreach ($value as $skill) {
+            $skills[] = 'Compétance : ' . $skill['text'] . ', niveau : ' . $skill['level'];
+        }
+        return implode(' ; ' , $skills);
+    }
 }
 
 class ProfileSettingSkills extends ProfilePage
index 4386c99..72a09ac 100644 (file)
@@ -169,6 +169,9 @@ class SearchModule extends PLModule
             if ($nb_tot > $globals->search->private_max) {
                 $this->form_prepare();
                 $page->trigError('Recherche trop générale.');
+            } else if ($nb_tot == 0) {
+                $this->form_prepare();
+                $page->trigError('Il n\'existe personne correspondant à ces critères dans la base !');
             }
         }
 
index 4db4710..d5091c9 100644 (file)
@@ -269,7 +269,7 @@ class XnetEventsModule extends PLModule
         }
         if ($updated !== false) {
             $page->trigSuccess('Ton inscription à l\'événement a été mise à jour avec succès.');
-            subscribe_lists_event($total, S::i('uid'), $evt, $paid);
+            subscribe_lists_event(S::i('uid'), $evt, ($total > 0 ? 1 : 0), 0);
         }
         $page->assign('event', get_event_detail($eid));
     }
@@ -547,11 +547,12 @@ class XnetEventsModule extends PLModule
 
             // change the price paid by a participant
             if (Env::v('adm') == 'prix' && $member) {
+                $amount = strtr(Env::v('montant'), ',', '.');
                 XDB::execute("UPDATE group_event_participants
                                  SET paid = paid + {?}
                                WHERE uid = {?} AND eid = {?} AND item_id = 1",
-                        strtr(Env::v('montant'), ',', '.'),
-                        $member->uid, $evt['eid']);
+                             $amount, $member->uid, $evt['eid']);
+                subscribe_lists_event($member->uid, $evt, 1, $amount);
             }
 
             // change the number of personns coming with a participant
@@ -566,26 +567,28 @@ class XnetEventsModule extends PLModule
 
                 foreach ($nbs as $id => $nb) {
                     $nb = max(intval($nb), 0);
-                    XDB::execute("REPLACE INTO group_event_participants
-                                        VALUES ({?}, {?}, {?}, {?}, {?}, {?})",
-                                  $evt['eid'], $member->uid, $id, $nb, '', $id == 1 ? $paid : 0);
+                    XDB::execute('REPLACE INTO  group_event_participants
+                                        VALUES  ({?}, {?}, {?}, {?}, {?}, {?})',
+                                 $evt['eid'], $member->uid, $id, $nb, '', $id == 1 ? $paid : 0);
                 }
 
-                $res = XDB::query("SELECT COUNT(uid) AS cnt, SUM(nb) AS nb
-                                     FROM group_event_participants
-                                    WHERE uid = {?} AND eid = {?}
-                                 GROUP BY uid",
-                                            $member->uid, $evt['eid']);
+                $res = XDB::query('SELECT  COUNT(uid) AS cnt, SUM(nb) AS nb
+                                     FROM  group_event_participants
+                                    WHERE  uid = {?} AND eid = {?}
+                                 GROUP BY  uid',
+                                  $member->uid, $evt['eid']);
                 $u = $res->fetchOneAssoc();
                 if ($u['cnt'] == 1 && $paid == 0 && Post::v('cancel')) {
                     XDB::execute("DELETE FROM group_event_participants
                                         WHERE uid = {?} AND eid = {?}",
                                     $member->uid, $evt['eid']);
                     $u = 0;
+                    subscribe_lists_event($member->uid, $evt, -1, $paid);
                 } else {
+                    var_dump($u);
                     $u = $u['cnt'] ? $u['nb'] : null;
+                    subscribe_lists_event($member->uid, $evt, ($u > 0 ? 1 : 0), $paid);
                 }
-                subscribe_lists_event($u, $member->uid, $evt, $paid);
             }
 
             $evt = get_event_detail($eid, $item_id);
@@ -638,7 +641,7 @@ class XnetEventsModule extends PLModule
         $page->assign('absents', $absents);
         $page->assign('participants',
                       get_event_participants($evt, $item_id, UserFilter::sortByName(),
-                                             new PLLimit(NB_PER_PAGE), $ofs * NB_PER_PAGE));
+                                             NB_PER_PAGE, $ofs * NB_PER_PAGE));
     }
 }
 
index 93f011c..91bb45e 100644 (file)
@@ -124,7 +124,7 @@ function get_event_participants(&$evt, $item_id, array $tri = array(), $count =
                                          WHERE  ep.eid = {?} AND nb > 0 ' . $append . '
                                       GROUP BY  ep.uid', $eid);
     $uf = new UserFilter(new PFC_True(), $tri);
-    $users = User::getBulkUsersWithUIDs($uf->filter(array_keys($query), $count, $offset));
+    $users = User::getBulkUsersWithUIDs($uf->filter(array_keys($query), new PlLimit($count, $offset)));
     $tab = array();
     foreach ($users as $user) {
         $uid = $user->id();
@@ -173,11 +173,19 @@ function get_event_participants(&$evt, $item_id, array $tri = array(), $count =
 // }}}
 
 //  {{{ function subscribe_lists_event()
-function subscribe_lists_event($participate, $uid, $evt, $paid, $payment = null)
+/** Subscribes user to various event related mailing lists.
+ *
+ * @param $uid: user's id.
+ * @param evt: events data, in particular ids of the lists at stake.
+ * @param participate: indicates if the user takes part at the event or not;
+ *      -1 means he did not answer, 0 means no, and 1 means yes.
+ * @param paid: has the user already payed anything?
+ *      0 means no, a positive amount means yes.
+ * @param payment: is this function called from a payment page?
+ *      If true, only payment related lists should be updated.
+ */
+function subscribe_lists_event($uid, $evt, $participate, $paid, $payment = false)
 {
-    global $globals;
-    $page =& Platal::page();
-
     $participant_list  = $evt['participant_list'];
     $absent_list       = $evt['absent_list'];
     $unpayed_list      = $evt['booked_unpayed_list'];
@@ -189,8 +197,8 @@ function subscribe_lists_event($participate, $uid, $evt, $paid, $payment = null)
     function subscribe($list, $email)
     {
         if ($list && $email) {
-            XDB::execute("REPLACE INTO  virtual_redirect
-                                VALUES  ({?},{?})",
+            XDB::execute('REPLACE INTO  virtual_redirect
+                                VALUES  ({?}, {?})',
                          $list, $email);
         }
     }
@@ -198,31 +206,45 @@ function subscribe_lists_event($participate, $uid, $evt, $paid, $payment = null)
     function unsubscribe($list, $email)
     {
         if ($list && $email) {
-            XDB::execute("DELETE FROM  virtual_redirect
-                                WHERE  vid = {?} AND redirect = {?}",
+            XDB::execute('DELETE FROM  virtual_redirect
+                                WHERE  vid = {?} AND redirect = {?}',
                          $list, $email);
         }
     }
 
-    if (is_null($payment)) {
-        if (is_null($participate)) {
+    /** If $payment is not null, we do not retrieve the value of $participate,
+     * thus we do not alter participant and absent lists.
+     */
+    if ($payment === true) {
+        if ($paid > 0) {
+            unsubscribe($unpayed_list, $email);
+            subscribe($payed_list, $email);
+        }
+    } else {
+        switch ($participate) {
+          case -1:
             unsubscribe($participant_list, $email);
+            unsubscribe($unpayed_list, $email);
+            unsubscribe($payed_list, $email);
             subscribe($absent_list, $email);
-        } elseif ($participate) {
-            subscribe($participant_list, $email);
-            unsubscribe($absent_list, $email);
-        } else {
+            break;
+          case 0:
             unsubscribe($participant_list, $email);
             unsubscribe($absent_list, $email);
-        }
-    }
-    if ($paid > 0) {
-        unsubscribe($unpayed_list, $email);
-        subscribe($payed_list, $email);
-    } else {
-        unsubscribe($payed_list, $email);
-        if (!is_null($participate)) {
-            subscribe($unpayed_list, $email);
+            unsubscribe($unpayed_list, $email);
+            unsubscribe($payed_list, $email);
+            break;
+          case 1:
+            subscribe($participant_list, $email);
+            unsubscribe($absent_list, $email);
+            if ($paid > 0) {
+                unsubscribe($unpayed_list, $email);
+                subscribe($payed_list, $email);
+            } else {
+                subscribe($unpayed_list, $email);
+                unsubscribe($payed_list, $email);
+            }
+            break;
         }
     }
 }
index dfc4bf3..77909bd 100644 (file)
@@ -31,7 +31,7 @@ function smarty_function_profile($params, &$smarty)
         $user = User::getWithUID($user);
     }
 
-    $name = pl_entities($user->fullName());
+    $name = pl_entities($user->directoryName());
     if ($with_sex && $user->isFemale()) {
         $name = '&bull;' . $name;
     }
@@ -47,6 +47,9 @@ function smarty_function_profile($params, &$smarty)
             $name = '<a href="profile/' . $profile->hrid() . '" class="popup2">' . $name . '</a>';
         }
     }
+    if ($user->lost) {
+        $name .= ' <a href="https://www.polytechnique.org/marketing/broken/' . $user->hruid . '"><img src="images/icons/error.gif" alt="Patte cassée" /></a>';
+    }
     if ($with_groupperms && $user instanceof User && $user->group_perms == 'admin' && !empty($name)) {
         $name = '<strong>' . $name . '</strong>';
     }
index ecad244..9ee2da7 100644 (file)
@@ -113,7 +113,11 @@ $(document).ready(function() {
     <tr>
       <th colspan="2">
         <div style="float: right; text-align: right">
+          {if $user->state eq 'pending'}
+          Non-inscrit
+          {else}
           Inscrit le {$user->registration_date|date_format}
+          {/if}
         </div>
         <div style="float: left; text-align: left">
           {icon name=user_gray} {$user->hruid} (uid {$user->id()})
index e576392..ad35662 100644 (file)
 {to addr=#to#}
 {subject text="INTERVENTION de $admin"}
 {elseif $mail_part eq 'wiki'}
-{if $deletion}
-L'utilisateur {$user} a été désinscrit de plat/al.
-{else}
-Le profil du camarade {$old.prenom} {$old.nom} ({$old.promo}) a été édité.\\
+
+Le compte de l'utilisateur {$hruid} a été édité.\\
 Les champs suivants ont été changés :
-{foreach from=$old item=value key=field}
-{if $value neq $new[$field]}
-* '''{$field}''' : {$value} -> {$new[$field]}
-{/if}
+{foreach from=$diff item=values key=field}
+* '''{$field}''' : {$values.0} -> {$values.1}
 {/foreach}
 
 Et ceux qui n'ont pas changé :
-{foreach from=$old item=value key=field}
-{if $value eq $new[$field]}
+{foreach from=$oldValues item=value key=field}
 * '''{$field}''' : {$value}
-{/if}
 {/foreach}
 {/if}
-{/if}
 
 {* vim:set et sw=2 sts=2 sws=2: *}
index 924bc0a..8c0cb21 100644 (file)
@@ -46,12 +46,15 @@ function toggleField(name, id, obj) {
   <tr>
     <td class="titre" style="width: 20%">Demandeur&nbsp;:</td>
     <td>
-      <a href="profile/{$valid->user->login()}" class="popup2">
-        {$valid->user->fullName()} ({$valid->user->promo()})
+      {if $valid->user->hasProfile()}
+      {assign var="profile" value=$valid->user->profile()}
+      <a href="profile/{$profile->hrpid}" class="popup2">
+      {/if}
+        {$valid->user->fullName("promo")}
       </a>
     </td>
   </tr>
-  {if $valid->profile}
+  {if $valid->profile && !$valid->userIsProfileOwner}
   <tr>
     <td class="titre" style="width: 20%">Profil concerné&nbsp;:</td>
     <td>
index c5e8069..b88b872 100644 (file)
@@ -51,8 +51,8 @@
     {if !$dead && $registered}</a>{/if}
   </div>
   <div class="autre">
-    {foreach from=$profile->nationalities() item=nat}
-    <img src='images/flags/{$nat}.gif' alt='{$nat}' height='11' title='{$nat}' />&nbsp;
+    {foreach from=$profile->nationalities() item=country key=code}
+    <img src='images/flags/{$code}.gif' alt='{$code}' height='11' title='{$country}' />&nbsp;
     {/foreach}
     {$profile->promo()}{*
     *}{if $dead}, {"décédé"|sex:"décédée":$profile} le {$profile->deathdate|date_format}{/if}
index 1fce6e7..7b59719 100644 (file)
@@ -27,7 +27,7 @@
 <strong>Site web&nbsp;:</strong>
 <input type="text" name="url" size="25" maxlength="200" value="{$valid->url}" /><br />
 <strong>Email&nbsp;:</strong>
-<input type="text" name="url" size="25" maxlength="200" value="{$valid->email}" /><br />
+<input type="text" name="email" size="25" maxlength="200" value="{$valid->email}" /><br />
 <strong>Holding&nbsp;:</strong>
 <input type="text" name="holdingid" size="25" maxlength="200" value="{$valid->holdingid}" /><br />
 <strong>Code NAF&nbsp;:</strong>
@@ -35,7 +35,7 @@
 <strong>Code AX&nbsp;:</strong>
 <input type="text" name="AX_code" size="25" maxlength="200" value="{$valid->AX_code}" /><br />
 <strong>Adresse&nbsp;:</strong>
-<textarea cols="30" rows="4" name="address">{$valid->address['text']}</textarea><br />
+<textarea cols="30" rows="4" name="address">{$valid->address.text}</textarea><br />
 <strong>Téléphone&nbsp;:</strong>
 <input type="text" name="tel" size="25" maxlength="200" value="{$valid->tel}" /><br />
 <strong>Fax&nbsp;:</strong>
index 58112e1..855ade8 100644 (file)
@@ -55,7 +55,7 @@
 </tr>
 <tr class="pair">
   <td class="titre">Adresse&nbsp;:</td>
-  <td>{$valid->address[text]}</td>
+  <td>{$valid->address.text}</td>
 </tr>
 <tr class="pair">
   <td class="titre">Téléphone&nbsp;:</td>
index d41a48c..e018b4b 100644 (file)
     <div class="nom">
       {if $profile->isFemale()}&bull;{/if}
       {if !$dead && $registered}<a href="profile/{$profile->hrid()}" class="popup2">{/if}
-      {$profile->full_name}
+      {$profile->directory_name}
       {if !$dead && $registered}</a>{/if}
     </div>
 
     <div class="edu">
-      {foreach from=$profile->nationalities() item=nat}
-      <img src='images/flags/{$nat}.gif' alt='{$nat}' height='11' title='{$nat}' />&nbsp;
+      {foreach from=$profile->nationalities() item=country key=code}
+      <img src='images/flags/{$code}.gif' alt='{$code}' height='11' title='{$country}' />&nbsp;
       {/foreach}
       {$profile->promo()}{*
       *}{foreach from=$profile->getExtraEducations(4) item=edu}, {display_education edu=$edu profile=$profile}{/foreach}{*
index ea6dbcc..24e157d 100644 (file)
@@ -33,9 +33,7 @@
 {else}
 <td class="center" style="vertical-align: bottom; padding-bottom: 15px">
   <a href="profile/{$profile->hrid()}" class="popup2">
-    <span {if $profile->name_tooltip}class="hinted"
-    title="{$profile->directory_name}"{/if}>{$profile->directory_name}</span> 
-    {if $trombi_with_promo && $profile->promo()}({$profile->promo()}){/if}
+    {$profile->private_name} {if $trombi_with_promo && $profile->promo()}({$profile->promo()}){/if}
   </a>
 </td>
 {/if}
index e389a9d..f3ec1e7 100644 (file)
@@ -37,7 +37,7 @@
       {/if}
       <br />
       <a href="{if $urlmainsite}{$urlmainsite}{/if}profile/{$p.forlife}" class="popup2">
-        <span {if $p.name_tooltip}class="hinted" title="{$p.name_tooltip}"{/if}>{$p.name_display}</span>{if $trombi_show_promo} ({$p.promo_display}){/if}
+        {$p.name_display}{if $trombi_show_promo} ({$p.promo_display}){/if}
       </a>
     </td>
   {if $loop eq "3"}
index adaa262..8e66640 100644 (file)
 
   </tr>
 
-  {foreach from=$members item=xs key=promo}
-  {foreach from=$xs item=x name=all}
+  {foreach from=$members item=users key=promo}
+  {foreach from=$users item=user}
   <tr>
     <td class='titre' style="width: 20%">
       {if $smarty.foreach.all.first}
       {/if}
     </td>
     <td>
-      {if $promo && strpos($x.l, '@') === false}
-      {if $x.b}<a href="https://www.polytechnique.org/marketing/broken/{$x.l}">{icon name=error}</a>{/if}
-      <a href="profile/{$x.l}" class="popup2">{$x.n}</a>
-      {elseif $x.x}
-      <a href="{$platal->ns}member/{$x.x}">{if $x.n|trim}{$x.n}{else}{$x.l}{/if}</a>
-      {elseif $x.n}
-      {$x.n}
+      {if $promo && $user.x}
+      {profile user=$user.x promo=false}
+      {elseif $user.x}
+      <a href="{$platal->ns}member/{$user.x}">{if $user.n|trim}{$x.n}{else}{$user.l}{/if}</a>
+      {elseif $user.n}
+      {$user.n}
       {else}
-      {$x.l}
+      {$user.l}
       {/if}
     </td>
-    {if $x.p}
+    {if $user.p}
     <td class="right">
-      {$x.p}
+      {$user.p}
     </td>
     {/if}
   </tr>
index 1c9f0e2..f620df9 100644 (file)
@@ -28,7 +28,7 @@
 
 {elseif $user && !$user->alive}
 <p class="erreur">
-  {$user->fullName()} (X{$user->promo()}) est malheureusement décédé{if $user->isFemale()}e{/if}.
+  {$user->fullName("promo")} est malheureusement décédé{if $user->isFemale()}e{/if}.
   Nous ne réaliserons maintenance sur son adresse Polytechnique.org qu'à la demande explicite
   de sa famille. Pour tout renseignement, merci de <a href="mailto:contact@polytechnique.org">
   contacter le support</a>.
@@ -36,7 +36,7 @@
 
 {elseif $user}
 <h1>
-  Recherche d'adresses pour {$user->fullName()} (X{$user->promo()}).
+  Recherche d'adresses pour {$user->fullName("promo")}.
 </h1>
 
 {if !$user->email}
@@ -70,7 +70,7 @@
 <form method="post" action="{$platal->path}">
   {xsrf_token_field}
   <table class="bicol" summary="Fiche camarade">
-    <tr><th colspan="2">Proposition d'adresse pour<br />{$user->fullName()} (X{$user->promo()})</th></tr>
+    <tr><th colspan="2">Proposition d'adresse pour<br />{$user->fullName("promo")}</th></tr>
     <tr class="pair">
       <td>Adresse email&nbsp;:</td>
       <td>
index 1694238..c5d27aa 100644 (file)
 <br />
 
 <p>
-Nombre d'X vivants d'après notre base de données&nbsp;: {$stats.vivants}<br />
-Nombre d'X vivants inscrits à Polytechnique.org&nbsp;: {$stats.inscrits}<br />
-Soit un pourcentage d'inscrits de&nbsp;: {$stats.ins_rate} %<br />
+nombre d'X vivants d'après notre base de données&nbsp;: {$statistics.alive}<br />
+nombre d'X vivants inscrits à Polytechnique.org&nbsp;: {$statistics.registered}<br />
+Soit un pourcentage d'inscrits de&nbsp;: {$statistics.registeredRate} %<br />
 </p>
 
 <p>
 Parmi ceux-ci&nbsp;:<br />
-Nombre d'X vivants depuis 1972 d'après notre base de données&nbsp;: {$stats.vivants72}<br />
-Nombre d'X vivants depuis 1972 inscrits à Polytechnique.org&nbsp;: {$stats.inscrits72}<br />
-Soit un pourcentage d'inscrits de&nbsp;: {$stats.ins72_rate} %<br />
+nombre d'X vivants depuis 1972 d'après notre base de données&nbsp;: {$statistics.alive72}<br />
+nombre d'X vivants depuis 1972 inscrits à Polytechnique.org&nbsp;: {$statistics.registered72}<br />
+Soit un pourcentage d'inscrits de&nbsp;: {$statistics.registeredRate72} %<br />
 </p>
 
 <p>
-Nombre de Polytechniciennes vivantes&nbsp;: {$stats.vivantes}<br />
-Nombre de Polytechniciennes vivantes et inscrites&nbsp;: {$stats.inscrites}<br />
-Soit un pourcentage d'inscrites de&nbsp;: {$stats.inse_rate} %<br />
+nombre de Polytechniciennes vivantes&nbsp;: {$statistics.womenAlive}<br />
+nombre de Polytechniciennes vivantes et inscrites&nbsp;: {$statistics.womenRegistered}<br />
+Soit un pourcentage d'inscrites de&nbsp;: {$statistics.womenRegisteredRate} %<br />
 </p>
 
 <p>
-Nombre d'<a href="marketing/this_week">inscrits ces 7 derniers jours</a>&nbsp;: {$nbInsSem}<br />
-Nombre d'<a href="marketing/relance">inscriptions en cours</a> (2ème phase non terminée)&nbsp;: {$nbInsEnCours}
+nombre d'<a href="marketing/this_week">inscrits ces 7 derniers jours</a>&nbsp;: {$registrations.week}<br />
+nombre d'<a href="marketing/relance">inscriptions en cours</a> (2ème phase non terminée)&nbsp;: {$registrations.pending}
 </p>
 
 <table class="bicol">
@@ -69,34 +69,37 @@ Nombre d'<a href="marketing/relance">inscriptions en cours</a> (2ème phase non
   </tr>
   <tr>
     <td>&nbsp;</td>
-    <td class="titre">Abouti</td>
     <td class="titre">Non abouti</td>
+    <td class="titre">Abouti</td>
     <td class="titre">Total</td>
   </tr>
   <tr>
     <td>Personnel</td>
-    <td>{$nbInsMarketOkPerso}</td>
-    <td>{$nbInsMarketNoPerso}</td>
-    <td>{$nbInsMarketOkPerso+$nbInsMarketNoPerso}</td>
+    <td>{$marketings.noPerso}</td>
+    <td rowspan="3" style="vertical-align: middle">{$marketings.ok}</td>
+    <td rowspan="3" style="vertical-align: middle">{$marketings.ok+$marketings.noPerso+$marketings.noXorg+$marketings.noAX}</td>
   </tr>
   <tr>
     <td>Par Polytechnique.org</td>
-    <td>{$nbInsMarketOkXorg}</td>
-    <td>{$nbInsMarketNoXorg}</td>
-    <td>{$nbInsMarketOkXorg+$nbInsMarketNoXorg}</td>
+    <td>{$marketings.noXorg}</td>
+  </tr>
+  <tr>
+    <td>Par l'AX</td>
+    <td>{$marketings.noAX}</td>
   </tr>
   <tr>
     <td>Cette semaine</td>
-    <td>{$nbInsMarketOkWeek}</td>
-    <td>{$nbInsMarketNoWeek}</td>
-    <td>{$nbInsMarketOkWeek+$nbInsMarketNoWeek}</td>
+    <td>{$marketings.noWeek}</td>
+    <td>{$marketings.okWeek}</td>
+    <td>{$marketings.okWeek+$marketings.noWeek}</td>
   </tr>
   <tr>
     <td class="titre">Total</td>
-    <td>{$nbInsMarketOkPerso+$nbInsMarketOkXorg}</td>
-    <td>{$nbInsMarketNoPerso+$nbInsMarketNoXorg}</td>
-    <td>{$nbInsMarketOkPerso+$nbInsMarketOkXorg+$nbInsMarketNoPerso+$nbInsMarketNoXorg}</td>
+    <td>{$marketings.noPerso+$marketings.noXorg+$marketings.noAX}</td>
+    <td>{$marketings.ok}</td>
+    <td>{$marketings.ok+$marketings.noPerso+$marketings.noXorg+$marketings.noAX}</td>
   </tr>
 </table>
 
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
+
index 6b786c9..dbaff61 100644 (file)
@@ -27,7 +27,7 @@
 {#globals.baseurl#}/register/%%hash%%
 ==========================================================
 
-Il ne te faut que 5 minutes sur https://www.polytechnique.org/ pour rejoindre la communauté polytechnicienne sur le web grâce aux services de Polytechnique.org dont profitent déjà {$num_users} camarades. Cela te permettra, entre autres, de contacter un X en connaissant seulement son nom et son prénom et de bénéficier à vie d'une adresse prestigieuse {$u.forlife_email} et de son alias discret {$u.forlife_email2} (m4x = mail for X).
+Il ne te faut que 5 minutes sur https://www.polytechnique.org/ pour rejoindre la communauté polytechnicienne sur le web grâce aux services de Polytechnique.org dont profitent déjà {$globals->core->NbIns|number_format} camarades. Cela te permettra, entre autres, de contacter un X en connaissant seulement son nom et son prénom et de bénéficier à vie d'une adresse prestigieuse {$u.forlife_email} et de son alias discret {$u.forlife_email2} (m4x = mail for X).
 
 Pas de nouvelle boîte aux lettres à relever, il suffit de la rediriger vers ton adresse personnelle et/ou professionnelle que tu indiques et que tu peux changer à ta guise, sans que tes correspondants n'aient à actualiser leur carnet d'adresses.
 
index 0cdf5a2..f157b6c 100644 (file)
       <td>{profile user=$it}</td>
       <td>{if $it->lastKnownEmail()}{mailto address=$it->lastKnownEmail()}{/if}</td>
       <td class="center">
-        {if $it->lastMarketingRelance() && $it->lastMarketingRelance() != '0000-00-00'}
-        Relance le&nbsp;: {$it->lastMarketingRelance()}
-        {elseif $it->lastKnownEmail()}
-        En cours&nbsp;: {$it->lastKnownEmail()}
+        {if $it->pendingRegistrationDate() > $it->lastMarketingDate()}
+        En cours&nbsp;: {$it->pendingRegistrationEmail()}
+        {elseif $it->lastMarketingDate() && $it->lastMarketingDate() != '0000-00-00'}
+        Relance le&nbsp;: {$it->lastMarketingDate()}
         {else}
         -
         {/if}
index aae79e1..cdac3c3 100644 (file)
@@ -22,7 +22,7 @@
 
 <table class="bicol" style="margin-bottom: 1em" summary="Profil : Noms">
   <tr>
-    <th colspan="3">Noms</th>
+    <th colspan="3">Noms{if $validation} <small>(validations en attente de modération)</small>{/if}</th>
   </tr>
   <tr>
     <td class="titre">
index 52688b9..44ea740 100644 (file)
@@ -20,7 +20,7 @@
 {*                                                                        *}
 {**************************************************************************}
 
-<div>{icon name=information title="Afficher ma fiche référent"}Tu peux consulter ta <a class="popup2" href="referent/{$smarty.session.hruid}">fiche référent</a> qui n'est accessible que par les X.
+<div>{icon name=information title="Afficher ma fiche référent"}Tu peux consulter ta <a class="popup2" href="referent/{$hrpid}">fiche référent</a> qui n'est accessible que par les X.
 </div>
 {if (!$expertise)||(!($sectors|@count))}
   <br /><div>
diff --git a/templates/profile/notification.mail.tpl b/templates/profile/notification.mail.tpl
new file mode 100644 (file)
index 0000000..26c3cb4
--- /dev/null
@@ -0,0 +1,45 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  Copyright (C) 2003-2010 Polytechnique.org                             *}
+{*  http://opensource.polytechnique.org/                                  *}
+{*                                                                        *}
+{*  This program is free software; you can redistribute it and/or modify  *}
+{*  it under the terms of the GNU General Public License as published by  *}
+{*  the Free Software Foundation; either version 2 of the License, or     *}
+{*  (at your option) any later version.                                   *}
+{*                                                                        *}
+{*  This program is distributed in the hope that it will be useful,       *}
+{*  but WITHOUT ANY WARRANTY; without even the implied warranty of        *}
+{*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *}
+{*  GNU General Public License for more details.                          *}
+{*                                                                        *}
+{*  You should have received a copy of the GNU General Public License     *}
+{*  along with this program; if not, write to the Free Software           *}
+{*  Foundation, Inc.,                                                     *}
+{*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA               *}
+{*                                                                        *}
+{**************************************************************************}
+
+{config_load file="mails.conf" section="profile"}
+{if $mail_part eq 'head'}
+{from full=#from#}
+{cc full=#cc#}
+{subject text="Modification de ton profil"}
+{elseif $mail_part eq 'wiki'}
+{if $sex}Chère{else}Cher{/if} {$yourself},
+
+Les champs suivants de ton profil ont été modifiés le {$date|date_format:"%x"} :
+{foreach from=$modifications item=modification}
+*{$modification.field} : « {$modification.oldText} » est devenu « {$modification.newText} » (effectuée par {$modification.full_name}).
+{/foreach}
+
+Tu peux voir ta fiche là :
+*{$globals->baseurl}/profile/{$hrpid}
+Tu peux aussi l'éditer toi-même là :
+*{$globals->baseurl}/profile/edit/{$hrpid}
+
+{include file="signature.mail.tpl"}
+
+{/if}
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index 759bff1..2da1c39 100644 (file)
@@ -42,7 +42,7 @@ function chgMainWinLoc(strPage)
 <div id="fiche">
   <div id="photo" class="part">
     {assign var=photo value=$profile->getPhoto(false)}
-    {if $photo}<img alt="Photo de {$profile->fullName()}" src="photo/{$profile->hrid()}" width="{$photo->width()}"/>{/if}
+    {if $photo}<img alt="Photo de {$profile->fullName()}" src="photo/{$profile->hrid()}{if $with_pending_pic}/req{/if}" width="{$photo->width()}"/>{/if}
 
     {if $logged && $view eq 'private' && ( $profile->section|smarty:nodefaults || $profile->getBinets()|smarty:nodefaults || ($owner && $owner->groups()|smarty:nodefaults))}
       <h2>À l'X&hellip;</h2>
@@ -87,10 +87,7 @@ function chgMainWinLoc(strPage)
   <div id="fiche_identite" class="part">
     <div class="civilite">
       {if $profile->isFemale()}&bull;{/if}
-        <span {if $profile->name_tooltip neq ""}class="hinted" title="{$profile->name_tooltip}"{/if}>{$profile->shortName()}</span>
-      {if $logged}
-        {if $profile->nickname} (alias {$profile->nickname}){/if}
-      {/if}
+        {if $logged}{$profile->private_name}{else}{$profile->public_name}{/if}
 
       {if $logged}
         &nbsp;{if !$profile->isDead()}<a href="vcard/{$owner->login()}.vcf">{*
@@ -158,8 +155,8 @@ function chgMainWinLoc(strPage)
     {/if}
 
     <div class='formation'>
-      {foreach from=$profile->nationalities() item=nat}
-        <img src='images/flags/{$nat}.gif' alt='{$nat}' height='11' title='{$nat}' />&nbsp;
+      {foreach from=$profile->nationalities() item=country key=code}
+      <img src='images/flags/{$code}.gif' alt='{$code}' height='11' title='{$country}' />&nbsp;
       {/foreach}
 
       {$profile->promo()}
index 184f8f8..89a83d0 100644 (file)
                 {$globals->core->NbIns|number_format} polytechniciens sur le web
                 <form action="search" method="get">
                     <div>
+                        <button id="quick_button" type="submit" style="display: none"
+                                onclick="if ($('#quick').val() === 'Recherche dans l\'annuaire') $('#quick').val('')">
+                          OK
+                        </button>
                         <input type="text" size="20" name="quick" id="quick" class="quick_search"
                                value="{$smarty.request.quick|default:'Recherche dans l\'annuaire'}"
                                onfocus="if (this.value === 'Recherche dans l\'annuaire') this.value='';
                                         $('#quick_button').show()"
                                onblur="if (this.value === '') this.value='{$smarty.request.quick|default:'Recherche dans l\'annuaire'|escape:javascript}'"
                                />
-                        <button id="quick_button" type="submit" style="display: none"
-                                onclick="if ($('#quick').val() === 'Recherche dans l\'annuaire') $('#quick').val('')">
-                          OK
-                        </button>
                     </div>
                 </form>
                 {if $smarty.session.auth gt AUTH_PUBLIC && $smarty.session.notifs}
diff --git a/upgrade/1.0.1/00_job.sql b/upgrade/1.0.1/00_job.sql
new file mode 100644 (file)
index 0000000..4b6b5dd
--- /dev/null
@@ -0,0 +1,6 @@
+ALTER TABLE profile_job_enum MODIFY COLUMN acronym VARCHAR(255) DEFAULT NULL;
+ALTER TABLE profile_job_enum MODIFY COLUMN url VARCHAR(255) DEFAULT NULL;
+ALTER TABLE profile_job_enum MODIFY COLUMN email VARCHAR(255) DEFAULT NULL;
+ALTER TABLE profile_job_enum MODIFY COLUMN NAF_code CHAR(5) DEFAULT NULL;
+
+-- vim:set syntax=mysql:
diff --git a/upgrade/1.0.1/01_profiles.sql b/upgrade/1.0.1/01_profiles.sql
new file mode 100644 (file)
index 0000000..c7187ae
--- /dev/null
@@ -0,0 +1,13 @@
+DROP TABLE IF EXISTS profile_modifications;
+
+CREATE TABLE profile_modifications (
+  pid INT(11) NOT NULL,
+  uid INT(11) NOT NULL,
+  field VARCHAR(60) NOT NULL,
+  oldText TEXT NOT NULL,
+  newText TEXT NOT NULL,
+  pub ENUM('private', 'ax', 'public') NOT NULL DEFAULT 'private',
+  PRIMARY KEY(pid, uid, field)
+) ENGINE=InnoDB, CHARSET=utf8;
+
+-- vim:set syntax=mysql:
diff --git a/upgrade/1.0.1/connect.db.inc.php b/upgrade/1.0.1/connect.db.inc.php
new file mode 120000 (symlink)
index 0000000..442fab7
--- /dev/null
@@ -0,0 +1 @@
+../../bin/connect.db.inc.php
\ No newline at end of file
diff --git a/upgrade/1.0.1/phone.php b/upgrade/1.0.1/phone.php
new file mode 100755 (executable)
index 0000000..4239ece
--- /dev/null
@@ -0,0 +1,58 @@
+#!/usr/bin/php5
+<?php
+require_once 'connect.db.inc.php';
+
+$globals->debug = 0; //do not store backtraces
+
+$phones = array(
+    'AF' => '93',
+    'AN' => '599',
+    'BY' => '375',
+    'FM' => '691',
+    'GE' => '995',
+    'GL' => '299',
+    'ID' => '62',
+    'IL' => '972',
+    'IN' => '91',
+    'IQ' => '964',
+    'IR' => '98',
+    'JO' => '962',
+    'JP' => '81',
+    'KG' => '996',
+    'KW' => '965',
+    'KZ' => '7',
+    'LA' => '856',
+    'LB' => '961',
+    'LK' => '94',
+    'MM' => '95',
+    'MN' => '976',
+    'MV' => '960',
+    'MY' => '60',
+    'NP' => '977',
+    'OM' => '968',
+    'PH' => '63',
+    'PK' => '92',
+    'QA' => '974',
+    'SA' => '966',
+    'SG' => '65',
+    'SY' => '963',
+    'TH' => '66',
+    'TJ' => '992',
+    'TM' => '993',
+    'TR' => '90',
+    'TW' => '886',
+    'UZ' => '998',
+    'VG' => '1284',
+    'VN' => '84',
+    'YE' => '967',
+);
+
+foreach ($phones as $country => $phone) {
+    XDB::execute('UPDATE  geoloc_countries
+                     SET  phonePrefix = {?}
+                   WHERE  iso_3166_1_a2 = {?}',
+                 $phone, $country);
+}
+
+/* vim:set et sw=4 sts=4 ts=4: */
+?>