Changeset 2617


Ignore:
Timestamp:
Jan 31, 2012, 2:07:04 PM (8 years ago)
Author:
goya
Message:

add check prenoms to fix wrong person association in commissions

Location:
cpc/trunk/project/lib/model/doctrine
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpc/trunk/project/lib/model/doctrine/Intervention.class.php

    r2591 r2617  
    7070      $personne = Doctrine::getTable('Parlementaire')->findOneByNom($nom);
    7171      if (!$personne && ($this->type != "commission" || $fonction == null || preg_match('/(rapporteur|présidente?$)/i', $fonction))) {
    72         $personne = Doctrine::getTable('Parlementaire')->similarTo($nom);
     72        $personne = Doctrine::getTable('Parlementaire')->similarToCheckPrenom($nom);
    7373      }
    7474      if ($personne) {
  • cpc/trunk/project/lib/model/doctrine/PersonnaliteTable.class.php

    r774 r2617  
    77  protected $changed = 0;
    88  protected $all = null;
     9
     10  public function similarToCheckPrenom($str, $sexe = null, $return_array = 0, $year = 0) {
     11    $str = preg_replace('/\(.*\)/', '', $str);
     12    $str = preg_replace('/[\(\)]/', '', $str);
     13    $first = preg_replace('/[\WàÀéèÉÈêÊîÎïÏôÔüÜùÙ]/', '.', strtolower(preg_replace('/^\s*(\S{4}).*$/i', '\\1', $str)));
     14    $res = $this->similarTo($str, $sexe, $return_array, $year);
     15    if ($res && (preg_match("/^".$first."/i", $res->getNom()) || preg_match("/^".$first."/i", $res->getNomDeFamille())))
     16      return $res;
     17    return null;
     18  }
     19
    920  public function similarTo($str, $sexe = null, $return_array = 0)
    1021  {
Note: See TracChangeset for help on using the changeset viewer.