diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php new file mode 100644 index 0000000000000000000000000000000000000000..715b2ebc981148d9187cd0282b4b4dd0f725ba74 --- /dev/null +++ b/htdocs/adherents/adherent.class.php @@ -0,0 +1,1134 @@ +<?PHP +/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> + * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +class Adherent +{ + var $id; + var $db; + var $prenom; + var $nom; + var $societe; + var $adresse; + var $cp; + var $ville; + var $pays; + var $typeid; + var $morphy; + var $email; + var $public; + var $commentaire; + var $statut; + var $login; + var $pass; + var $naiss; + var $photo; + // var $public; + var $array_options; + + var $errorstr; + /* + * + * + */ + Function Adherent($DB, $id='') + { + $this->db = $DB ; + $this->id = $id; + $this->statut = -1; + // l'adherent n'est pas public par defaut + $this->public = 0; + // les champs optionnels sont vides + $this->array_options=array(); + } + + /* + * function envoyant un email au destinataire (recipient) avec le text fourni en parametre. + * La particularite de cette fonction est de remplacer certains champs par leur valeur pour l'adherent + * en l'occurrence : + * %PRENOM% : est remplace par le prenom + * %NOM% : est remplace par nom + * %INFOS% : l'ensemble des attributs de cet adherent + * %SERVEUR% : URL du serveur web + * ... + */ + Function send_an_email($recipients,$text,$subject="Vos coordonnees sur %SERVEUR%") + { + $patterns = array ( + '/%PRENOM%/', + '/%NOM%/', + '/%INFOS%/', + '/%INFO%/', + '/%SERVEUR%/', + '/%SOCIETE%/', + '/%ADRESSE%/', + '/%CP%/', + '/%VILLE%/', + '/%PAYS%/', + '/%EMAIL%/', + '/%NAISS%/', + '/%PHOTO%/', + '/%LOGIN%/', + '/%PASS%/' + ); + $infos = "Prenom : $this->prenom\nNom : $this->nom\nSociete : $this->societe\nAdresse : $this->adresse\nCP : $this->cp\nVille : $this->ville\nPays : $this->pays\nEmail : $this->email\nLogin : $this->login\nPassword : $this->pass\nDate de naissance : $this->naiss\nPhoto : $this->photo\n"; + if ($this->public == 1) + { + $infos.="Fiche Publique : Oui\n"; + } + else + { + $infos.="Fiche Publique : Non\n"; + } + $replace = array ( + $this->prenom, + $this->nom, + $infos, + $infos, + "http://".$_SERVER["SERVER_NAME"]."/", + $this->societe, + $this->adresse, + $this->cp, + $this->ville, + $this->pays, + $this->email, + $this->naiss, + $this->photo, + $this->login, + $this->pass + ); + $texttosend = preg_replace ($patterns, $replace, $text); + $subjectosend = preg_replace ($patterns, $replace, $subject); + if (defined('MAIN_MAIL_FROM') && MAIN_MAIL_FROM != ''){ + return mail($recipients,$subjectosend,$texttosend,"From: ".MAIN_MAIL_FROM."\nReply-To: ".MAIN_MAIL_FROM."\nX-Mailer: PHP/" . phpversion()); + }else{ + return mail($recipients,$subjectosend,$texttosend); + } + } + /* + * + * + * + */ + Function print_error_list() + { + $num = sizeof($this->errorstr); + for ($i = 0 ; $i < $num ; $i++) + { + print "<li>" . $this->errorstr[$i]; + } + } + /* + * + * + */ + Function check($minimum=0) + { + $err = 0; + + if (strlen(trim($this->societe)) == 0) + { + if ((strlen(trim($this->nom)) + strlen(trim($this->prenom))) == 0) + { + $error_string[$err] = "Vous devez saisir vos nom et pr�nom ou le nom de votre soci�t�."; + $err++; + } + } + + if (strlen(trim($this->adresse)) == 0) + { + $error_string[$err] = "L'adresse saisie est invalide"; + $err++; + } + + if (strlen(trim($this->cp)) == 0) + { + $error_string[$err] = "Le code postal saisi est invalide"; + $err++; + } + + if (strlen(trim($this->ville)) == 0) + { + $error_string[$err] = "La ville saisie est invalide"; + $err++; + } + + if (strlen(trim($this->email)) == 0) + { + $error_string[$err] = "L'email saisi est invalide"; + $err++; + } + + if (strlen(trim($this->login)) == 0) + { + $error_string[$err] = "Le login saisi est invalide"; + $err++; + } + + if (strlen(trim($this->pass)) == 0) + { + $error_string[$err] = "Le pass saisi est invalide"; + $err++; + } + $this->amount = trim($this->amount); + + $map = range(0,9); + for ($i = 0; $i < strlen($this->amount) ; $i++) + { + if (!isset($map[substr($this->amount, $i, 1)] )) + { + $error_string[$err] = "Le montant du don contient un/des caract�re(s) invalide(s)"; + $err++; + $amount_invalid = 1; + break; + } + } + + if (! $amount_invalid) + { + if ($this->amount == 0) + { + $error_string[$err] = "Le montant du don est null"; + $err++; + } + else + { + if ($this->amount < $minimum && $minimum > 0) + { + $error_string[$err] = "Le montant minimum du don est de $minimum"; + $err++; + } + } + } + + /* + * Return errors + * + */ + + if ($err) + { + $this->errorstr = $error_string; + return 0; + } + else + { + return 1; + } + + } + /* + * Cr�ation + * + * + */ + Function create($userid) + { + /* + * Insertion dans la base + */ + + $this->date = $this->db->idate($this->date); + + $sql = "INSERT INTO llx_adherent (datec)"; + $sql .= " VALUES (now())"; + + $result = $this->db->query($sql); + + if ($result) + { + $this->id = $this->db->last_insert_id(); + return $this->update(); + } + else + { + print $this->db->error(); + print "<h2><br>$sql<br></h2>"; + return 0; + } + } + + /* + * Mise � jour + * + * + */ + Function update() + { + + $sql = "UPDATE llx_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); + + if (!$result) + { + print $this->db->error(); + print "<br>$sql<br>"; + return 0; + } + + if (sizeof($this->array_options) > 0 ) + { + $sql = "REPLACE INTO llx_adherent_options SET adhid = $this->id"; + foreach($this->array_options as $key => $value) + { + // recupere le nom de l'attribut + $attr=substr($key,8); + $sql.=",$attr = '".$this->array_options[$key]."'"; + } + $result = $this->db->query($sql); + } + + if ($result) + { + return 1; + } + else + { + print $this->db->error(); + print "<h2><br>$sql<br></h2>"; + return 0; + } + } + + /* + * Suppression de l'adh�rent + * + */ + Function delete($rowid) + + { + $result = 0; + $sql = "DELETE FROM llx_adherent WHERE rowid = $rowid"; + + if ( $this->db->query( $sql) ) + { + if ( $this->db->affected_rows() ) + { + + $sql = "DELETE FROM llx_cotisation WHERE fk_adherent = $rowid"; + if ( $this->db->query( $sql) ) + { + if ( $this->db->affected_rows() ) + { + $result = 1; + } + } + $sql = "DELETE FROM llx_adherent_options WHERE adhid = $rowid"; + if ( $this->db->query( $sql) ) + { + if ( $this->db->affected_rows() ) + { + $result = 1; + } + } + } + } + else + { + print "Err : ".$this->db->error(); + } + + return $result; + + } + /* + * Fetch + * + * + */ + /* Fetch adherent corresponding to login passed in argument */ + Function fetch_login($login) + { + $sql = "SELECT rowid FROM llx_adherent WHERE login='$login' LIMIT 1"; + if ( $this->db->query( $sql) ) + { + if ($this->db->num_rows()) + { + $obj = $this->db->fetch_object(0); + $this->fetch($obj->rowid); + } + } + else + { + print $this->db->error(); + } + } + /* Fetch adherent corresponding to rowid passed in argument */ + Function fetch($rowid) + { + $sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, d.statut, d.public, d.adresse, d.cp, d.ville, d.pays, d.note, d.email, d.login, d.pass, d.naiss, d.photo, d.fk_adherent_type, d.morphy, t.libelle as type"; + $sql .= ",".$this->db->pdate("d.datefin")." as datefin"; + $sql .= " FROM llx_adherent as d, llx_adherent_type as t"; + $sql .= " WHERE d.rowid = $rowid AND d.fk_adherent_type = t.rowid"; + + if ( $this->db->query( $sql) ) + { + if ($this->db->num_rows()) + { + + $obj = $this->db->fetch_object(0); + + $this->id = $obj->rowid; + $this->typeid = $obj->fk_adherent_type; + $this->type = $obj->type; + $this->statut = $obj->statut; + $this->public = $obj->public; + $this->date = $obj->datedon; + $this->prenom = stripslashes($obj->prenom); + $this->nom = stripslashes($obj->nom); + $this->societe = stripslashes($obj->societe); + $this->adresse = stripslashes($obj->adresse); + $this->cp = stripslashes($obj->cp); + $this->ville = stripslashes($obj->ville); + $this->email = stripslashes($obj->email); + $this->login = stripslashes($obj->login); + $this->pass = stripslashes($obj->pass); + $this->naiss = stripslashes($obj->naiss); + $this->photo = stripslashes($obj->photo); + $this->pays = stripslashes($obj->pays); + $this->datefin = $obj->datefin; + $this->commentaire = stripslashes($obj->note); + $this->morphy = $obj->morphy; + } + } + else + { + print $this->db->error(); + } + + } + + /* + * fetch optional attribute + */ + Function fetch_optionals($rowid) + { + $tab=array(); + $sql = "SELECT *"; + $sql .= " FROM llx_adherent_options"; + $sql .= " WHERE adhid=$rowid"; + + if ( $this->db->query( $sql) ){ + if ($this->db->num_rows()){ + + //$obj = $this->db->fetch_object(0); + $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{ + print $this->db->error(); + } + + } + + /* + * fetch optional attribute name + */ + Function fetch_name_optionals() + { + $array_name_options=array(); + $sql = "SHOW COLUMNS FROM llx_adherent_options"; + + if ( $this->db->query( $sql) ){ + if ($this->db->num_rows()){ + //$tab = $this->db->fetch_object(); + //$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{ + print $this->db->error(); + return array() ; + } + + } + /* + * Cotisation + * + */ + Function cotisation($date, $montant) + + { + + $sql = "INSERT INTO llx_cotisation (fk_adherent, dateadh, cotisation)"; + $sql .= " VALUES ($this->id, ".$this->db->idate($date).", $montant)"; + + if ( $this->db->query( $sql) ) + { + if ( $this->db->affected_rows() ) + { + + $datefin = mktime(12, 0 , 0, + strftime("%m",$date), + strftime("%d",$date), + strftime("%Y",$date)+1) - (24 * 3600); + + $sql = "UPDATE llx_adherent SET datefin = ".$this->db->idate($datefin)." WHERE rowid =". $this->id; + + if ( $this->db->query( $sql) ) + { + return 1; + } + } + else + { + return 0; + } + } + else + { + print "Err : ".$this->db->error(); + return 0; + } + } + + + + /* + * Validation + * + * + */ + Function validate($userid) + { + + $sql = "UPDATE llx_adherent SET "; + $sql .= "statut=1"; + $sql .= ",fk_user_valid=".$userid; + + $sql .= " WHERE rowid = $this->id"; + + $result = $this->db->query($sql); + + if ($result) + { + return 1; + } + else + { + print $this->db->error(); + print "<h2><br>$sql<br></h2>"; + return 0; + } + } + /* + * R�siliation + * + * + */ + Function resiliate($userid) + { + + $sql = "UPDATE llx_adherent SET "; + $sql .= "statut=0"; + $sql .= ",fk_user_valid=".$userid; + + $sql .= " WHERE rowid = $this->id"; + + $result = $this->db->query($sql); + + if ($result) + { + return 1; + } + else + { + print $this->db->error(); + print "<h2><br>$sql<br></h2>"; + return 0; + } + } + + /* + * Ajoute le user aux differents abonneents automatiques + * (mailing-list, spip, glasnost etc etc ..) + * + */ + Function add_to_abo($adht) + { + $err=0; + // mailman + if (defined("MAIN_USE_MAILMAN") && MAIN_USE_MAILMAN == 1) + { + if(!$this->add_to_mailman()) + { + $err+=1; + } + } + + if ($adht->vote == 'yes' && + defined("MAIN_USE_GLASNOST") && MAIN_USE_GLASNOST ==1 && + defined("MAIN_USE_GLASNOST_AUTO") && MAIN_USE_GLASNOST_AUTO ==1 + ) + { + if(!$this->add_to_glasnost()){ + $err+=1; + } + } + if ( + defined("MAIN_USE_SPIP") && MAIN_USE_SPIP ==1 && + defined("MAIN_USE_SPIP_AUTO") && MAIN_USE_SPIP_AUTO ==1 + ) + { + if(!$this->add_to_spip()){ + $err+=1; + } + } + if ($err>0){ + // error + return 0; + }else{ + return 1; + } + } + + /* + * supprime le user des differents abonnements automatiques + * (mailing-list, spip, glasnost etc etc ..) + * + */ + Function del_to_abo($adht) + { + $err=0; + // mailman + if (defined("MAIN_USE_MAILMAN") && MAIN_USE_MAILMAN == 1) + { + if(!$this->del_to_mailman()){ + $err+=1; + } + } + if ($adht->vote == 'yes' && + defined("MAIN_USE_GLASNOST") && MAIN_USE_GLASNOST ==1 && + defined("MAIN_USE_GLASNOST_AUTO") && MAIN_USE_GLASNOST_AUTO ==1 + ) + { + if(!$this->del_to_glasnost()){ + $err+=1; + } + } + if ( + defined("MAIN_USE_SPIP") && MAIN_USE_SPIP ==1 && + defined("MAIN_USE_SPIP_AUTO") && MAIN_USE_SPIP_AUTO ==1 + ) + { + if(!$this->del_to_spip()){ + $err+=1; + } + } + if ($err>0){ + // error + return 0; + }else{ + return 1; + } + } + + /* + * + * Ajoute cet utilisateur comme redacteur dans spip + * + */ + Function add_to_spip() + { + if (defined("MAIN_USE_SPIP") && MAIN_USE_SPIP ==1 && + defined('MAIN_SPIP_SERVEUR') && MAIN_SPIP_SERVEUR != '' && + defined('MAIN_SPIP_USER') && MAIN_SPIP_USER != '' && + defined('MAIN_SPIP_PASS') && MAIN_SPIP_PASS != '' && + defined('MAIN_SPIP_DB') && MAIN_SPIP_DB != '' + ){ + $mdpass=md5($this->pass); + $htpass=crypt($this->pass,initialiser_sel()); + $query = "INSERT INTO spip_auteurs (nom, email, login, pass, htpass, alea_futur, statut) VALUES(\"".$this->prenom." ".$this->nom."\",\"".$this->email."\",\"".$this->login."\",\"$mdpass\",\"$htpass\",FLOOR(32000*RAND()),\"1comite\")"; + // $mydb=new Db('mysql',MAIN_SPIP_SERVEUR,MAIN_SPIP_USER,MAIN_SPIP_PASS,MAIN_SPIP_DB); + $mydb=new DoliDb('mysql',MAIN_SPIP_SERVEUR,MAIN_SPIP_USER,MAIN_SPIP_PASS,MAIN_SPIP_DB); + $result = $mydb->query($query); + + if ($result) + { + $mydb->close(); + return 1; + } + else + { + $this->errorstr=$mydb->error(); + return 0; + } + } + } + + /* + * + * supprime cet utilisateur dans spip + * + */ + Function del_to_spip() + { + if (defined("MAIN_USE_SPIP") && MAIN_USE_SPIP ==1 && + defined('MAIN_SPIP_SERVEUR') && MAIN_SPIP_SERVEUR != '' && + defined('MAIN_SPIP_USER') && MAIN_SPIP_USER != '' && + defined('MAIN_SPIP_PASS') && MAIN_SPIP_PASS != '' && + defined('MAIN_SPIP_DB') && MAIN_SPIP_DB != '' + ){ + $query = "DELETE FROM spip_auteurs WHERE login='".$this->login."'"; + $mydb=new DoliDb('mysql',MAIN_SPIP_SERVEUR,MAIN_SPIP_USER,MAIN_SPIP_PASS,MAIN_SPIP_DB); + $result = $mydb->query($query); + + if ($result) + { + $mydb->close(); + return 1; + } + else + { + $this->errorstr=$mydb->error(); + return 0; + } + } + } + + /* + * + * est-ce que cet utilisateur est dans spip + * + */ + Function is_in_spip() + { + if (defined("MAIN_USE_SPIP") && MAIN_USE_SPIP ==1 && + defined('MAIN_SPIP_SERVEUR') && MAIN_SPIP_SERVEUR != '' && + defined('MAIN_SPIP_USER') && MAIN_SPIP_USER != '' && + defined('MAIN_SPIP_PASS') && MAIN_SPIP_PASS != '' && + defined('MAIN_SPIP_DB') && MAIN_SPIP_DB != '' + ){ + $query = "SELECT login FROM spip_auteurs WHERE login='".$this->login."'"; + $mydb=new DoliDb('mysql',MAIN_SPIP_SERVEUR,MAIN_SPIP_USER,MAIN_SPIP_PASS,MAIN_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; + } + } + } + + /* + * Rajoute cet utilisateur au serveur glasnost + * + */ + Function add_to_glasnost() + { + if (defined("MAIN_USE_GLASNOST") && MAIN_USE_GLASNOST ==1 && + defined('MAIN_GLASNOST_SERVEUR') && MAIN_GLASNOST_SERVEUR != '' && + defined('MAIN_GLASNOST_USER') && MAIN_GLASNOST_USER != '' && + defined('MAIN_GLASNOST_PASS') && MAIN_GLASNOST_PASS != '' + ){ + // application token is not useful here + $applicationtoken=''; + list($success, $response) = + XMLRPC_request(MAIN_GLASNOST_SERVEUR.':8001', + '/RPC2', + 'callGateway', + array(XMLRPC_prepare("glasnost://".MAIN_GLASNOST_SERVEUR."/authentication"), + XMLRPC_prepare('getUserIdAndToken'), + XMLRPC_prepare(array("glasnost://".MAIN_GLASNOST_SERVEUR."/authentication","$applicationtoken",MAIN_GLASNOST_USER,MAIN_GLASNOST_PASS)) + ) + ); + if ($success){ + $userid=$response[0]; + $usertoken=$response[1]; + }else{ + $this->errorstr=$response['faultString']; + return 0; + } + + list($success,$response)= + XMLRPC_request(MAIN_GLASNOST_SERVEUR.':8001', + '/RPC2', + 'callGateway', + array(XMLRPC_prepare("glasnost://".MAIN_GLASNOST_SERVEUR."/people"), + XMLRPC_prepare('addObject'), + XMLRPC_prepare(array( + "glasnost://".MAIN_GLASNOST_SERVEUR."/people", + "$applicationtoken", + $usertoken, + array( + '__thingCategory__'=>'object', + '__thingName__'=> 'Person', + 'firstName'=>$this->prenom, + 'lastName'=>$this->nom, + 'login'=>$this->login, + 'email'=>$this->email + ) + ) + ) + ) + ); + if ($success){ + $personid=$response[0]; + }else{ + $this->errorstr=$response['faultString']; + return 0; + } + return 1; + }else{ + $this->errorstr="Constantes de connection non definies"; + return 0; + } + } + + /* + * efface cet utilisateur du serveur glasnost + * + */ + Function del_to_glasnost() + { + if (defined("MAIN_USE_GLASNOST") && MAIN_USE_GLASNOST ==1 && + defined('MAIN_GLASNOST_SERVEUR') && MAIN_GLASNOST_SERVEUR != '' && + defined('MAIN_GLASNOST_USER') && MAIN_GLASNOST_USER != '' && + defined('MAIN_GLASNOST_PASS') && MAIN_GLASNOST_PASS != '' + ){ + // application token is not useful here + $applicationtoken=''; + list($success, $response) = + XMLRPC_request(MAIN_GLASNOST_SERVEUR.':8001', + '/RPC2', + 'callGateway', + array(XMLRPC_prepare("glasnost://".MAIN_GLASNOST_SERVEUR."/authentication"), + XMLRPC_prepare('getUserIdAndToken'), + XMLRPC_prepare(array("glasnost://".MAIN_GLASNOST_SERVEUR."/authentication","$applicationtoken",MAIN_GLASNOST_USER,MAIN_GLASNOST_PASS)) + ) + ); + if ($success){ + $userid=$response[0]; + $usertoken=$response[1]; + }else{ + return 0; + } + // recuperation du personID + list($success,$response)= + XMLRPC_request(MAIN_GLASNOST_SERVEUR.':8001', + '/RPC2', + 'callGateway', + array(XMLRPC_prepare("glasnost://".MAIN_GLASNOST_SERVEUR."/people"), + XMLRPC_prepare('getObjectByLogin'), + XMLRPC_prepare(array( + "glasnost://".MAIN_GLASNOST_SERVEUR."/people", + "$applicationtoken", + $usertoken, + $this->login + ) + ) + ) + ); + if ($success){ + $personid=$response['id']; + }else{ + $this->errorstr=$response['faultString']; + return 0; + } + if (defined('MAIN_GLASNOST_DEFAULT_GROUPID') && MAIN_GLASNOST_DEFAULT_GROUPID != ''){ + // recuperation des personne de ce groupe + list($success,$response)= + XMLRPC_request(MAIN_GLASNOST_SERVEUR.':8001', + '/RPC2', + 'callGateway', + array(XMLRPC_prepare("glasnost://".MAIN_GLASNOST_SERVEUR."/groups"), + XMLRPC_prepare('getObject'), + XMLRPC_prepare(array( + "glasnost://".MAIN_GLASNOST_SERVEUR."/groups", + "$applicationtoken", + $usertoken, + MAIN_GLASNOST_DEFAULT_GROUPID + ) + ) + ) + ); + if ($success){ + $groupids=$response['membersSet']; + }else{ + $this->errorstr=$response['faultString']; + return 0; + } + // TODO faire la verification que le user n'est pas dans ce + // groupe par defaut. si il y ai il faut l'effacer et + // modifier le groupe + } + // suppression du personID + list($success,$response)= + XMLRPC_request(MAIN_GLASNOST_SERVEUR.':8001', + '/RPC2', + 'callGateway', + array(XMLRPC_prepare("glasnost://".MAIN_GLASNOST_SERVEUR."/people"), + XMLRPC_prepare('deleteObject'), + XMLRPC_prepare(array( + "glasnost://".MAIN_GLASNOST_SERVEUR."/people", + "$applicationtoken", + $usertoken, + $personid + ) + ) + ) + ); + if ($success){ + return 1; + }else{ + $this->errorstr=$response['faultString']; + return 0; + } + }else{ + $this->errorstr="Constantes de connection non definies"; + return 0; + } + } + + /* + * efface cet utilisateur du serveur glasnost + * + */ + Function is_in_glasnost() + { + if (defined("MAIN_USE_GLASNOST") && MAIN_USE_GLASNOST ==1 && + defined('MAIN_GLASNOST_SERVEUR') && MAIN_GLASNOST_SERVEUR != '' && + defined('MAIN_GLASNOST_USER') && MAIN_GLASNOST_USER != '' && + defined('MAIN_GLASNOST_PASS') && MAIN_GLASNOST_PASS != '' + ){ + // application token is not useful here + $applicationtoken=''; + list($success, $response) = + XMLRPC_request(MAIN_GLASNOST_SERVEUR.':8001', + '/RPC2', + 'callGateway', + array(XMLRPC_prepare("glasnost://".MAIN_GLASNOST_SERVEUR."/authentication"), + XMLRPC_prepare('getUserIdAndToken'), + XMLRPC_prepare(array("glasnost://".MAIN_GLASNOST_SERVEUR."/authentication","$applicationtoken",MAIN_GLASNOST_USER,MAIN_GLASNOST_PASS)) + ) + ); + if ($success){ + $userid=$response[0]; + $usertoken=$response[1]; + }else{ + return 0; + } + // recuperation du personID + list($success,$response)= + XMLRPC_request(MAIN_GLASNOST_SERVEUR.':8001', + '/RPC2', + 'callGateway', + array(XMLRPC_prepare("glasnost://".MAIN_GLASNOST_SERVEUR."/people"), + XMLRPC_prepare('getObjectByLogin'), + XMLRPC_prepare(array( + "glasnost://".MAIN_GLASNOST_SERVEUR."/people", + "$applicationtoken", + $usertoken, + $this->login + ) + ) + ) + ); + if ($success){ + $personid=$response['id']; + return 1; + }else{ + $this->errorstr=$response['faultString']; + return 0; + } + }else{ + $this->errorstr="Constantes de connection non definies"; + return 0; + } + } + /* + * + * + */ + Function add_to_mailman($listes='') + { + if (defined("MAIN_MAILMAN_URL") && MAIN_MAILMAN_URL != '' && defined("MAIN_MAILMAN_LISTS") && MAIN_MAILMAN_LISTS != '') + { + if ($listes ==''){ + $lists=explode(',',MAIN_MAILMAN_LISTS); + }else{ + $lists=explode(',',$listes); + } + foreach ($lists as $list) + { + // on remplace dans l'url le nom de la liste ainsi + // que l'email et le mot de passe + $patterns = array ( + '/%LISTE%/', + '/%EMAIL%/', + '/%PASS%/', + '/%ADMINPW%/', + '/%SERVER%/' + ); + $replace = array ( + $list, + $this->email, + $this->pass, + MAIN_MAILMAN_ADMINPW, + MAIN_MAILMAN_SERVER + ); + $curl_url = preg_replace ($patterns, $replace, MAIN_MAILMAN_URL); + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL,"$curl_url"); + //curl_setopt($ch, CURLOPT_URL,"http://www.j1b.org/"); + curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); + curl_setopt($ch, CURLOPT_FAILONERROR, 1); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + curl_setopt($ch, CURLOPT_TIMEOUT, 5); + //curl_setopt($ch, CURLOPT_POST, 0); + //curl_setopt($ch, CURLOPT_POSTFIELDS, "a=3&b=5"); + //--- Start buffering + //ob_start(); + $result=curl_exec ($ch); + logfile($result); + //--- End buffering and clean output + //ob_end_clean(); + if (curl_error($ch) > 0) + { + // error + return 0; + } + curl_close ($ch); + + } + return 1; + } + else + { + $this->errorstr="Constantes de connection non definies"; + return 0; + } + } + + + + Function del_to_mailman($listes='') + { + if (defined("MAIN_MAILMAN_UNSUB_URL") && MAIN_MAILMAN_UNSUB_URL != '' && defined("MAIN_MAILMAN_LISTS") && MAIN_MAILMAN_LISTS != '') + { + if ($listes==''){ + $lists=explode(',',MAIN_MAILMAN_LISTS); + }else{ + $lists=explode(',',$listes); + } + foreach ($lists as $list) + { + // on remplace dans l'url le nom de la liste ainsi + // que l'email et le mot de passe + $patterns = array ( + '/%LISTE%/', + '/%EMAIL%/', + '/%PASS%/', + '/%ADMINPW%/', + '/%SERVER%/' + ); + $replace = array ( + $list, + $this->email, + $this->pass, + MAIN_MAILMAN_ADMINPW, + MAIN_MAILMAN_SERVER + ); + $curl_url = preg_replace ($patterns, $replace, MAIN_MAILMAN_UNSUB_URL); + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL,"$curl_url"); + //curl_setopt($ch, CURLOPT_URL,"http://www.j1b.org/"); + curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); + curl_setopt($ch, CURLOPT_FAILONERROR, 1); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + curl_setopt($ch, CURLOPT_TIMEOUT, 5); + //curl_setopt($ch, CURLOPT_POST, 0); + //curl_setopt($ch, CURLOPT_POSTFIELDS, "a=3&b=5"); + //--- Start buffering + //ob_start(); + $result=curl_exec ($ch); + logfile($result); + //--- End buffering and clean output + //ob_end_clean(); + if (curl_error($ch) > 0) + { + // error + return 0; + } + curl_close ($ch); + + } + return 1; + } + else + { + $this->errorstr="Constantes de connection non definies"; + return 0; + } + } + +} +?> diff --git a/htdocs/adherents/adherent_type.class.php b/htdocs/adherents/adherent_type.class.php new file mode 100644 index 0000000000000000000000000000000000000000..e859f09dc2f48393fc617cf33f41bf0edb9c32cc --- /dev/null +++ b/htdocs/adherents/adherent_type.class.php @@ -0,0 +1,216 @@ +<?PHP +/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +class AdherentType +{ + var $id; + var $libelle; + var $statut; + var $cotisation; // Soumis � la cotisation + var $errorstr; + var $mail_valid; // mail envoye lors de la validation + var $commentaire; // commentaire + var $vote; // droit de vote ? + /* + * + * + */ + Function AdherentType($DB, $soc_idp="") + { + $this->db = $DB ; + $this->statut = 1; + } + /* + * + * + * + */ + Function print_error_list() + { + $num = sizeof($this->errorstr); + for ($i = 0 ; $i < $num ; $i++) + { + print "<li>" . $this->errorstr[$i]; + } + } + /* + * + * + */ + /* + * Cr�ation + * + * + */ + Function create($userid) + { + /* + * Insertion dans la base + */ + + $sql = "INSERT INTO llx_adherent_type (statut)"; + $sql .= " VALUES ($this->statut)"; + + $result = $this->db->query($sql); + + if ($result) + { + $this->id = $this->db->last_insert_id(); + return $this->update(); + } + else + { + print $this->db->error(); + print "<h2><br>$sql<br></h2>"; + return 0; + } + } + + /* + * Mise � jour + * + * + */ + Function update() + { + + $sql = "UPDATE llx_adherent_type SET "; + $sql .= "libelle = '".$this->libelle ."'"; + $sql .= ",statut=".$this->statut; + $sql .= ",cotisation='".$this->cotisation."'"; + $sql .= ",note='".$this->commentaire."'"; + $sql .= ",vote='".$this->vote."'"; + $sql .= ",mail_valid='".$this->mail_valid."'"; + + $sql .= " WHERE rowid = $this->id"; + + $result = $this->db->query($sql); + + if ($result) + { + return 1; + } + else + { + print $this->db->error(); + print "<h2><br>$sql<br></h2>"; + return 0; + } + } + + /* + * Suppression + * + */ + Function delete($rowid) + + { + + $sql = "DELETE FROM llx_adherent_type WHERE rowid = $rowid"; + + if ( $this->db->query( $sql) ) + { + if ( $this->db->affected_rows() ) + { + return 1; + } + else + { + return 0; + } + } + else + { + print "Err : ".$this->db->error(); + return 0; + } + } + /* + * Fetch + * + * + */ + Function fetch($rowid) + { + $sql = "SELECT *"; + $sql .= " FROM llx_adherent_type as d"; + $sql .= " WHERE d.rowid = $rowid"; + + if ( $this->db->query( $sql) ) + { + if ($this->db->num_rows()) + { + + $obj = $this->db->fetch_object(0); + + $this->id = $obj->rowid; + $this->libelle = $obj->libelle; + $this->statut = $obj->statut; + $this->cotisation = $obj->cotisation; + $this->mail_valid = $obj->mail_valid; + $this->commentaire = $obj->note; + $this->vote = $obj->vote; + } + } + else + { + print $this->db->error(); + } + + } + /* + * + * + * + */ + Function liste_array() + { + $projets = array(); + + $sql = "SELECT rowid, libelle FROM llx_adherent_type"; + + if ($this->db->query($sql) ) + { + $nump = $this->db->num_rows(); + + if ($nump) + { + $i = 0; + while ($i < $nump) + { + $obj = $this->db->fetch_object($i); + + $projets[$obj->rowid] = $obj->libelle; + $i++; + } + } + return $projets; + } + else + { + print $this->db->error(); + } + + } + +} +?> diff --git a/htdocs/adherents/cotisation.class.php b/htdocs/adherents/cotisation.class.php new file mode 100644 index 0000000000000000000000000000000000000000..6949ddbd7236036a84aeaf02759728031d7a43ca --- /dev/null +++ b/htdocs/adherents/cotisation.class.php @@ -0,0 +1,464 @@ +<?PHP +/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +class Cotisation +{ + var $id; + var $db; + var $date; + var $amount; + var $prenom; + var $nom; + var $societe; + var $adresse; + var $cp; + var $ville; + var $pays; + var $email; + var $public; + var $projetid; + var $modepaiement; + var $modepaiementid; + var $commentaire; + var $statut; + + var $projet; + var $errorstr; + /* + * + * + */ + Function Cotisation($DB, $soc_idp="") + { + $this->db = $DB ; + $this->modepaiementid = 0; + } + /* + * + * + * + */ + Function print_error_list() + { + $num = sizeof($this->errorstr); + for ($i = 0 ; $i < $num ; $i++) + { + print "<li>" . $this->errorstr[$i]; + } + } + /* + * + * + */ + Function check($minimum=0) + { + $err = 0; + + if (strlen(trim($this->societe)) == 0) + { + if ((strlen(trim($this->nom)) + strlen(trim($this->prenom))) == 0) + { + $error_string[$err] = "Vous devez saisir vos nom et pr�nom ou le nom de votre soci�t�."; + $err++; + } + } + + if (strlen(trim($this->adresse)) == 0) + { + $error_string[$err] = "L'adresse saisie est invalide"; + $err++; + } + + if (strlen(trim($this->cp)) == 0) + { + $error_string[$err] = "Le code postal saisi est invalide"; + $err++; + } + + if (strlen(trim($this->ville)) == 0) + { + $error_string[$err] = "La ville saisie est invalide"; + $err++; + } + + if (strlen(trim($this->email)) == 0) + { + $error_string[$err] = "L'email saisi est invalide"; + $err++; + } + + $this->amount = trim($this->amount); + + $map = range(0,9); + for ($i = 0; $i < strlen($this->amount) ; $i++) + { + if (!isset($map[substr($this->amount, $i, 1)] )) + { + $error_string[$err] = "Le montant du don contient un/des caract�re(s) invalide(s)"; + $err++; + $amount_invalid = 1; + break; + } + } + + if (! $amount_invalid) + { + if ($this->amount == 0) + { + $error_string[$err] = "Le montant du don est null"; + $err++; + } + else + { + if ($this->amount < $minimum && $minimum > 0) + { + $error_string[$err] = "Le montant minimum du don est de $minimum"; + $err++; + } + } + } + + /* + * Return errors + * + */ + + if ($err) + { + $this->errorstr = $error_string; + return 0; + } + else + { + return 1; + } + + } + /* + * Cr�ation + * + * + */ + Function create($userid) + { + /* + * Insertion dans la base + */ + + $this->date = $this->db->idate($this->date); + + $sql = "INSERT INTO llx_don (datec, amount, fk_paiement,prenom, nom, societe,adresse, cp, ville, pays, public, fk_don_projet, note, fk_user_author, datedon, email)"; + $sql .= " VALUES (now(), $this->amount, $this->modepaiementid,'$this->prenom','$this->nom','$this->societe','$this->adresse', '$this->cp','$this->ville','$this->pays',$this->public, $this->projetid, '$this->commentaire', $userid, '$this->date','$this->email')"; + + $result = $this->db->query($sql); + + if ($result) + { + return $this->db->last_insert_id(); + } + else + { + print $this->db->error(); + print "<h2><br>$sql<br></h2>"; + return 0; + } + } + + /* + * Mise � jour + * + * + */ + Function update($userid) + { + + $this->date = $this->db->idate($this->date); + + $sql = "UPDATE llx_don SET "; + $sql .= "amount = " . $this->amount; + $sql .= ",fk_paiement = ".$this->modepaiementid; + $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 .= ",public=".$this->public; + $sql .= ",fk_don_projet=".$this->projetid; + $sql .= ",note='".$this->commentaire."'"; + $sql .= ",datedon='".$this->date."'"; + $sql .= ",email='".$this->email."'"; + $sql .= ",fk_statut=".$this->statut; + + $sql .= " WHERE rowid = $this->id"; + + $result = $this->db->query($sql); + + if ($result) + { + return 1; + } + else + { + print $this->db->error(); + print "<h2><br>$sql<br></h2>"; + return 0; + } + } + + /* + * Suppression du don + * + */ + Function delete($rowid) + + { + + $sql = "DELETE FROM llx_don WHERE rowid = $rowid AND fk_statut = 0;"; + + if ( $this->db->query( $sql) ) + { + if ( $this->db->affected_rows() ) + { + return 1; + } + else + { + return 0; + } + } + else + { + print "Err : ".$this->db->error(); + return 0; + } + } + /* + * Fetch + * + * + */ + Function fetch($rowid) + { + $sql = "SELECT d.rowid, ".$this->db->pdate("d.datedon")." as datedon, d.prenom, d.nom, d.societe, d.amount, p.libelle as projet, d.fk_statut, d.adresse, d.cp, d.ville, d.pays, d.public, d.amount, d.fk_paiement, d.note, cp.libelle, d.email, d.fk_don_projet"; + $sql .= " FROM llx_don as d, llx_don_projet as p, c_paiement as cp"; + $sql .= " WHERE p.rowid = d.fk_don_projet AND cp.id = d.fk_paiement AND d.rowid = $rowid"; + + if ( $this->db->query( $sql) ) + { + if ($this->db->num_rows()) + { + + $obj = $this->db->fetch_object(0); + + $this->id = $obj->rowid; + $this->date = $obj->datedon; + $this->prenom = stripslashes($obj->prenom); + $this->nom = stripslashes($obj->nom); + $this->societe = stripslashes($obj->societe); + $this->statut = $obj->fk_statut; + $this->adresse = stripslashes($obj->adresse); + $this->cp = stripslashes($obj->cp); + $this->ville = stripslashes($obj->ville); + $this->email = stripslashes($obj->email); + $this->pays = stripslashes($obj->pays); + $this->projet = $obj->projet; + $this->projetid = $obj->fk_don_projet; + $this->public = $obj->public; + $this->modepaiementid = $obj->fk_paiement; + $this->modepaiement = $obj->libelle; + $this->amount = $obj->amount; + $this->commentaire = stripslashes($obj->note); + } + } + else + { + print $this->db->error(); + } + + } + /* + * Suppression du don + * + */ + Function valid_promesse($rowid, $userid) + { + + $sql = "UPDATE llx_don SET fk_statut = 1, fk_user_valid = $userid WHERE rowid = $rowid AND fk_statut = 0;"; + + if ( $this->db->query( $sql) ) + { + if ( $this->db->affected_rows() ) + { + return 1; + } + else + { + return 0; + } + } + else + { + print "Err : ".$this->db->error(); + return 0; + } + } + /* + * Class� comme pay�, le don a �t� recu + * + */ + Function set_paye($rowid, $modepaiement='') + { + $sql = "UPDATE llx_don SET fk_statut = 2"; + + if ($modepaiement) + { + $sql .= ", fk_paiement=$modepaiement"; + } + $sql .= " WHERE rowid = $rowid AND fk_statut = 1;"; + + if ( $this->db->query( $sql) ) + { + if ( $this->db->affected_rows() ) + { + return 1; + } + else + { + return 0; + } + } + else + { + print "Err : ".$this->db->error(); + return 0; + } + } + /* + * Class� comme pay�, le don a �t� recu + * + */ + Function set_commentaire($rowid, $commentaire='') + { + $sql = "UPDATE llx_don SET note = '$commentaire'"; + + $sql .= " WHERE rowid = $rowid ;"; + + if ( $this->db->query( $sql) ) + { + if ( $this->db->affected_rows() ) + { + return 1; + } + else + { + return 0; + } + } + else + { + print "Err : ".$this->db->error(); + return 0; + } + } + /* + * Class� comme encaiss� + * + */ + Function set_encaisse($rowid) + { + + $sql = "UPDATE llx_don SET fk_statut = 3 WHERE rowid = $rowid AND fk_statut = 2;"; + + if ( $this->db->query( $sql) ) + { + if ( $this->db->affected_rows() ) + { + return 1; + } + else + { + return 0; + } + } + else + { + print "Err : ".$this->db->error(); + return 0; + } + } + /* + * Somme des dons encaiss�s + */ + Function sum_actual() + { + $sql = "SELECT sum(amount)"; + $sql .= " FROM llx_don"; + $sql .= " WHERE fk_statut = 3"; + + if ( $this->db->query( $sql) ) + { + $row = $this->db->fetch_row(0); + + return $row[0]; + + } + } + /* Paiement recu en attente d'encaissement + * + * + */ + Function sum_pending() + { + $sql = "SELECT sum(amount)"; + $sql .= " FROM llx_don"; + $sql .= " WHERE fk_statut = 2"; + + if ( $this->db->query( $sql) ) + { + $row = $this->db->fetch_row(0); + + return $row[0]; + + } + } + /* + * Somme des promesses de dons valid�es + * + */ + Function sum_intent() + { + $sql = "SELECT sum(amount)"; + $sql .= " FROM llx_don"; + $sql .= " WHERE fk_statut = 1"; + + if ( $this->db->query( $sql) ) + { + $row = $this->db->fetch_row(0); + + return $row[0]; + + } + } +} +?> diff --git a/htdocs/adherents/edit.php b/htdocs/adherents/edit.php index ecb4f7b512732ecc0949a336cdf609e71869960e..7e018b71038f1a695712b6d7ca6921ee304e4f37 100644 --- a/htdocs/adherents/edit.php +++ b/htdocs/adherents/edit.php @@ -19,10 +19,10 @@ * $Source$ * */ -require($GLOBALS["DOCUMENT_ROOT"]."/adherents/pre.inc.php"); -require("../adherent.class.php"); -require("../adherent_type.class.php"); -require($GLOBALS["DOCUMENT_ROOT"]."/adherents/adherent_options.class.php"); +require("./pre.inc.php"); +require(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php"); +require(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php"); +require(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php"); //$db = new Db(); $adho = new AdherentOptions($db); diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index 98dd29f582013dc401d48c80510f42257b6cb261..5dd428bc5c8fa8b7f88cd7a9fc87a6736f0f51f2 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -20,13 +20,13 @@ * $Source$ * */ -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($GLOBALS["DOCUMENT_ROOT"]."/cotisation.class.php"); -require($GLOBALS["DOCUMENT_ROOT"]."/paiement.class.php"); -require($GLOBALS["DOCUMENT_ROOT"]."/adherents/XML-RPC.functions.php"); +require("./pre.inc.php"); +require(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php"); +require(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php"); +require(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php"); +require(DOL_DOCUMENT_ROOT."/adherents/cotisation.class.php"); +require(DOL_DOCUMENT_ROOT."/paiement.class.php"); +require(DOL_DOCUMENT_ROOT."/adherents/XML-RPC.functions.php"); //$db = new Db(); $adho = new AdherentOptions($db); diff --git a/htdocs/adherents/options.php b/htdocs/adherents/options.php index 1b77c70820d223d868f009a03160328ae8f7cebe..30ef0f08d3408c1e1945f0891573923864af9c70 100644 --- a/htdocs/adherents/options.php +++ b/htdocs/adherents/options.php @@ -20,15 +20,9 @@ * $Source$ * */ -require($GLOBALS["DOCUMENT_ROOT"]."/adherents/pre.inc.php"); -//require("../adherent.class.php"); -//require("../adherent_type.class.php"); -require($GLOBALS["DOCUMENT_ROOT"]."/adherents/adherent_options.class.php"); -//require("../cotisation.class.php"); -//require("../paiement.class.php"); +require("./pre.inc.php"); +require(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php"); - -//$db = new Db(); $adho = new AdherentOptions($db); $form = new Form($db); diff --git a/htdocs/adherents/pre.inc.php b/htdocs/adherents/pre.inc.php index 48a5c7f22a98ce97f62d165d885ba3020dbf6b6d..fbe996ca85aa03ef452ca912e688f882f1a0e683 100644 --- a/htdocs/adherents/pre.inc.php +++ b/htdocs/adherents/pre.inc.php @@ -19,7 +19,7 @@ * $Source$ * */ -require($GLOBALS["DOCUMENT_ROOT"]."/main.inc.php3"); +require("../main.inc.php3"); function llxHeader($head = "") { global $user, $conf; diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index adfff60a6c0cd0f4a430c5cda7b7627f96ef96b6..f1a8896c2cc127bc1e11383727a1f3ed66e4d4f8 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -21,14 +21,8 @@ * */ require("./pre.inc.php"); -require($GLOBALS["DOCUMENT_ROOT"]."/adherent.class.php"); -require($GLOBALS["DOCUMENT_ROOT"]."/adherent_type.class.php"); -//require($GLOBALS["DOCUMENT_ROOT"]."/cotisation.class.php"); -//require($GLOBALS["DOCUMENT_ROOT"]."/paiement.class.php"); - - -//$db = new Db(); - +require(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php"); +require(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php"); if ($HTTP_POST_VARS["action"] == 'add' && $user->admin) {