Merge commit 'origin/master' into fusionax
[platal.git] / include / validations / entreprises.inc.php
index a16bc7d..635173d 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
+ *  Copyright (C) 2003-2009 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -45,7 +45,7 @@ class EntrReq extends Validate
 
     public function __construct(User &$_user, $_id, $_name, $_acronym, $_url, $_email, $_tel, $_fax, $_stamp = 0)
     {
-        parent::__construct($_user, true, 'entreprise', $_stamp);
+        parent::__construct($_user, false, 'entreprise', $_stamp);
         $this->id       = $_id;
         $this->name     = $_name;
         $this->acronym  = $_acronym;
@@ -54,8 +54,7 @@ class EntrReq extends Validate
         $this->tel      = $_tel;
         $this->fax      = $_fax;
 
-        $separators  = array("&", "(", ")", "-", "_", ",", ";", ".", ":", "/", "\\", "\'", "\"");
-        $replacement = array(" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ");
+        $_name       = preg_replace('/[^0-9a-z]/i', ' ', strtolower(replace_accent($_name)));
         $name        = explode(" ", $_name);
         $name_array  = array_map("trim", $name);
         $length      = count($name_array);
@@ -74,7 +73,6 @@ class EntrReq extends Validate
                           . $where);
         $this->suggestions = "| ";
         while ($sug = $res->next()) {
-            var_dump($sug);
             $this->suggestions .= $sug['name'] . " | ";
         }
     }