Merge branch 'platal-1.0.0'
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 17 Sep 2010 12:36:31 +0000 (14:36 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 17 Sep 2010 12:36:31 +0000 (14:36 +0200)
Conflicts:
core

Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
1  2 
core
include/ufbuilder.inc.php
modules/axletter/axletter.inc.php

diff --combined core
--- 1/core
--- 2/core
+++ b/core
@@@ -1,1 -1,1 +1,1 @@@
- Subproject commit adf0fa2119688cf61ca23b7bc23b0730af702c6d
 -Subproject commit 1b54ef260c1db3f94830fb6f9b1b13aeb9fcdb78
++Subproject commit 3c7bc7a377e3d5422f61b92ddf69c4a953ad3d15
@@@ -140,18 -140,6 +140,18 @@@ class UserFilterBuilde
          return Env::blank($key, $strict);
      }
  
 +    public function hasAlnum($key)
 +    {
 +        $str = $this->s($key);
 +        return preg_match('/[a-z0-9]/i', $str);
 +    }
 +
 +    public function hasAlpha($key)
 +    {
 +        $str = $this->s($key);
 +        return preg_match('/[a-z]/i', $str);
 +    }
 +
      public function isOn($key)
      {
          return $this->has($key) && $this->t($key) == 'on';
@@@ -193,7 -181,6 +193,7 @@@ class UFB_AdvancedSearch extends UserFi
              new UFBF_JobSector('sector', 'Poste'),
              new UFBF_JobDescription('jobdescription', 'Fonction'),
              new UFBF_JobCv('cv', 'CV'),
 +            new UFBF_JobTerms('jobterm', 'Mots-clefs'),
  
              new UFBF_Nationality('nationaliteTxt', 'nationalite', 'Nationalité'),
              new UFBF_Binet('binetTxt', 'binet', 'Binet'),
              new UFBF_Comment('free', 'Commentaire'),
              new UFBF_Phone('phone_number', 'Téléphone'),
              new UFBF_Networking('networking_address', 'networking_type', 'Networking et sites webs'),
 +
 +            new UFBF_Mentor('only_referent', 'Référent'),
          );
          parent::__construct($fields, $envprefix);
      }
@@@ -221,8 -206,9 +221,8 @@@ class UFB_MentorSearch extends UserFilt
      public function __construct($envprefix = '')
      {
          $fields = array(
 -            new UFBF_MentorCountry('pays_sel'),
 -            new UFBF_MentorSectorization('sector', '', UFC_Mentor_Sectorization::SECTOR),
 -            new UFBF_MentorSectorization('subSector', '', UFC_Mentor_Sectorization::SUBSECTOR),
 +            new UFBF_MentorCountry('country'),
 +            new UFBF_MentorTerm('jobterm', 'jobtermText'),
              new UFBF_MentorExpertise('expertise'),
          );
          parent::__construct($fields, $envprefix);
@@@ -322,7 -308,7 +322,7 @@@ abstract class UFBF_Text extends UFB_Fi
              return $this->raise("Le champ %s est trop court (minimum {$this->minlength}).");
          } else if (strlen($this->val) > $this->maxlength) {
              return $this->raise("Le champ %s est trop long (maximum {$this->maxlength}).");
-         } else if (preg_match(":[\]\[<>{}~/§_`|%$^=+]|\*\*:u", $this->val)) {
+         } else if (preg_match(":[\]\[<>{}~§_`|%$^=]|\*\*:u", $this->val)) {
              return $this->raise('Le champ %s contient un caractère interdit rendant la recherche impossible.');
          }
  
@@@ -450,7 -436,7 +450,7 @@@ abstract class UFBF_Mixed extends UFB_F
  
      protected function check(UserFilterBuilder &$ufb)
      {
 -        if ($ufb->blank($this->envfieldindex) && $ufb->blank($this->envfield)) {
 +        if ($ufb->blank($this->envfieldindex) && !$ufb->hasAlnum($this->envfield)) {
              $this->empty = true;
              return true;
          }
              }
              $this->val = array($index);
          } else {
 -            $indexes = DirEnum::getIDs($this->direnum, $ufb->t($this->envfield), 
 +            $indexes = DirEnum::getIDs($this->direnum, $ufb->t($this->envfield),
                  $ufb->b('exact') ? XDB::WILDCARD_EXACT : XDB::WILDCARD_CONTAINS);
              if (count($indexes) == 0) {
                  return false;
@@@ -856,16 -842,6 +856,16 @@@ class UFBF_JobSector extends UFBF_Mixe
  }
  // }}}
  
 +// {{{ class UFBF_JobTerms
 +class UFBF_JobTerms extends UFBF_Index
 +{
 +    protected function buildUFC(UserFilterBuilder &$ufb)
 +    {
 +        return new UFC_Job_Terms($this->val);
 +    }
 +}
 +// }}}
 +
  // {{{ class UFBF_JobDescription
  class UFBF_JobDescription extends UFBF_Text
  {
@@@ -1051,16 -1027,6 +1051,16 @@@ class UFBF_Networking extends UFBF_Tex
  }
  // }}}
  
 +// {{{ class UFBF_Mentor
 +class UFBF_Mentor extends UFBF_Bool
 +{
 +    protected function buildUFC(UserFilterBuilder &$ufb)
 +    {
 +        return new UFC_Mentor();
 +    }
 +}
 +// }}}
 +
  // {{{ class UFBF_MentorCountry
  class UFBF_MentorCountry extends UFBF_Text
  {
  }
  // }}}
  
 +// {{{ class UFBF_Mentorterm
 +class UFBF_MentorTerm extends UFBF_Index
 +{
 +    protected function buildUFC(UserFilterBuilder &$ufb)
 +    {
 +        return new UFC_Mentor_Terms($this->val);
 +    }
 +}
 +// }}}
 +
  // {{{ class UFBF_MentorSectorization
  class UFBF_MentorSectorization extends UFBF_Index
  {
@@@ -175,13 -175,12 +175,13 @@@ class AXLetter extends MassMaile
          if (!$this->_promo_min && !$this->_promo_max && !$this->_subset) {
              return '1';
          }
 +        /* TODO: refines this filter on promotions by using userfilter. */
          $where = array();
          if ($this->_promo_min) {
-             $where[] = "((ni.uid = 0 AND ni.promo >= {$this->_promo_min}) OR (ni.uid != 0 AND u.promo >= {$this->_promo_min}))";
+             $where[] = "((ni.uid = 0 AND ni.promo >= {$this->_promo_min}) OR (ni.uid != 0 AND pd.promo >= 'X{$this->_promo_min}'))";
          }
          if ($this->_promo_max) {
-             $where[] = "((ni.uid = 0 AND ni.promo <= {$this->_promo_max}) OR (ni.uid != 0 AND u.promo <= {$this->_promo_max}))";
+             $where[] = "((ni.uid = 0 AND ni.promo <= {$this->_promo_max}) OR (ni.uid != 0 AND pd.promo <= 'X{$this->_promo_max}'))";
          }
          if ($this->_subset) {
              require_once("emails.inc.php");