diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php
index 701e84b1f66..a167d7c7850 100644
--- a/htdocs/adherents/adherent.class.php
+++ b/htdocs/adherents/adherent.class.php
@@ -167,7 +167,7 @@ class Adherent
/*!
- \brief fonction qui renvoie la nature physique ou morale d'un adherent
+ \brief fonction qui renvoie la nature physique ou morale d'un adherent
\param morphy nature physique ou morale de l'adhérent
*/
@@ -180,7 +180,7 @@ class Adherent
}
/*!
- \brief fonction qui vérifie les données entrées
+ \brief fonction qui vérifie les données entrées
\param minimum
*/
@@ -265,7 +265,6 @@ class Adherent
/*
* Return errors
- *
*/
if ($err)
@@ -281,7 +280,7 @@ class Adherent
}
/*!
- \brief fonction qui crée l'adhérent
+ \brief fonction qui crée l'adhérent
\param userid userid de l'adhérent
*/
@@ -305,16 +304,15 @@ class Adherent
}
else
{
- print $this->db->error();
- print "
$sql
";
+ dolibarr_print_error($this->db);
return 0;
}
}
+
/*!
\brief fonction qui met à jour l'adhérent
*/
-
function update()
{
@@ -343,8 +341,7 @@ class Adherent
if (!$result)
{
- print $this->db->error();
- print " $sql ";
+ dolibarr_print_error($this->db);
return 0;
}
@@ -352,14 +349,21 @@ class Adherent
{
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."adherent_options WHERE adhid = $this->id;";
$this->db->query($sql_del);
- $sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_options (adhid) VALUES ($this->id);";
- //$sql = "REPLACE INTO ".MAIN_DB_PREFIX."adherent_options SET adhid = $this->id";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_options (adhid";
foreach($this->array_options as $key => $value)
{
// recupere le nom de l'attribut
$attr=substr($key,8);
- $sql.=",$attr = '".$this->array_options[$key]."'";
+ $sql.=",$attr";
}
+ $sql .= ") VALUES ($this->id";
+ foreach($this->array_options as $key => $value)
+ {
+
+ $sql.=",'".$this->array_options[$key]."'";
+ }
+ $sql.=");";
+
$result = $this->db->query($sql);
}
@@ -369,8 +373,7 @@ class Adherent
}
else
{
- print $this->db->error();
- print "
";
+ dolibarr_print_error($this->db);
return 0;
}
}else{
@@ -173,7 +172,7 @@ class AdherentOptions
/*!
\brief fonction qui crée un label
\param attrname nom de l'atribut
- \param label nom du label
+ \param label nom du label
*/
function create_label($attrname,$label='') {
@@ -213,8 +212,7 @@ class AdherentOptions
}
else
{
- print "Err : ".$this->db->error();
- print "