Fix: Correction bugs #10974

This commit is contained in:
Laurent Destailleur 2004-11-12 14:37:38 +00:00
parent 46518f0e97
commit bc66e5d667
6 changed files with 332 additions and 264 deletions

View File

@ -349,6 +349,7 @@ class Adherent
{ {
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."adherent_options WHERE adhid = $this->id;"; $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."adherent_options WHERE adhid = $this->id;";
$this->db->query($sql_del); $this->db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_options (adhid"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_options (adhid";
foreach($this->array_options as $key => $value) foreach($this->array_options as $key => $value)
{ {
@ -365,7 +366,6 @@ class Adherent
$sql.=");"; $sql.=");";
$result = $this->db->query($sql); $result = $this->db->query($sql);
}
if ($result) if ($result)
{ {
@ -376,8 +376,13 @@ class Adherent
dolibarr_print_error($this->db); dolibarr_print_error($this->db);
return 0; return 0;
} }
} }
return 1;
}
/*! /*!
\brief fonction qui supprime l'adhérent et les données associées \brief fonction qui supprime l'adhérent et les données associées
\param rowid \param rowid
@ -422,18 +427,21 @@ class Adherent
} }
/*! /*!
\brief fonction qui récupére l'adhérent en donnant son login \brief Fonction qui récupére l'adhérent en donnant son login
\param login login de l'adhérent \param login login de l'adhérent
*/ */
function fetch_login($login) function fetch_login($login)
{ {
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent WHERE login='$login' LIMIT 1"; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent WHERE login='$login' LIMIT 1";
if ( $this->db->query( $sql) )
$result=$this->db->query( $sql);
if ($result)
{ {
if ($this->db->num_rows()) if ($this->db->num_rows())
{ {
$obj = $this->db->fetch_object(); $obj = $this->db->fetch_object($result);
$this->fetch($obj->rowid); $this->fetch($obj->rowid);
} }
} }
@ -456,12 +464,14 @@ class Adherent
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t"; $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"; $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()) if ($this->db->num_rows())
{ {
$obj = $this->db->fetch_object(); $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->typeid = $obj->fk_adherent_type; $this->typeid = $obj->fk_adherent_type;
@ -494,7 +504,7 @@ class Adherent
} }
/*! /*!
\brief fonction qui récupére les données optionelles de l'adhérent \brief Fonction qui récupére les données optionelles de l'adhérent
\param rowid \param rowid
*/ */
@ -505,19 +515,26 @@ class Adherent
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_options"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_options";
$sql .= " WHERE adhid=$rowid"; $sql .= " WHERE adhid=$rowid";
if ( $this->db->query( $sql) ){ $result=$this->db->query( $sql);
if ($this->db->num_rows()){
$tab = $this->db->fetch_array(); if ($result)
{
if ($this->db->num_rows())
{
$tab = $this->db->fetch_array($result);
foreach ($tab as $key => $value){ foreach ($tab as $key => $value)
if ($key != 'optid' && $key != 'tms' && $key != 'adhid'){ {
if ($key != 'optid' && $key != 'tms' && $key != 'adhid')
{
// we can add this attribute to adherent object // we can add this attribute to adherent object
$this->array_options["options_$key"]=$value; $this->array_options["options_$key"]=$value;
} }
} }
} }
}else{ }
else
{
dolibarr_print_error($this->db); dolibarr_print_error($this->db);
} }
@ -531,27 +548,37 @@ class Adherent
$array_name_options=array(); $array_name_options=array();
$sql = "SHOW COLUMNS FROM ".MAIN_DB_PREFIX."adherent_options"; $sql = "SHOW COLUMNS FROM ".MAIN_DB_PREFIX."adherent_options";
if ( $this->db->query( $sql) ){ $result=$this->db->query( $sql);
if ($this->db->num_rows()){
if ($result)
{
if ($this->db->num_rows())
{
//$array_name_options[]=$tab->Field; //$array_name_options[]=$tab->Field;
while ($tab = $this->db->fetch_object()){ while ($tab = $this->db->fetch_object($result))
if ($tab->Field != 'optid' && $tab->Field != 'tms' && $tab->Field != 'adhid'){ {
if ($tab->Field != 'optid' && $tab->Field != 'tms' && $tab->Field != 'adhid')
{
// we can add this attribute to adherent object // we can add this attribute to adherent object
$array_name_options[]=$tab->Field; $array_name_options[]=$tab->Field;
} }
} }
return $array_name_options; return $array_name_options;
}else{ }
else
{
return array(); return array();
} }
}else{ }
else
{
dolibarr_print_error($this->db); dolibarr_print_error($this->db);
return array() ; 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 date
\param montant \param montant
*/ */
@ -563,11 +590,13 @@ class Adherent
$sql = "INSERT INTO ".MAIN_DB_PREFIX."cotisation (fk_adherent, dateadh, cotisation)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."cotisation (fk_adherent, dateadh, cotisation)";
$sql .= " VALUES ($this->id, ".$this->db->idate($date).", $montant)"; $sql .= " VALUES ($this->id, ".$this->db->idate($date).", $montant)";
if ( $this->db->query( $sql) ) $result=$this->db->query( $sql);
if ($result)
{ {
if ( $this->db->affected_rows() ) if ( $this->db->affected_rows() )
{ {
$rowid=$this->db->last_insert_id(); $rowid=$this->db->last_insert_id(MAIN_DB_PREFIX."cotisation");
$datefin = mktime(12, 0 , 0, $datefin = mktime(12, 0 , 0,
strftime("%m",$date), strftime("%m",$date),
strftime("%d",$date), strftime("%d",$date),
@ -691,6 +720,7 @@ class Adherent
} }
} }
/*! /*!
\brief fonction qui supprime l'adhérent des abonnements automatiques \brief fonction qui supprime l'adhérent des abonnements automatiques
\param adht \param adht
@ -795,7 +825,8 @@ 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() function is_in_spip()
@ -804,19 +835,26 @@ class Adherent
defined('ADHERENT_SPIP_SERVEUR') && ADHERENT_SPIP_SERVEUR != '' && defined('ADHERENT_SPIP_SERVEUR') && ADHERENT_SPIP_SERVEUR != '' &&
defined('ADHERENT_SPIP_USER') && ADHERENT_SPIP_USER != '' && defined('ADHERENT_SPIP_USER') && ADHERENT_SPIP_USER != '' &&
defined('ADHERENT_SPIP_PASS') && ADHERENT_SPIP_PASS != '' && defined('ADHERENT_SPIP_PASS') && ADHERENT_SPIP_PASS != '' &&
defined('ADHERENT_SPIP_DB') && ADHERENT_SPIP_DB != '' defined('ADHERENT_SPIP_DB') && ADHERENT_SPIP_DB != '')
){ {
$query = "SELECT login FROM spip_auteurs WHERE login='".$this->login."'"; $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); $mydb=new DoliDb('mysql',ADHERENT_SPIP_SERVEUR,ADHERENT_SPIP_USER,ADHERENT_SPIP_PASS,ADHERENT_SPIP_DB);
if ($mydb->ok) {
$result = $mydb->query($query); $result = $mydb->query($query);
if ($result) if ($result)
{ {
if ($mydb->num_rows()){ if ($mydb->num_rows())
{
# nous avons au moins une reponse # nous avons au moins une reponse
$mydb->close(); $mydb->close();
return 1; return 1;
}else{ }
else
{
# nous n'avons pas de reponse => n'existe pas # nous n'avons pas de reponse => n'existe pas
$mydb->close(); $mydb->close();
return 0; return 0;
@ -828,11 +866,16 @@ class Adherent
$this->errorstr=$mydb->error(); $this->errorstr=$mydb->error();
return -1; 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() function add_to_glasnost()

View File

@ -81,7 +81,7 @@ if ($_POST["action"] == 'cotisation')
$insertid=$acct->addline($dateop, $_POST["operation"], $_POST["label"], $amount, $_POST["num_chq"],ADHERENT_BANK_CATEGORIE); $insertid=$acct->addline($dateop, $_POST["operation"], $_POST["label"], $amount, $_POST["num_chq"],ADHERENT_BANK_CATEGORIE);
if ($insertid == '') if ($insertid == '')
{ {
print "<p> Probleme d'insertion : ".$db->error(); dolibarr_print_error($db);
} }
else else
{ {
@ -94,7 +94,7 @@ if ($_POST["action"] == 'cotisation')
} }
else else
{ {
print "<p> Probleme d'insertion $sql : ".$db->error(); dolibarr_print_error($db);
} }
} }
} }
@ -159,37 +159,37 @@ if ($_POST["action"] == 'add')
if ($result) { if ($result) {
$num = $db->num_rows(); $num = $db->num_rows();
} }
if (!isset($nom) || !isset($prenom) || $prenom=='' || $nom==''){ if (!isset($nom) || !isset($prenom) || $prenom=='' || $nom=='') {
$error+=1; $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; $error+=1;
$errmsg .="Adresse Email invalide<br>\n"; $errmsg .="Adresse Email invalide<br>\n";
} }
if ($num !=0){ if ($num !=0) {
$error+=1; $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; $error+=1;
$errmsg .="Password invalide<br>\n"; $errmsg .="Password invalide<br>\n";
} }
if (isset($naiss) && $naiss !=''){ 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; $error+=1;
$errmsg .="Date de naissance invalide (Format AAAA-MM-JJ)<br>\n"; $errmsg .="Date de naissance invalide (Format AAAA-MM-JJ)<br>\n";
} }
} }
if (isset($public)){ if (isset($public)) {
$public=1; $public=1;
}else{ } else {
$public=0; $public=0;
} }
if (!$error){ if (!$error) {
// Email a peu pres correct et le login n'existe pas // Email a peu pres correct et le login n'existe pas
if ($adh->create($user->id) ) if ($adh->create($user->id))
{ {
if ($cotisation > 0) if ($cotisation > 0)
{ {
@ -345,7 +345,7 @@ if ($_POST["action"] == 'confirm_add_spip' && $_POST["confirm"] == yes)
/* ************************************************************************** */ /* ************************************************************************** */
if ($errmsg != '') 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 '<th>Erreur dans l\'execution du formulaire</th>';
print "<tr><td class=\"error\"><b>$errmsg</b></td></tr>\n"; print "<tr><td class=\"error\"><b>$errmsg</b></td></tr>\n";
print '</table>'; print '</table>';
@ -355,9 +355,9 @@ if ($errmsg != '')
$adho->fetch_optionals(); $adho->fetch_optionals();
if ($action == 'create') { if ($action == 'create') {
print_titre("Nouvel adhérent"); print_titre($langs->trans("NewMember"));
print "<form action=\"fiche.php\" method=\"post\">\n"; 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">'; 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 '<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("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("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("Company").'</td><td><input type="text" name="societe" size="40"></td></tr>';
print '<tr><td>'.$langs->trans("Address").'</td><td>'; print '<tr><td>'.$langs->trans("Address").'</td><td>';
print '<textarea name="adresse" wrap="soft" cols="40" rows="3"></textarea></td></tr>'; 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("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("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("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("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("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("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>'; print '<tr><td>Url photo</td><td><input type="text" name="photo" size="40"></td></tr>';
foreach($adho->attribute_label as $key=>$value){ foreach($adho->attribute_label as $key=>$value){
print "<tr><td>$value</td><td><input type=\"text\" name=\"options_$key\" size=\"40\"></td></tr>\n"; 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; $h = 0;
$head[$h][0] = DOL_URL_ROOT.'/adherents/fiche.php?rowid='.$rowid; $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; $hselected=$h;
$h++; $h++;
@ -519,28 +519,28 @@ if ($rowid > 0)
print "<form action=\"fiche.php\" method=\"post\">\n"; print "<form action=\"fiche.php\" method=\"post\">\n";
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td>Numero</td><td class="valeur">'.$adh->id.'&nbsp;</td>'; print '<tr><td>'.$langs->trans("Ref").'</td><td class="valeur">'.$adh->id.'&nbsp;</td>';
print '<td valign="top" width="50%">'.$langs->trans("Comments").'</tr>'; 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 '<td rowspan="'.(13+count($adh->array_options)).'" valign="top" width="50%">';
print nl2br($adh->commentaire).'&nbsp;</td></tr>'; print nl2br($adh->commentaire).'&nbsp;</td></tr>';
print '<tr><td>Personne</td><td class="valeur">'.$adh->getmorphylib().'&nbsp;</td></tr>'; print '<tr><td>Personne</td><td class="valeur">'.$adh->getmorphylib().'&nbsp;</td></tr>';
print '<tr><td width="15%">'.$langs->trans("Firstname").'</td><td class="valeur" width="35%">'.$adh->prenom.'&nbsp;</td></tr>'; print '<tr><td width="15%">'.$langs->trans("Firstname").'*</td><td class="valeur" width="35%">'.$adh->prenom.'&nbsp;</td></tr>';
print '<tr><td>'.$langs->trans("LastName").'</td><td class="valeur">'.$adh->nom.'&nbsp;</td></tr>'; print '<tr><td>'.$langs->trans("LastName").'*</td><td class="valeur">'.$adh->nom.'&nbsp;</td></tr>';
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$adh->societe.'&nbsp;</td></tr>'; print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$adh->societe.'&nbsp;</td></tr>';
print '<tr><td>'.$langs->trans("Address").'</td><td class="valeur">'.nl2br($adh->adresse).'&nbsp;</td></tr>'; print '<tr><td>'.$langs->trans("Address").'</td><td class="valeur">'.nl2br($adh->adresse).'&nbsp;</td></tr>';
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td class="valeur">'.$adh->cp.' '.$adh->ville.'&nbsp;</td></tr>'; print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td class="valeur">'.$adh->cp.' '.$adh->ville.'&nbsp;</td></tr>';
print '<tr><td>'.$langs->trans("Country").'</td><td class="valeur">'.$adh->pays.'&nbsp;</td></tr>'; print '<tr><td>'.$langs->trans("Country").'</td><td class="valeur">'.$adh->pays.'&nbsp;</td></tr>';
print '<tr><td>'.$langs->trans("EMail").'</td><td class="valeur">'.$adh->email.'&nbsp;</td></tr>'; print '<tr><td>'.$langs->trans("EMail").(ADHERENT_MAIL_REQUIRED&&ADHERENT_MAIL_REQUIRED==1?'*':'').'</td><td class="valeur">'.$adh->email.'&nbsp;</td></tr>';
print '<tr><td>'.$langs->trans("Login").'</td><td class="valeur">'.$adh->login.'&nbsp;</td></tr>'; print '<tr><td>'.$langs->trans("Login").'*</td><td class="valeur">'.$adh->login.'&nbsp;</td></tr>';
// print '<tr><td>Pass</td><td class="valeur">'.$adh->pass.'&nbsp;</td></tr>'; // print '<tr><td>Pass</td><td class="valeur">'.$adh->pass.'&nbsp;</td></tr>';
print '<tr><td>Date de Naissance</td><td class="valeur">'.$adh->naiss.'&nbsp;</td></tr>'; print '<tr><td>'.$langs->trans("Birthday").'</td><td class="valeur">'.$adh->naiss.'&nbsp;</td></tr>';
print '<tr><td>URL Photo</td><td class="valeur">'.$adh->photo.'&nbsp;</td></tr>'; print '<tr><td>URL Photo</td><td class="valeur">'.$adh->photo.'&nbsp;</td></tr>';
print '<tr><td>Public ?</td><td class="valeur">'; print '<tr><td>Public ?</td><td class="valeur">';
if ($adh->public==1){ if ($adh->public==1){
@ -555,54 +555,67 @@ foreach($adho->attribute_label as $key=>$value){
} }
print "</table>\n"; print "</table>\n";
print "<br>";
print "</div>\n"; print "</div>\n";
/* /*
* Barre d'actions * Barre d'actions
* *
*/ */
print '<div class="tabsAction">'; 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>";
if ($adh->statut < 1)
{
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$rowid&action=valid\">Valider l'adhésion</a>\n"; 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=$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"; print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=delete\">".$langs->trans("Delete")."</a>\n";
/* // Envoi fiche par mail
* 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";
*/
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){ // Action Glasnost
if ($adht->vote == 'yes' && defined("ADHERENT_USE_GLASNOST") && ADHERENT_USE_GLASNOST ==1)
{
define("XMLRPC_DEBUG", 1); define("XMLRPC_DEBUG", 1);
$isinglasnost=$adh->is_in_glasnost();
if ($adh->is_in_glasnost() == 1){ if ($isinglasnost == 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=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"; 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 == -1) {
print '<br><font class="error">Failed to connect to SPIP: '.$adh->errorstr.'</font>';
}
}
if (defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1){ // Action SPIP
if ($adh->is_in_spip() == 1){ 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"; print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=del_spip\">Suppression dans Spip</a>\n";
}else{ }
if ($isinspip == 0)
{
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=add_spip\">Ajout dans Spip</a>\n"; 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>'; 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>'; print '<tr>';
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 && if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 &&
@ -640,7 +653,7 @@ if ($result)
$num = $db->num_rows(); $num = $db->num_rows();
$i = 0; $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 '<tr class="liste_titre">';
print "<td>Date cotisations</td>\n"; print "<td>Date cotisations</td>\n";

View File

@ -30,27 +30,20 @@
require("../main.inc.php"); require("../main.inc.php");
function llxHeader($head = "") { function llxHeader($head = "") {
global $user, $conf; global $user, $conf, $langs;
/*
*
*
*/
top_menu($head); top_menu($head);
$menu = new Menu(); $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ésions à valider");
$menu->add_submenu("liste.php?statut=1","Adhérents à ce jour"); $menu->add_submenu("liste.php?statut=1","Adhérents à ce jour");
$menu->add_submenu("liste.php?statut=0","Adhésions résiliées"); $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(DOL_URL_ROOT."/public/adherents/","Espace adherents public");
$menu->add("index.php","Export"); $menu->add("index.php","Export");
@ -58,16 +51,17 @@ function llxHeader($head = "") {
$menu->add_submenu("cartes/carte.php","Cartes d'adhérents"); $menu->add_submenu("cartes/carte.php","Cartes d'adhérents");
$menu->add_submenu("cartes/etiquette.php","Etiquettes 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("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",$langs->trans("Setup"));
{
$menu->add("index.php","Configuration");
$menu->add_submenu("type.php","Type d'adhérent"); $menu->add_submenu("type.php","Type d'adhérent");
$menu->add_submenu("options.php","Champs optionnels"); $menu->add_submenu("options.php","Champs optionnels");
$menu->add_submenu(DOL_URL_ROOT."/admin/adherent.php","Constantes");
if ($user->admin) {
$menu->add_submenu(DOL_URL_ROOT."/admin/adherent.php",$langs->trans("Module"));
} }
left_menu($menu->liste); left_menu($menu->liste);

View File

@ -49,6 +49,8 @@ $main_use_spip_auto = ADHERENT_USE_SPIP_AUTO;
$typeconst=array('yesno','texte','chaine'); $typeconst=array('yesno','texte','chaine');
$var=True; $var=True;
// Action mise a jour ou ajout d'une constante
if ($_POST["action"] == 'update' || $_POST["action"] == 'add') if ($_POST["action"] == 'update' || $_POST["action"] == 'add')
{ {
if (isset($_POST["consttype"]) && $_POST["consttype"] != '') 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') if ($_GET["action"] == 'set')
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX." WHERE name = '".$_GET["name"]."' ;"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = '".$_GET["name"]."' ;";
$db->query($sql); $result=$db->query($sql);
if (! $result) {
dolibarr_print_error($db);
exit;
}
$sql =''; $sql ='';
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const(name,value,visible) values ('".$_GET["name"]."','".$_GET["value"]."', 0);"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."const(name,value,visible) values ('".$_GET["name"]."','".$_GET["value"]."', 0);";
if ($db->query($sql)) $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') if ($_GET["action"] == 'unset')
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = '".$_GET["name"]."'"; $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 * 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_SUBJECT',
'ADHERENT_MAIL_COTIS', 'ADHERENT_MAIL_COTIS',
'ADHERENT_MAIL_EDIT_SUBJECT', 'ADHERENT_MAIL_EDIT_SUBJECT',
@ -233,6 +248,9 @@ form_constantes($constantes);
$db->close(); $db->close();
print '<br>';
llxFooter(); llxFooter();
@ -286,10 +304,8 @@ function form_constantes($tableau){
} }
print '</td><td>'; 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"> &nbsp;'; print '<input type="Submit" value="Update" name="Button"> &nbsp;';
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 "</td></tr>\n";
print '</form>'; print '</form>';
@ -298,4 +314,5 @@ function form_constantes($tableau){
} }
print '</table>'; print '</table>';
} }
?> ?>

View File

@ -80,6 +80,7 @@ insert into llx_const (name, value, type) values ('DONS_FORM','fsfe.fr.php','cha
-- --
-- Mail Adherent -- 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_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_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); 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);

View File

@ -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 rubrique varchar(255);
alter table llx_societe add remise_client real default 0; 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; alter table llx_societe add fk_forme_juridique integer default 0 after fk_typent;