Qual: Plus de trace dans validation adhérent

This commit is contained in:
Laurent Destailleur 2007-02-06 01:15:11 +00:00
parent d82d5a1ac3
commit 2be8142b44
2 changed files with 117 additions and 103 deletions

View File

@ -923,13 +923,15 @@ class Adherent
/** /**
\brief fonction qui ajoute l'adhérent au abonnements automatiques \brief Fonction qui ajoute l'adhérent au abonnements automatiques
\param adht \param adht
\remarks mailing-list, spip, glasnost, etc... \remarks mailing-list, spip, glasnost, etc...
\return int <0 si KO, >=0 si OK
*/ */
function add_to_abo($adht) function add_to_abo($adht)
{ {
$err=0; $err=0;
// mailman // mailman
if (defined("ADHERENT_USE_MAILMAN") && ADHERENT_USE_MAILMAN == 1) if (defined("ADHERENT_USE_MAILMAN") && ADHERENT_USE_MAILMAN == 1)
{ {
@ -940,30 +942,35 @@ class Adherent
} }
} }
// glasnost
if ($adht->vote == 'yes' && if ($adht->vote == 'yes' &&
defined("ADHERENT_USE_GLASNOST") && ADHERENT_USE_GLASNOST ==1 && defined("ADHERENT_USE_GLASNOST") && ADHERENT_USE_GLASNOST ==1 &&
defined("ADHERENT_USE_GLASNOST_AUTO") && ADHERENT_USE_GLASNOST_AUTO ==1 defined("ADHERENT_USE_GLASNOST_AUTO") && ADHERENT_USE_GLASNOST_AUTO ==1
) )
{ {
if(!$this->add_to_glasnost()) $result=$this->add_to_glasnost();
if(! $result)
{ {
$err+=1; $err+=1;
} }
} }
// spip
if ( if (
defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1 && defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1 &&
defined("ADHERENT_USE_SPIP_AUTO") && ADHERENT_USE_SPIP_AUTO ==1 defined("ADHERENT_USE_SPIP_AUTO") && ADHERENT_USE_SPIP_AUTO ==1
) )
{ {
if(!$this->add_to_spip()) $result=$this->add_to_spip();
if(!$result)
{ {
$err+=1; $err+=1;
} }
} }
if ($err>0) if ($err)
{ {
// error // error
return 0; return -$err;
} }
else else
{ {
@ -1016,9 +1023,12 @@ class Adherent
/** /**
\brief fonction qui donne les droits rédacteurs dans spip \brief fonction qui donne les droits rédacteurs dans spip
\return int =0 si KO, >0 si OK
*/ */
function add_to_spip() function add_to_spip()
{ {
dolibarr_syslog("Adherent::add_to_spip");
if (defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1 && if (defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1 &&
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 != '' &&
@ -1048,7 +1058,6 @@ class Adherent
/** /**
\brief fonction qui enlève les droits rédacteurs dans spip \brief fonction qui enlève les droits rédacteurs dans spip
*/ */
function del_to_spip() function del_to_spip()
{ {
if (defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1 && if (defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1 &&
@ -1126,10 +1135,14 @@ class Adherent
/** /**
\brief Fonction qui ajoute l'utilisateur dans glasnost \brief Fonction qui ajoute l'utilisateur dans glasnost
\return int =0 si KO, >0 si OK
*/ */
function add_to_glasnost() function add_to_glasnost()
{ {
global $conf,$langs;
dolibarr_syslog("Adherent::add_to_glasnost");
if (defined("ADHERENT_USE_GLASNOST") && ADHERENT_USE_GLASNOST ==1 && if (defined("ADHERENT_USE_GLASNOST") && ADHERENT_USE_GLASNOST ==1 &&
defined('ADHERENT_GLASNOST_SERVEUR') && ADHERENT_GLASNOST_SERVEUR != '' && defined('ADHERENT_GLASNOST_SERVEUR') && ADHERENT_GLASNOST_SERVEUR != '' &&
defined('ADHERENT_GLASNOST_USER') && ADHERENT_GLASNOST_USER != '' && defined('ADHERENT_GLASNOST_USER') && ADHERENT_GLASNOST_USER != '' &&
@ -1192,7 +1205,6 @@ class Adherent
/** /**
\brief fonction qui enlève l'utilisateur de glasnost \brief fonction qui enlève l'utilisateur de glasnost
*/ */
function del_to_glasnost() function del_to_glasnost()
{ {
if (defined("ADHERENT_USE_GLASNOST") && ADHERENT_USE_GLASNOST ==1 && if (defined("ADHERENT_USE_GLASNOST") && ADHERENT_USE_GLASNOST ==1 &&
@ -1360,6 +1372,8 @@ class Adherent
{ {
global $conf,$langs; global $conf,$langs;
dolibarr_syslog("Adherent::add_to_mailman");
if (! function_exists("curl_init")) if (! function_exists("curl_init"))
{ {
$this->error=$langs->trans("ErrorFunctionNotAvailableInPHP","curl_init"); $this->error=$langs->trans("ErrorFunctionNotAvailableInPHP","curl_init");
@ -1401,7 +1415,7 @@ class Adherent
//curl_setopt($ch, CURLOPT_URL,"http://www.j1b.org/"); //curl_setopt($ch, CURLOPT_URL,"http://www.j1b.org/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 5); curl_setopt($ch, CURLOPT_TIMEOUT, 5);
//curl_setopt($ch, CURLOPT_POST, 0); //curl_setopt($ch, CURLOPT_POST, 0);
//curl_setopt($ch, CURLOPT_POSTFIELDS, "a=3&b=5"); //curl_setopt($ch, CURLOPT_POSTFIELDS, "a=3&b=5");
@ -1469,7 +1483,7 @@ class Adherent
//curl_setopt($ch, CURLOPT_URL,"http://www.j1b.org/"); //curl_setopt($ch, CURLOPT_URL,"http://www.j1b.org/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 5); curl_setopt($ch, CURLOPT_TIMEOUT, 5);
//curl_setopt($ch, CURLOPT_POST, 0); //curl_setopt($ch, CURLOPT_POST, 0);
//curl_setopt($ch, CURLOPT_POSTFIELDS, "a=3&b=5"); //curl_setopt($ch, CURLOPT_POSTFIELDS, "a=3&b=5");

View File

@ -378,8 +378,8 @@ if ($_POST["action"] == 'confirm_valid' && $_POST["confirm"] == 'yes')
$result=$adh->send_an_email($adh->email,$conf->global->ADHERENT_MAIL_VALID,$conf->global->ADHERENT_MAIL_VALID_SUBJECT); $result=$adh->send_an_email($adh->email,$conf->global->ADHERENT_MAIL_VALID,$conf->global->ADHERENT_MAIL_VALID_SUBJECT);
} }
// rajoute l'utilisateur dans les divers abonnements .. // Rajoute l'utilisateur dans les divers abonnements (mailman, spip, etc...)
if (!$adh->add_to_abo($adht)) if ($adh->add_to_abo($adht) < 0)
{ {
// error // error
$errmsg.="Echec du rajout de l'utilisateur aux abonnements: ".$adh->error."<BR>\n"; $errmsg.="Echec du rajout de l'utilisateur aux abonnements: ".$adh->error."<BR>\n";