diff --git a/htdocs/adherents/adherent_options.class.php b/htdocs/adherents/adherent_options.class.php
index fa95c874f49..f40a64e3ed6 100644
--- a/htdocs/adherents/adherent_options.class.php
+++ b/htdocs/adherents/adherent_options.class.php
@@ -33,6 +33,11 @@ class AdherentOptions
* ces champs
*/
var $attribute_name;
+ /*
+ * Tableau contenant le nom des champs en clef et le label de ces
+ * champs en value
+ */
+ var $attribute_label;
var $errorstr;
/*
@@ -45,6 +50,7 @@ class AdherentOptions
$this->id = $id;
$this->errorstr = array();
$this->attribute_name = array();
+ $this->attribute_label = array();
}
/*
* Print error_list
@@ -110,19 +116,45 @@ class AdherentOptions
/*
* Insertion dans la base
*/
- $sql = "ALTER TABLE llx_adherent_options ";
- $sql .= " ADD $attrname $type($length)";
+ if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-]*$/",$attrname)){
+ $sql = "ALTER TABLE llx_adherent_options ";
+ $sql .= " ADD $attrname $type($length)";
- if ($this->db->query($sql))
- {
- return 1;
- }
- else
- {
- print $this->db->error();
- print "
| ';
print ' ';
diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php
index 451689f5fec..edcbb0afb59 100644
--- a/htdocs/adherents/fiche.php
+++ b/htdocs/adherents/fiche.php
@@ -20,15 +20,16 @@
* $Source$
*
*/
-require("./pre.inc.php");
-require("../adherent.class.php");
-require("../adherent_type.class.php");
+require($GLOBALS["DOCUMENT_ROOT"]."/adherents/pre.inc.php");
+require($GLOBALS["DOCUMENT_ROOT"]."/adherent.class.php");
+require($GLOBALS["DOCUMENT_ROOT"]."/adherent_type.class.php");
require($GLOBALS["DOCUMENT_ROOT"]."/adherents/adherent_options.class.php");
-require("../cotisation.class.php");
-require("../paiement.class.php");
+require($GLOBALS["DOCUMENT_ROOT"]."/cotisation.class.php");
+require($GLOBALS["DOCUMENT_ROOT"]."/paiement.class.php");
$db = new Db();
+$adho = new AdherentOptions($db);
if ($HTTP_POST_VARS["action"] == 'cotisation')
{
@@ -91,7 +92,7 @@ if ($HTTP_POST_VARS["action"] == 'confirm_valid' && $HTTP_POST_VARS["confirm"] =
$adh = new Adherent($db, $rowid);
$adh->validate($user->id);
$adh->fetch($rowid);
- $mesg=preg_replace("/%INFO%/","Prenom : $adh->prenom\nNom : $adh->nom\nSociete = $adh->societe\nAdresse = $adh->adresse\nCode Postal : $adh->cp\nVille : $adh->ville\nPays : $adh->pays\nEmail : $adh->email\nLogin : $adh->login\nPassword : $adh->pass\nNote : $adh->note",$conf->adherent->email_valid);
+ $mesg=preg_replace("/%INFO%/","Prenom : $adh->prenom\nNom : $adh->nom\nSociete = $adh->societe\nAdresse = $adh->adresse\nCode Postal : $adh->cp\nVille : $adh->ville\nPays : $adh->pays\nEmail : $adh->email\nLogin : $adh->login\nPassword : $adh->pass\nNote : $adh->note\n\nServeur : http://$SERVER_NAME/public/adherents/",$conf->adherent->email_valid);
mail($adh->email,"Vos coordonnees sur http://$SERVER_NAME/",$mesg);
}
@@ -100,7 +101,7 @@ if ($HTTP_POST_VARS["action"] == 'confirm_resign' && $HTTP_POST_VARS["confirm"]
$adh = new Adherent($db, $rowid);
$adh->resiliate($user->id);
$adh->fetch($rowid);
- $mesg=preg_replace("/%INFO%/","Prenom : $adh->prenom\nNom : $adh->nom\nSociete = $adh->societe\nAdresse = $adh->adresse\nCode Postal : $adh->cp\nVille : $adh->ville\nPays : $adh->pays\nEmail : $adh->email\nLogin : $adh->login\nPassword : $adh->pass\nNote : $adh->note",$conf->adherent->email_resil);
+ $mesg=preg_replace("/%INFO%/","Prenom : $adh->prenom\nNom : $adh->nom\nSociete = $adh->societe\nAdresse = $adh->adresse\nCode Postal : $adh->cp\nVille : $adh->ville\nPays : $adh->pays\nEmail : $adh->email\nLogin : $adh->login\nPassword : $adh->pass\nNote : $adh->note\n\nServeur : http://$SERVER_NAME/public/adherents/",$conf->adherent->email_resil);
mail($adh->email,"Vos coordonnees sur http://$SERVER_NAME/",$mesg);
}
@@ -113,7 +114,8 @@ llxHeader();
/* */
/* ************************************************************************** */
-
+// fetch optionals attributes and labels
+$adho->fetch_optionals();
if ($action == 'create') {
$sql = "SELECT s.nom,s.idp, f.amount, f.total, f.facnumber";
@@ -129,8 +131,9 @@ if ($action == 'create') {
$total = $obj->total;
}
}
- $adho = new AdherentOptions($db);
- $myattr=$adho->fetch_name_optionals();
+ // $adho = new AdherentOptions($db);
+
+ //$myattr=$adho->fetch_name_optionals();
print_titre("Nouvel adhérent");
print " |