Fix: bug #19091 : Problème avec les apostrophes dans le nom de famille

This commit is contained in:
Laurent Destailleur 2007-02-25 23:08:25 +00:00
parent 2368182243
commit 0049201b44
2 changed files with 18 additions and 10 deletions

View File

@ -93,9 +93,11 @@ class Contact
$sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople (datec, fk_soc, name, fk_user)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople (datec, fk_soc, name, fk_user)";
$sql.= " VALUES (now(),"; $sql.= " VALUES (now(),";
if ($this->socid > 0) $sql.= " $this->socid,"; if ($this->socid > 0) $sql.= " ".$this->socid.",";
else $sql.= "null,"; else $sql.= "null,";
$sql.= "'$this->name',$user->id)"; $sql.= "'".addslashes($this->name)."',";
$sql.= $user->id;
$sql.= ")";
dolibarr_syslog("Contact.class::create sql=".$sql); dolibarr_syslog("Contact.class::create sql=".$sql);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
@ -156,9 +158,9 @@ class Contact
} }
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET "; $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET ";
if ($this->socid > 0) $sql .= " fk_soc='".addslashes($this->socid)."'"; if ($this->socid > 0) $sql .= " fk_soc='".addslashes($this->socid)."',";
if ($this->socid == -1) $sql .= " fk_soc=null"; if ($this->socid == -1) $sql .= " fk_soc=null,";
$sql .= ", civilite='".addslashes($this->civilite_id)."'"; $sql .= " civilite='".addslashes($this->civilite_id)."'";
$sql .= ", name='".addslashes($this->name)."'"; $sql .= ", name='".addslashes($this->name)."'";
$sql .= ", firstname='".addslashes($this->firstname)."'"; $sql .= ", firstname='".addslashes($this->firstname)."'";
$sql .= ", address='".addslashes($this->address)."'"; $sql .= ", address='".addslashes($this->address)."'";

View File

@ -71,9 +71,11 @@ if ($contactid && !$user->rights->commercial->client->voir)
} }
} }
if ($user->rights->societe->contact->creer)
// Creation utilisateur depuis contact
if ($user->rights->user->user->creer)
{ {
if ($_GET["action"] == 'create_user' && $user->admin) if ($_GET["action"] == 'create_user')
{ {
// Recuperation contact actuel // Recuperation contact actuel
$contact = new Contact($db); $contact = new Contact($db);
@ -87,6 +89,7 @@ if ($user->rights->societe->contact->creer)
} }
} }
// Creation contact
if ($user->rights->societe->contact->creer) if ($user->rights->societe->contact->creer)
{ {
if ($_POST["action"] == 'add') if ($_POST["action"] == 'add')
@ -126,9 +129,12 @@ if ($user->rights->societe->contact->creer)
Header("Location: fiche.php?id=".$id); Header("Location: fiche.php?id=".$id);
exit; exit;
} }
else
$error=array($contact->error); {
} $error=array($contact->error);
$_GET["action"] = 'create';
}
}
} }
} }