Fix: Correction bugs #10974
This commit is contained in:
parent
46518f0e97
commit
bc66e5d667
@ -24,7 +24,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*! \file htdocs/adherents/adherent.class.php
|
||||
/*! \file htdocs/adherents/adherent.class.php
|
||||
\ingroup adherent
|
||||
\brief Fichier de la classe permettant la gestion d'un adhérent
|
||||
\author Rodolphe Qiedeville
|
||||
@ -85,10 +85,10 @@ class Adherent
|
||||
|
||||
|
||||
/*!
|
||||
\brief function envoyant un email au destinataire (recipient) avec le text fourni en parametre.
|
||||
\param recipients destinataires
|
||||
\param text contenu du message
|
||||
\param subject sujet du message
|
||||
\brief function envoyant un email au destinataire (recipient) avec le text fourni en parametre.
|
||||
\param recipients destinataires
|
||||
\param text contenu du message
|
||||
\param subject sujet du message
|
||||
\remarks La particularite de cette fonction est de remplacer certains champs
|
||||
\remarks par leur valeur pour l'adherent en l'occurrence :
|
||||
\remarks %PRENOM% : est remplace par le prenom
|
||||
@ -316,67 +316,72 @@ class Adherent
|
||||
function update()
|
||||
{
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET ";
|
||||
$sql .= "prenom = '".$this->prenom ."'";
|
||||
$sql .= ",nom='" .$this->nom."'";
|
||||
$sql .= ",societe='".$this->societe."'";
|
||||
$sql .= ",adresse='".$this->adresse."'";
|
||||
$sql .= ",cp='" .$this->cp."'";
|
||||
$sql .= ",ville='" .$this->ville."'";
|
||||
$sql .= ",pays='" .$this->pays."'";
|
||||
$sql .= ",note='" .$this->commentaire."'";
|
||||
$sql .= ",email='" .$this->email."'";
|
||||
$sql .= ",login='" .$this->login."'";
|
||||
$sql .= ",pass='" .$this->pass."'";
|
||||
$sql .= ",naiss='" .$this->naiss."'";
|
||||
$sql .= ",photo='" .$this->photo."'";
|
||||
$sql .= ",public='" .$this->public."'";
|
||||
$sql .= ",statut=" .$this->statut;
|
||||
$sql .= ",fk_adherent_type=".$this->typeid;
|
||||
$sql .= ",morphy='".$this->morphy."'";
|
||||
|
||||
$sql .= " WHERE rowid = $this->id";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET ";
|
||||
$sql .= "prenom = '".$this->prenom ."'";
|
||||
$sql .= ",nom='" .$this->nom."'";
|
||||
$sql .= ",societe='".$this->societe."'";
|
||||
$sql .= ",adresse='".$this->adresse."'";
|
||||
$sql .= ",cp='" .$this->cp."'";
|
||||
$sql .= ",ville='" .$this->ville."'";
|
||||
$sql .= ",pays='" .$this->pays."'";
|
||||
$sql .= ",note='" .$this->commentaire."'";
|
||||
$sql .= ",email='" .$this->email."'";
|
||||
$sql .= ",login='" .$this->login."'";
|
||||
$sql .= ",pass='" .$this->pass."'";
|
||||
$sql .= ",naiss='" .$this->naiss."'";
|
||||
$sql .= ",photo='" .$this->photo."'";
|
||||
$sql .= ",public='" .$this->public."'";
|
||||
$sql .= ",statut=" .$this->statut;
|
||||
$sql .= ",fk_adherent_type=".$this->typeid;
|
||||
$sql .= ",morphy='".$this->morphy."'";
|
||||
|
||||
if (!$result)
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (sizeof($this->array_options) > 0 )
|
||||
{
|
||||
$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";
|
||||
foreach($this->array_options as $key => $value)
|
||||
{
|
||||
// recupere le nom de l'attribut
|
||||
$attr=substr($key,8);
|
||||
$sql.=",$attr";
|
||||
}
|
||||
$sql .= ") VALUES ($this->id";
|
||||
foreach($this->array_options as $key => $value)
|
||||
{
|
||||
|
||||
$sql.=",'".$this->array_options[$key]."'";
|
||||
}
|
||||
$sql.=");";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
}
|
||||
|
||||
if ($result)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
return 0;
|
||||
}
|
||||
$sql .= " WHERE rowid = $this->id";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if (!$result)
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (sizeof($this->array_options) > 0 )
|
||||
{
|
||||
$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";
|
||||
foreach($this->array_options as $key => $value)
|
||||
{
|
||||
// recupere le nom de l'attribut
|
||||
$attr=substr($key,8);
|
||||
$sql.=",$attr";
|
||||
}
|
||||
$sql .= ") VALUES ($this->id";
|
||||
foreach($this->array_options as $key => $value)
|
||||
{
|
||||
|
||||
$sql.=",'".$this->array_options[$key]."'";
|
||||
}
|
||||
$sql.=");";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\brief fonction qui supprime l'adhérent et les données associées
|
||||
@ -422,25 +427,28 @@ class Adherent
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief fonction qui récupére l'adhérent en donnant son login
|
||||
\param login login de l'adhérent
|
||||
\brief Fonction qui récupére l'adhérent en donnant son login
|
||||
\param login login de l'adhérent
|
||||
*/
|
||||
|
||||
function fetch_login($login)
|
||||
{
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent WHERE login='$login' LIMIT 1";
|
||||
if ( $this->db->query( $sql) )
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
{
|
||||
$obj = $this->db->fetch_object();
|
||||
$this->fetch($obj->rowid);
|
||||
}
|
||||
}
|
||||
|
||||
$result=$this->db->query( $sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$this->fetch($obj->rowid);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -456,12 +464,14 @@ class Adherent
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
|
||||
$sql .= " WHERE d.rowid = $rowid AND d.fk_adherent_type = t.rowid";
|
||||
|
||||
if ( $this->db->query( $sql) )
|
||||
$result=$this->db->query( $sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
{
|
||||
|
||||
$obj = $this->db->fetch_object();
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->typeid = $obj->fk_adherent_type;
|
||||
@ -494,8 +504,8 @@ class Adherent
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief fonction qui récupére les données optionelles de l'adhérent
|
||||
\param rowid
|
||||
\brief Fonction qui récupére les données optionelles de l'adhérent
|
||||
\param rowid
|
||||
*/
|
||||
|
||||
function fetch_optionals($rowid)
|
||||
@ -505,19 +515,26 @@ class Adherent
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_options";
|
||||
$sql .= " WHERE adhid=$rowid";
|
||||
|
||||
if ( $this->db->query( $sql) ){
|
||||
if ($this->db->num_rows()){
|
||||
|
||||
$tab = $this->db->fetch_array();
|
||||
|
||||
foreach ($tab as $key => $value){
|
||||
if ($key != 'optid' && $key != 'tms' && $key != 'adhid'){
|
||||
// we can add this attribute to adherent object
|
||||
$this->array_options["options_$key"]=$value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$result=$this->db->query( $sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
{
|
||||
$tab = $this->db->fetch_array($result);
|
||||
|
||||
foreach ($tab as $key => $value)
|
||||
{
|
||||
if ($key != 'optid' && $key != 'tms' && $key != 'adhid')
|
||||
{
|
||||
// we can add this attribute to adherent object
|
||||
$this->array_options["options_$key"]=$value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
|
||||
@ -530,28 +547,38 @@ class Adherent
|
||||
{
|
||||
$array_name_options=array();
|
||||
$sql = "SHOW COLUMNS FROM ".MAIN_DB_PREFIX."adherent_options";
|
||||
|
||||
$result=$this->db->query( $sql);
|
||||
|
||||
if ( $this->db->query( $sql) ){
|
||||
if ($this->db->num_rows()){
|
||||
//$array_name_options[]=$tab->Field;
|
||||
while ($tab = $this->db->fetch_object()){
|
||||
if ($tab->Field != 'optid' && $tab->Field != 'tms' && $tab->Field != 'adhid'){
|
||||
// we can add this attribute to adherent object
|
||||
$array_name_options[]=$tab->Field;
|
||||
}
|
||||
}
|
||||
return $array_name_options;
|
||||
}else{
|
||||
return array();
|
||||
}
|
||||
}else{
|
||||
dolibarr_print_error($this->db);
|
||||
return array() ;
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
{
|
||||
//$array_name_options[]=$tab->Field;
|
||||
while ($tab = $this->db->fetch_object($result))
|
||||
{
|
||||
if ($tab->Field != 'optid' && $tab->Field != 'tms' && $tab->Field != 'adhid')
|
||||
{
|
||||
// we can add this attribute to adherent object
|
||||
$array_name_options[]=$tab->Field;
|
||||
}
|
||||
}
|
||||
return $array_name_options;
|
||||
}
|
||||
else
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
return array() ;
|
||||
}
|
||||
|
||||
}
|
||||
/*!
|
||||
\brief fonction qui insèe la cotisation dans la base de données
|
||||
\brief fonction qui insère la cotisation dans la base de données
|
||||
\param date
|
||||
\param montant
|
||||
*/
|
||||
@ -563,33 +590,35 @@ class Adherent
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."cotisation (fk_adherent, dateadh, cotisation)";
|
||||
$sql .= " VALUES ($this->id, ".$this->db->idate($date).", $montant)";
|
||||
|
||||
if ( $this->db->query( $sql) )
|
||||
{
|
||||
if ( $this->db->affected_rows() )
|
||||
{
|
||||
$rowid=$this->db->last_insert_id();
|
||||
$datefin = mktime(12, 0 , 0,
|
||||
strftime("%m",$date),
|
||||
strftime("%d",$date),
|
||||
strftime("%Y",$date)+1) - (24 * 3600);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET datefin = ".$this->db->idate($datefin)." WHERE rowid =". $this->id;
|
||||
|
||||
if ( $this->db->query( $sql) )
|
||||
{
|
||||
return $rowid;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
$result=$this->db->query( $sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if ( $this->db->affected_rows() )
|
||||
{
|
||||
$rowid=$this->db->last_insert_id(MAIN_DB_PREFIX."cotisation");
|
||||
$datefin = mktime(12, 0 , 0,
|
||||
strftime("%m",$date),
|
||||
strftime("%d",$date),
|
||||
strftime("%Y",$date)+1) - (24 * 3600);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET datefin = ".$this->db->idate($datefin)." WHERE rowid =". $this->id;
|
||||
|
||||
if ( $this->db->query( $sql) )
|
||||
{
|
||||
return $rowid;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
return 0;
|
||||
}
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -691,6 +720,7 @@ class Adherent
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\brief fonction qui supprime l'adhérent des abonnements automatiques
|
||||
\param adht
|
||||
@ -795,44 +825,57 @@ class Adherent
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief fonction qui dit si cet utilisateur est rédacteur dans spip
|
||||
\brief Fonction qui dit si cet utilisateur est un rédacteur existant dans spip
|
||||
\return int 1=existe, 0=n'existe pas, -1=erreur
|
||||
*/
|
||||
|
||||
function is_in_spip()
|
||||
{
|
||||
if (defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1 &&
|
||||
defined('ADHERENT_SPIP_SERVEUR') && ADHERENT_SPIP_SERVEUR != '' &&
|
||||
defined('ADHERENT_SPIP_USER') && ADHERENT_SPIP_USER != '' &&
|
||||
defined('ADHERENT_SPIP_PASS') && ADHERENT_SPIP_PASS != '' &&
|
||||
defined('ADHERENT_SPIP_DB') && ADHERENT_SPIP_DB != ''
|
||||
){
|
||||
$query = "SELECT login FROM spip_auteurs WHERE login='".$this->login."'";
|
||||
$mydb=new DoliDb('mysql',ADHERENT_SPIP_SERVEUR,ADHERENT_SPIP_USER,ADHERENT_SPIP_PASS,ADHERENT_SPIP_DB);
|
||||
$result = $mydb->query($query);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if ($mydb->num_rows()){
|
||||
# nous avons au moins une reponse
|
||||
$mydb->close();
|
||||
return 1;
|
||||
}else{
|
||||
# nous n'avons pas de reponse => n'existe pas
|
||||
$mydb->close();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
# error
|
||||
$this->errorstr=$mydb->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1 &&
|
||||
defined('ADHERENT_SPIP_SERVEUR') && ADHERENT_SPIP_SERVEUR != '' &&
|
||||
defined('ADHERENT_SPIP_USER') && ADHERENT_SPIP_USER != '' &&
|
||||
defined('ADHERENT_SPIP_PASS') && ADHERENT_SPIP_PASS != '' &&
|
||||
defined('ADHERENT_SPIP_DB') && ADHERENT_SPIP_DB != '')
|
||||
{
|
||||
|
||||
$query = "SELECT login FROM spip_auteurs WHERE login='".$this->login."'";
|
||||
$mydb=new DoliDb('mysql',ADHERENT_SPIP_SERVEUR,ADHERENT_SPIP_USER,ADHERENT_SPIP_PASS,ADHERENT_SPIP_DB);
|
||||
|
||||
if ($mydb->ok) {
|
||||
|
||||
$result = $mydb->query($query);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if ($mydb->num_rows())
|
||||
{
|
||||
# nous avons au moins une reponse
|
||||
$mydb->close();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
# nous n'avons pas de reponse => n'existe pas
|
||||
$mydb->close();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
# error
|
||||
$this->errorstr=$mydb->error();
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
$this->errorstr="Echec de connexion avec les identifiants ".ADHERENT_SPIP_SERVEUR." ".ADHERENT_SPIP_USER." ".ADHERENT_SPIP_PASS." ".ADHERENT_SPIP_DB;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\brief fonction qui ajoute l'utilisateur dans glasnost
|
||||
\brief Fonction qui ajoute l'utilisateur dans glasnost
|
||||
*/
|
||||
|
||||
function add_to_glasnost()
|
||||
|
||||
@ -81,7 +81,7 @@ if ($_POST["action"] == 'cotisation')
|
||||
$insertid=$acct->addline($dateop, $_POST["operation"], $_POST["label"], $amount, $_POST["num_chq"],ADHERENT_BANK_CATEGORIE);
|
||||
if ($insertid == '')
|
||||
{
|
||||
print "<p> Probleme d'insertion : ".$db->error();
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -94,7 +94,7 @@ if ($_POST["action"] == 'cotisation')
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<p> Probleme d'insertion $sql : ".$db->error();
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -159,37 +159,37 @@ if ($_POST["action"] == 'add')
|
||||
if ($result) {
|
||||
$num = $db->num_rows();
|
||||
}
|
||||
if (!isset($nom) || !isset($prenom) || $prenom=='' || $nom==''){
|
||||
if (!isset($nom) || !isset($prenom) || $prenom=='' || $nom=='') {
|
||||
$error+=1;
|
||||
$errmsg .="Nom et Prenom obligatoires<br>\n";
|
||||
$errmsg .="Nom et Prénom obligatoires<br>\n";
|
||||
}
|
||||
if (!isset($email) || $email == '' || !ereg('@',$email)){
|
||||
if (ADHERENT_MAIL_REQUIRED && ADHERENT_MAIL_REQUIRED == 1 && ! ValidEMail($email)) {
|
||||
$error+=1;
|
||||
$errmsg .="Adresse Email invalide<br>\n";
|
||||
}
|
||||
if ($num !=0){
|
||||
if ($num !=0) {
|
||||
$error+=1;
|
||||
$errmsg .="Login deja utilise. Veuillez en changer<BR>\n";
|
||||
$errmsg .="Login deja utilise. Veuillez en changer<br>\n";
|
||||
}
|
||||
if (!isset($pass) || $pass == '' ){
|
||||
if (!isset($pass) || $pass == '' ) {
|
||||
$error+=1;
|
||||
$errmsg .="Password invalide<br>\n";
|
||||
}
|
||||
if (isset($naiss) && $naiss !=''){
|
||||
if (!preg_match("/^\d\d\d\d-\d\d-\d\d$/",$naiss)){
|
||||
if (!preg_match("/^\d\d\d\d-\d\d-\d\d$/",$naiss)) {
|
||||
$error+=1;
|
||||
$errmsg .="Date de naissance invalide (Format AAAA-MM-JJ)<br>\n";
|
||||
}
|
||||
}
|
||||
if (isset($public)){
|
||||
if (isset($public)) {
|
||||
$public=1;
|
||||
}else{
|
||||
} else {
|
||||
$public=0;
|
||||
}
|
||||
if (!$error){
|
||||
if (!$error) {
|
||||
|
||||
// Email a peu pres correct et le login n'existe pas
|
||||
if ($adh->create($user->id) )
|
||||
if ($adh->create($user->id))
|
||||
{
|
||||
if ($cotisation > 0)
|
||||
{
|
||||
@ -345,7 +345,7 @@ if ($_POST["action"] == 'confirm_add_spip' && $_POST["confirm"] == yes)
|
||||
/* ************************************************************************** */
|
||||
if ($errmsg != '')
|
||||
{
|
||||
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<th>Erreur dans l\'execution du formulaire</th>';
|
||||
print "<tr><td class=\"error\"><b>$errmsg</b></td></tr>\n";
|
||||
print '</table>';
|
||||
@ -355,9 +355,9 @@ if ($errmsg != '')
|
||||
$adho->fetch_optionals();
|
||||
if ($action == 'create') {
|
||||
|
||||
print_titre("Nouvel adhérent");
|
||||
print_titre($langs->trans("NewMember"));
|
||||
print "<form action=\"fiche.php\" method=\"post\">\n";
|
||||
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
@ -379,17 +379,17 @@ if ($action == 'create') {
|
||||
|
||||
print '<td valign="top" rowspan="13"><textarea name="comment" wrap="soft" cols="40" rows="25"></textarea></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Firstname").'</td><td><input type="text" name="prenom" size="40"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("LastName").'</td><td><input type="text" name="nom" size="40"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Firstname").'*</td><td><input type="text" name="prenom" size="40"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("LastName").'*</td><td><input type="text" name="nom" size="40"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" size="40"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td>';
|
||||
print '<textarea name="adresse" wrap="soft" cols="40" rows="3"></textarea></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td><input type="text" name="cp" size="8"> <input type="text" name="ville" size="40"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td><input type="text" name="pays" size="40"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" size="40"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Login").'</td><td><input type="text" name="login" size="40"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Password").'</td><td><input type="password" name="pass" size="40"></td></tr>';
|
||||
print '<tr><td>Date de Naissance<BR>Format AAAA-MM-JJ</td><td><input type="text" name="naiss" size="10"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("EMail").(ADHERENT_MAIL_REQUIRED&&ADHERENT_MAIL_REQUIRED==1?'*':'').'</td><td><input type="text" name="email" size="40"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Login").'*</td><td><input type="text" name="login" size="40"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Password").'*</td><td><input type="password" name="pass" size="40"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Birthday").'<br>(AAAA-MM-JJ)</td><td><input type="text" name="naiss" size="10"></td></tr>';
|
||||
print '<tr><td>Url photo</td><td><input type="text" name="photo" size="40"></td></tr>';
|
||||
foreach($adho->attribute_label as $key=>$value){
|
||||
print "<tr><td>$value</td><td><input type=\"text\" name=\"options_$key\" size=\"40\"></td></tr>\n";
|
||||
@ -452,7 +452,7 @@ if ($rowid > 0)
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/adherents/fiche.php?rowid='.$rowid;
|
||||
$head[$h][1] = "Fiche adhérent";
|
||||
$head[$h][1] = $langs->trans("Member");
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
|
||||
@ -519,28 +519,28 @@ if ($rowid > 0)
|
||||
print "<form action=\"fiche.php\" method=\"post\">\n";
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td>Numero</td><td class="valeur">'.$adh->id.' </td>';
|
||||
print '<tr><td>'.$langs->trans("Ref").'</td><td class="valeur">'.$adh->id.' </td>';
|
||||
print '<td valign="top" width="50%">'.$langs->trans("Comments").'</tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$adh->type."</td>\n";
|
||||
print '<tr><td>'.$langs->trans("Type").'*</td><td class="valeur">'.$adh->type."</td>\n";
|
||||
|
||||
print '<td rowspan="'.(13+count($adh->array_options)).'" valign="top" width="50%">';
|
||||
print nl2br($adh->commentaire).' </td></tr>';
|
||||
|
||||
print '<tr><td>Personne</td><td class="valeur">'.$adh->getmorphylib().' </td></tr>';
|
||||
|
||||
print '<tr><td width="15%">'.$langs->trans("Firstname").'</td><td class="valeur" width="35%">'.$adh->prenom.' </td></tr>';
|
||||
print '<tr><td width="15%">'.$langs->trans("Firstname").'*</td><td class="valeur" width="35%">'.$adh->prenom.' </td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("LastName").'</td><td class="valeur">'.$adh->nom.' </td></tr>';
|
||||
print '<tr><td>'.$langs->trans("LastName").'*</td><td class="valeur">'.$adh->nom.' </td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$adh->societe.' </td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td class="valeur">'.nl2br($adh->adresse).' </td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td class="valeur">'.$adh->cp.' '.$adh->ville.' </td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td class="valeur">'.$adh->pays.' </td></tr>';
|
||||
print '<tr><td>'.$langs->trans("EMail").'</td><td class="valeur">'.$adh->email.' </td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Login").'</td><td class="valeur">'.$adh->login.' </td></tr>';
|
||||
print '<tr><td>'.$langs->trans("EMail").(ADHERENT_MAIL_REQUIRED&&ADHERENT_MAIL_REQUIRED==1?'*':'').'</td><td class="valeur">'.$adh->email.' </td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Login").'*</td><td class="valeur">'.$adh->login.' </td></tr>';
|
||||
// print '<tr><td>Pass</td><td class="valeur">'.$adh->pass.' </td></tr>';
|
||||
print '<tr><td>Date de Naissance</td><td class="valeur">'.$adh->naiss.' </td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Birthday").'</td><td class="valeur">'.$adh->naiss.' </td></tr>';
|
||||
print '<tr><td>URL Photo</td><td class="valeur">'.$adh->photo.' </td></tr>';
|
||||
print '<tr><td>Public ?</td><td class="valeur">';
|
||||
if ($adh->public==1){
|
||||
@ -555,54 +555,67 @@ foreach($adho->attribute_label as $key=>$value){
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
print "<br>";
|
||||
|
||||
print "</div>\n";
|
||||
|
||||
|
||||
/*
|
||||
* Barre d'actions
|
||||
*
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->admin)
|
||||
|
||||
print "<a class=\"tabAction\" href=\"edit.php?rowid=$rowid\">".$langs->trans("Edit")."</a>";
|
||||
|
||||
if ($adh->statut < 1)
|
||||
{
|
||||
print "<a class=\"tabAction\" href=\"edit.php?rowid=$rowid\">".$langs->trans("Edit")."</a>";
|
||||
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$rowid&action=valid\">Valider l'adhésion</a>\n";
|
||||
}
|
||||
|
||||
if ($adh->statut < 1)
|
||||
if ($adh->statut == 1)
|
||||
{
|
||||
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$rowid&action=resign\">Résilier l'adhésion</a>\n";
|
||||
}
|
||||
|
||||
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=delete\">".$langs->trans("Delete")."</a>\n";
|
||||
|
||||
// Envoi fiche par mail
|
||||
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=sendinfo\">Envoyer sa fiche a l'adhérent</a>\n";
|
||||
|
||||
// Action Glasnost
|
||||
if ($adht->vote == 'yes' && defined("ADHERENT_USE_GLASNOST") && ADHERENT_USE_GLASNOST ==1)
|
||||
{
|
||||
define("XMLRPC_DEBUG", 1);
|
||||
$isinglasnost=$adh->is_in_glasnost();
|
||||
if ($isinglasnost == 1)
|
||||
{
|
||||
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$rowid&action=valid\">Valider l'adhésion</a>\n";
|
||||
}
|
||||
|
||||
if ($adh->statut == 1)
|
||||
{
|
||||
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$rowid&action=resign\">Résilier l'adhésion</a>\n";
|
||||
}
|
||||
|
||||
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=delete\">".$langs->trans("Delete")."</a>\n";
|
||||
|
||||
/*
|
||||
* bouton : "Envoie des informations"
|
||||
*/
|
||||
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=sendinfo\">Envoyer sa fiche a l'adhérent</a>\n";
|
||||
|
||||
if ($adht->vote == 'yes' && defined("ADHERENT_USE_GLASNOST") && ADHERENT_USE_GLASNOST ==1){
|
||||
define("XMLRPC_DEBUG", 1);
|
||||
|
||||
if ($adh->is_in_glasnost() == 1){
|
||||
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=del_glasnost\">Suppression dans Glasnost</a>\n";
|
||||
}
|
||||
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=add_glasnost\">Ajout dans Glasnost</a>\n";
|
||||
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=del_glasnost\">Suppression dans Glasnost</a>\n";
|
||||
}
|
||||
if ($isinglasnost == 0) {
|
||||
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=add_glasnost\">Ajout dans Glasnost</a>\n";
|
||||
}
|
||||
if ($isinglasnost == -1) {
|
||||
print '<br><font class="error">Failed to connect to SPIP: '.$adh->errorstr.'</font>';
|
||||
}
|
||||
}
|
||||
|
||||
if (defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1){
|
||||
if ($adh->is_in_spip() == 1){
|
||||
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=del_spip\">Suppression dans Spip</a>\n";
|
||||
}else{
|
||||
// Action SPIP
|
||||
if (defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1)
|
||||
{
|
||||
$isinspip=$adh->is_in_spip();
|
||||
if ($isinspip == 1)
|
||||
{
|
||||
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=del_spip\">Suppression dans Spip</a>\n";
|
||||
}
|
||||
if ($isinspip == 0)
|
||||
{
|
||||
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=add_spip\">Ajout dans Spip</a>\n";
|
||||
}
|
||||
|
||||
}
|
||||
if ($isinspip == -1) {
|
||||
print '<br><font class="error">Failed to connect to SPIP: '.$adh->errorstr.'</font>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
@ -615,7 +628,7 @@ print "<br>\n";
|
||||
*
|
||||
*/
|
||||
|
||||
print '<table cellspacing="0" class="border" width="100%" cellpadding="3">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr>';
|
||||
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 &&
|
||||
@ -640,7 +653,7 @@ if ($result)
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">\n";
|
||||
print "<table class=\"noborder\" width=\"100%\">\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print "<td>Date cotisations</td>\n";
|
||||
|
||||
@ -30,27 +30,20 @@
|
||||
require("../main.inc.php");
|
||||
|
||||
function llxHeader($head = "") {
|
||||
global $user, $conf;
|
||||
global $user, $conf, $langs;
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
top_menu($head);
|
||||
|
||||
$menu = new Menu();
|
||||
|
||||
$menu->add("index.php","Adherents");
|
||||
|
||||
$menu->add("index.php",$langs->trans("Members"));
|
||||
$menu->add_submenu("fiche.php?action=create",$langs->trans("NewMember"));
|
||||
$menu->add_submenu("liste.php?statut=-1","Adhésions à valider");
|
||||
$menu->add_submenu("liste.php?statut=1","Adhérents à ce jour");
|
||||
$menu->add_submenu("liste.php?statut=0","Adhésions résiliées");
|
||||
|
||||
if ($user->admin)
|
||||
{
|
||||
$menu->add("fiche.php?action=create","Nouvel adhérent");
|
||||
}
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/public/adherents/","Espace adherents public");
|
||||
|
||||
$menu->add("index.php","Export");
|
||||
@ -58,18 +51,19 @@ function llxHeader($head = "") {
|
||||
$menu->add_submenu("cartes/carte.php","Cartes d'adhérents");
|
||||
$menu->add_submenu("cartes/etiquette.php","Etiquettes d'adhérents");
|
||||
|
||||
$menu->add("index.php","Comptabilite");
|
||||
$langs->load("compta");
|
||||
$menu->add("index.php",$langs->trans("Accountancy"));
|
||||
$menu->add_submenu("cotisations.php","Cotisations");
|
||||
$menu->add_submenu(DOL_URL_ROOT."/compta/bank/","Bank");
|
||||
$menu->add_submenu(DOL_URL_ROOT."/compta/bank/",$langs->trans("Bank"));
|
||||
|
||||
if ($user->admin)
|
||||
{
|
||||
$menu->add("index.php","Configuration");
|
||||
$menu->add_submenu("type.php","Type d'adhérent");
|
||||
$menu->add_submenu("options.php","Champs optionnels");
|
||||
$menu->add_submenu(DOL_URL_ROOT."/admin/adherent.php","Constantes");
|
||||
}
|
||||
$menu->add("index.php",$langs->trans("Setup"));
|
||||
$menu->add_submenu("type.php","Type d'adhérent");
|
||||
$menu->add_submenu("options.php","Champs optionnels");
|
||||
|
||||
if ($user->admin) {
|
||||
$menu->add_submenu(DOL_URL_ROOT."/admin/adherent.php",$langs->trans("Module"));
|
||||
}
|
||||
|
||||
left_menu($menu->liste);
|
||||
|
||||
}
|
||||
|
||||
@ -49,6 +49,8 @@ $main_use_spip_auto = ADHERENT_USE_SPIP_AUTO;
|
||||
$typeconst=array('yesno','texte','chaine');
|
||||
$var=True;
|
||||
|
||||
|
||||
// Action mise a jour ou ajout d'une constante
|
||||
if ($_POST["action"] == 'update' || $_POST["action"] == 'add')
|
||||
{
|
||||
if (isset($_POST["consttype"]) && $_POST["consttype"] != '')
|
||||
@ -74,20 +76,31 @@ if ($_POST["action"] == 'update' || $_POST["action"] == 'add')
|
||||
|
||||
}
|
||||
|
||||
// Action activation d'un sous module du module adhérent
|
||||
if ($_GET["action"] == 'set')
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX." WHERE name = '".$_GET["name"]."' ;";
|
||||
$db->query($sql);
|
||||
|
||||
$sql ='';
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const(name,value,visible) values ('".$_GET["name"]."','".$_GET["value"]."', 0);";
|
||||
|
||||
if ($db->query($sql))
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = '".$_GET["name"]."' ;";
|
||||
$result=$db->query($sql);
|
||||
if (! $result) {
|
||||
dolibarr_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$sql ='';
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const(name,value,visible) values ('".$_GET["name"]."','".$_GET["value"]."', 0);";
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
Header("Location: adherent.php");
|
||||
Header("Location: adherent.php");
|
||||
}
|
||||
else {
|
||||
dolibarr_print_error($db);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Action désactivation d'un sous module du module adhérent
|
||||
if ($_GET["action"] == 'unset')
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = '".$_GET["name"]."'";
|
||||
@ -210,7 +223,9 @@ $var=!$var;
|
||||
/*
|
||||
* Edition des varibales globales non rattache a un theme specifique
|
||||
*/
|
||||
$constantes=array('ADHERENT_TEXT_NEW_ADH',
|
||||
$constantes=array(
|
||||
'ADHERENT_MAIL_REQUIRED',
|
||||
'ADHERENT_TEXT_NEW_ADH',
|
||||
'ADHERENT_MAIL_COTIS_SUBJECT',
|
||||
'ADHERENT_MAIL_COTIS',
|
||||
'ADHERENT_MAIL_EDIT_SUBJECT',
|
||||
@ -233,6 +248,9 @@ form_constantes($constantes);
|
||||
|
||||
$db->close();
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
|
||||
@ -286,10 +304,8 @@ function form_constantes($tableau){
|
||||
}
|
||||
print '</td><td>';
|
||||
|
||||
// print '<input type="text" size="15" name="constnote" value="'.stripslashes(nl2br($obj->note)).'">';
|
||||
// print '</td><td>';
|
||||
print '<input type="Submit" value="Update" name="Button"> ';
|
||||
print '<a href="adherent.php?name='.$const.'&action=unset">'.img_delete().'</a>';
|
||||
// print '<a href="adherent.php?name='.$const.'&action=unset">'.img_delete().'</a>';
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '</form>';
|
||||
@ -298,4 +314,5 @@ function form_constantes($tableau){
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -80,6 +80,7 @@ insert into llx_const (name, value, type) values ('DONS_FORM','fsfe.fr.php','cha
|
||||
--
|
||||
-- Mail Adherent
|
||||
--
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_REQUIRED','1','yesno','Le mail est obligatoire pour créer un adhérent',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_FROM','adherents@domain.com','chaine','From des mails adherents',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_RESIL','Votre adhesion sur %SERVEUR% vient d\'etre resilie.\r\nNous esperons vous revoir tres bientot','texte','Mail de Resiliation',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_VALID','MAIN\r\nVotre adhesion vient d\'etre validee. \r\nVoici le rappel de vos coordonnees (toute information erronee entrainera la non validation de votre inscription) :\r\n\r\n%INFO%\r\n\r\nVous pouvez a tout moment, grace a votre login et mot de passe, modifier vos coordonnees a l\'adresse suivante : \r\n%SERVEUR%public/adherents/','texte','Mail de validation',0);
|
||||
|
||||
@ -19,7 +19,7 @@ alter table llx_societe add capital real after tva_intra;
|
||||
alter table llx_societe add rubrique varchar(255);
|
||||
alter table llx_societe add remise_client real default 0;
|
||||
|
||||
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_MAIL_REQUIRED','1','yesno','Le mail est obligatoire pour créer un adhérent',0);
|
||||
|
||||
alter table llx_societe add fk_forme_juridique integer default 0 after fk_typent;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user