2002-12-28 19:12:22 +01:00
< ? PHP
2003-01-15 01:03:47 +01:00
/* Copyright ( C ) 2001 - 2003 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
* Copyright ( C ) 2002 - 2003 Jean - Louis Bergamo < jlb @ j1b . org >
*
2002-12-28 19:12:22 +01:00
* 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 $
*
*/
2003-09-01 00:05:54 +02:00
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 " );
2003-09-05 16:11:38 +02:00
//require(DOL_DOCUMENT_ROOT."/adherents/cotisation.class.php");
//require(DOL_DOCUMENT_ROOT."/paiement.class.php");
2003-09-01 00:05:54 +02:00
require ( DOL_DOCUMENT_ROOT . " /adherents/XML-RPC.functions.php " );
2003-09-05 16:11:38 +02:00
require ( DOL_DOCUMENT_ROOT . " /compta/bank/account.class.php " );
2002-12-28 19:12:22 +01:00
2003-02-19 18:47:22 +01:00
$adho = new AdherentOptions ( $db );
2003-03-05 18:22:02 +01:00
$errmsg = '' ;
2002-12-28 19:12:22 +01:00
2003-09-05 12:00:07 +02:00
if ( isset ( $action ) && $action == 'sendinfo' )
2003-09-03 17:21:06 +02:00
{
$adh = new Adherent ( $db );
$adh -> id = $rowid ;
$adh -> fetch ( $rowid );
$adh -> send_an_email ( $adh -> email , " Voici le contenu de votre fiche \n \n %INFOS% \n \n " , " Contenu de votre fiche adherent " );
}
2002-12-30 16:13:28 +01:00
if ( $HTTP_POST_VARS [ " action " ] == 'cotisation' )
2002-12-28 19:12:22 +01:00
{
2002-12-30 16:13:28 +01:00
$adh = new Adherent ( $db );
$adh -> id = $rowid ;
2003-05-05 13:14:48 +02:00
$adh -> fetch ( $rowid );
2002-12-28 19:12:22 +01:00
2004-02-25 18:28:08 +01:00
if ( $cotisation >= 0 )
2002-12-30 16:13:28 +01:00
{
2003-08-29 18:03:34 +02:00
// rajout du nouveau cotisant dans les listes qui vont bien
2003-09-01 01:03:13 +02:00
// if (defined("ADHERENT_MAILMAN_LISTS_COTISANT") && ADHERENT_MAILMAN_LISTS_COTISANT!='' && $adh->datefin == "0000-00-00 00:00:00"){
if ( defined ( " ADHERENT_MAILMAN_LISTS_COTISANT " ) && ADHERENT_MAILMAN_LISTS_COTISANT != '' && $adh -> datefin == 0 ){
$adh -> add_to_mailman ( ADHERENT_MAILMAN_LISTS_COTISANT );
2003-08-29 18:03:34 +02:00
}
2003-09-05 16:11:38 +02:00
$crowid = $adh -> cotisation ( mktime ( 12 , 0 , 0 , $remonth , $reday , $reyear ), $cotisation );
2003-09-01 01:03:13 +02:00
if ( defined ( " ADHERENT_MAIL_COTIS " ) && defined ( " ADHERENT_MAIL_COTIS_SUBJECT " )){
$adh -> send_an_email ( $adh -> email , ADHERENT_MAIL_COTIS , ADHERENT_MAIL_COTIS_SUBJECT );
2003-05-05 13:14:48 +02:00
}
2003-09-05 16:11:38 +02:00
// insertion dans la gestion banquaire si configure pour
if ( defined ( " ADHERENT_BANK_USE " ) && ADHERENT_BANK_USE != 0 &&
defined ( " ADHERENT_BANK_USE_AUTO " ) && ADHERENT_BANK_USE_AUTO != 0 ){
$dateop = strftime ( " %Y%m%d " , time ());
//$dateop="$reyear$remonth$reday";
$amount = $cotisation ;
$acct = new Account ( $db , ADHERENT_BANK_ACCOUNT );
$insertid = $acct -> addline ( $dateop , $HTTP_POST_VARS [ " operation " ], $HTTP_POST_VARS [ " label " ], $amount , $HTTP_POST_VARS [ " num_chq " ], ADHERENT_BANK_CATEGORIE );
if ( $insertid == '' )
{
print " <p> Probleme d'insertion : " . $db -> error ();
}
else
{
// met a jour la table cotisation
2004-02-01 01:42:23 +01:00
$sql = " UPDATE " . MAIN_DB_PREFIX . " cotisation SET fk_bank= $insertid WHERE rowid= $crowid " ;
2003-09-05 16:11:38 +02:00
$result = $db -> query ( $sql );
if ( $result )
{
//Header("Location: $PHP_SELF");
}
else
{
print " <p> Probleme d'insertion $sql : " . $db -> error ();
}
}
}
2002-12-28 19:12:22 +01:00
}
$action = " edit " ;
}
2002-12-30 16:13:28 +01:00
if ( $HTTP_POST_VARS [ " action " ] == 'add' )
2002-12-28 19:12:22 +01:00
{
2003-09-18 16:25:05 +02:00
$login = $_POST [ " login " ];
2003-09-01 01:22:57 +02:00
// test si le login existe deja
if ( ! isset ( $login ) || $login == '' ){
$error += 1 ;
$errmsg .= " Login vide. Veuillez en positionner un<BR> \n " ;
}
2004-02-01 01:42:23 +01:00
$sql = " SELECT login FROM " . MAIN_DB_PREFIX . " adherent WHERE login=' $login '; " ;
2003-09-01 01:22:57 +02:00
$result = $db -> query ( $sql );
if ( $result ) {
$num = $db -> num_rows ();
}
if ( ! isset ( $nom ) || ! isset ( $prenom ) || $prenom == '' || $nom == '' ){
$error += 1 ;
$errmsg .= " Nom et Prenom obligatoires<BR> \n " ;
}
if ( ! isset ( $email ) || $email == '' || ! ereg ( '@' , $email )){
$error += 1 ;
$errmsg .= " Adresse Email invalide<BR> \n " ;
}
if ( $num != 0 ){
$error += 1 ;
$errmsg .= " Login deja utilise. Veuillez en changer<BR> \n " ;
}
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 )){
$error += 1 ;
$errmsg .= " Date de naissance invalide (Format AAAA-MM-JJ)<BR> \n " ;
2003-02-13 19:14:57 +01:00
}
}
2003-09-01 01:22:57 +02:00
if ( isset ( $public )){
$public = 1 ;
} else {
$public = 0 ;
}
if ( ! $error ){
// email a peu pres correct et le login n'existe pas
$adh = new Adherent ( $db );
$adh -> statut = - 1 ;
$adh -> prenom = $prenom ;
$adh -> nom = $nom ;
$adh -> societe = $societe ;
$adh -> adresse = $adresse ;
$adh -> cp = $cp ;
$adh -> ville = $ville ;
$adh -> email = $email ;
$adh -> login = $login ;
$adh -> pass = $pass ;
$adh -> naiss = $naiss ;
$adh -> photo = $photo ;
$adh -> note = $note ;
$adh -> pays = $pays ;
$adh -> typeid = $type ;
$adh -> commentaire = $HTTP_POST_VARS [ " comment " ];
$adh -> morphy = $HTTP_POST_VARS [ " morphy " ];
foreach ( $_POST as $key => $value ){
if ( ereg ( " ^options_ " , $key )){
$adh -> array_options [ $key ] = $_POST [ $key ];
}
2002-12-28 19:12:22 +01:00
}
2003-09-01 01:22:57 +02:00
if ( $adh -> create ( $user -> id ) )
{
if ( $cotisation > 0 )
{
$adh -> cotisation ( mktime ( 12 , 0 , 0 , $remonth , $reday , $reyear ), $cotisation );
2003-09-05 16:11:38 +02:00
// insertion dans la gestion banquaire si configure pour
if ( defined ( " ADHERENT_BANK_USE " ) && ADHERENT_BANK_USE != 0 &&
defined ( " ADHERENT_BANK_USE_AUTO " ) && ADHERENT_BANK_USE_AUTO != 0 ){
$dateop = strftime ( " %Y%m%d " , time ());
//$dateop="$reyear$remonth$reday";
$amount = $cotisation ;
$acct = new Account ( $db , ADHERENT_BANK_ACCOUNT );
$insertid = $acct -> addline ( $dateop , $HTTP_POST_VARS [ " operation " ], $HTTP_POST_VARS [ " label " ], $amount , $HTTP_POST_VARS [ " num_chq " ], ADHERENT_BANK_CATEGORIE );
if ( $insertid == '' )
{
print " <p> Probleme d'insertion : " . $db -> error ();
}
else
{
// met a jour la table cotisation
2004-02-01 01:42:23 +01:00
$sql = " UPDATE " . MAIN_DB_PREFIX . " cotisation SET fk_bank= $insertid WHERE rowid= $crowid " ;
2003-09-05 16:11:38 +02:00
$result = $db -> query ( $sql );
if ( $result )
{
//Header("Location: $PHP_SELF");
}
else
{
print " <p> Probleme d'insertion $sql : " . $db -> error ();
}
}
}
2003-09-01 01:22:57 +02:00
}
Header ( " Location: liste.php " );
}
}
2002-12-28 19:12:22 +01:00
}
2002-12-30 16:13:28 +01:00
if ( $HTTP_POST_VARS [ " action " ] == 'confirm_delete' && $HTTP_POST_VARS [ " confirm " ] == yes )
2002-12-28 19:12:22 +01:00
{
2002-12-30 16:13:28 +01:00
$adh = new Adherent ( $db );
$adh -> delete ( $rowid );
Header ( " Location: liste.php " );
2002-12-28 19:12:22 +01:00
}
2002-12-30 17:29:21 +01:00
if ( $HTTP_POST_VARS [ " action " ] == 'confirm_valid' && $HTTP_POST_VARS [ " confirm " ] == yes )
{
$adh = new Adherent ( $db , $rowid );
$adh -> validate ( $user -> id );
2003-02-03 12:35:17 +01:00
$adh -> fetch ( $rowid );
2003-03-04 16:23:13 +01:00
$adht = new AdherentType ( $db );
$adht -> fetch ( $adh -> typeid );
if ( isset ( $adht -> mail_valid ) && $adht -> mail_valid != '' )
{
$adh -> send_an_email ( $adh -> email , $adht -> mail_valid , $conf -> adherent -> email_valid_subject );
}
else
{
$adh -> send_an_email ( $adh -> email , $conf -> adherent -> email_valid , $conf -> adherent -> email_valid_subject );
}
2003-03-05 18:22:02 +01:00
// rajoute l'utilisateur dans les divers abonnements ..
2003-03-07 19:53:17 +01:00
if ( ! $adh -> add_to_abo ( $adht ))
2003-03-05 18:22:02 +01:00
{
// error
2003-03-07 19:53:17 +01:00
$errmsg .= " echec du rajout de l'utilisateur aux abonnements: " . $adh -> errostr . " <BR> \n " ;
2003-03-05 18:22:02 +01:00
}
2002-12-30 17:29:21 +01:00
}
2002-12-30 22:07:11 +01:00
if ( $HTTP_POST_VARS [ " action " ] == 'confirm_resign' && $HTTP_POST_VARS [ " confirm " ] == yes )
{
$adh = new Adherent ( $db , $rowid );
$adh -> resiliate ( $user -> id );
2003-02-03 12:35:17 +01:00
$adh -> fetch ( $rowid );
2003-03-04 16:23:13 +01:00
2003-03-07 19:53:17 +01:00
$adht = new AdherentType ( $db );
$adht -> fetch ( $adh -> typeid );
2003-03-04 16:23:13 +01:00
$adh -> send_an_email ( $adh -> email , $conf -> adherent -> email_resil , $conf -> adherent -> email_resil_subject );
2003-03-05 18:22:02 +01:00
// supprime l'utilisateur des divers abonnements ..
2003-03-07 19:53:17 +01:00
if ( ! $adh -> del_to_abo ( $adht ))
2003-03-05 18:22:02 +01:00
{
// error
2003-03-07 19:53:17 +01:00
$errmsg .= " echec de la suppression de l'utilisateur aux abonnements: " . $adh -> errostr . " <BR> \n " ;
2003-03-05 18:22:02 +01:00
}
2002-12-30 22:07:11 +01:00
}
2002-12-28 19:12:22 +01:00
llxHeader ();
2003-03-06 20:33:23 +01:00
if ( $HTTP_POST_VARS [ " action " ] == 'confirm_add_glasnost' && $HTTP_POST_VARS [ " confirm " ] == yes )
{
$adh = new Adherent ( $db , $rowid );
$adh -> fetch ( $rowid );
2003-03-07 19:53:17 +01:00
$adht = new AdherentType ( $db );
$adht -> fetch ( $adh -> typeid );
if ( $adht -> vote == 'yes' ){
define ( " XMLRPC_DEBUG " , 1 );
if ( ! $adh -> add_to_glasnost ()){
$errmsg .= " Echec du rajout de l'utilisateur dans glasnost: " . $adh -> errostr . " <BR> \n " ;
}
if ( defined ( 'MAIN_DEBUG' ) && MAIN_DEBUG == 1 ){
XMLRPC_debug_print ();
}
2003-03-06 20:33:23 +01:00
}
}
if ( $HTTP_POST_VARS [ " action " ] == 'confirm_del_glasnost' && $HTTP_POST_VARS [ " confirm " ] == yes )
{
$adh = new Adherent ( $db , $rowid );
$adh -> fetch ( $rowid );
2003-03-07 19:53:17 +01:00
$adht = new AdherentType ( $db );
$adht -> fetch ( $adh -> typeid );
if ( $adht -> vote == 'yes' ){
define ( " XMLRPC_DEBUG " , 1 );
if ( ! $adh -> del_to_glasnost ()){
$errmsg .= " Echec de la suppression de l'utilisateur dans glasnost: " . $adh -> errostr . " <BR> \n " ;
}
if ( defined ( 'MAIN_DEBUG' ) && MAIN_DEBUG == 1 ){
XMLRPC_debug_print ();
}
2003-03-06 20:33:23 +01:00
}
}
2003-03-07 19:53:17 +01:00
if ( $HTTP_POST_VARS [ " action " ] == 'confirm_del_spip' && $HTTP_POST_VARS [ " confirm " ] == yes )
{
$adh = new Adherent ( $db , $rowid );
$adh -> fetch ( $rowid );
if ( ! $adh -> del_to_spip ()){
$errmsg .= " Echec de la suppression de l'utilisateur dans spip: " . $adh -> errostr . " <BR> \n " ;
}
}
if ( $HTTP_POST_VARS [ " action " ] == 'confirm_add_spip' && $HTTP_POST_VARS [ " confirm " ] == yes )
{
$adh = new Adherent ( $db , $rowid );
$adh -> fetch ( $rowid );
if ( ! $adh -> add_to_spip ()){
$errmsg .= " Echec du rajout de l'utilisateur dans spip: " . $adh -> errostr . " <BR> \n " ;
}
}
2002-12-28 19:12:22 +01:00
/* ************************************************************************** */
/* */
2002-12-30 16:13:28 +01:00
/* Cr<43> ation d'une fiche */
2002-12-28 19:12:22 +01:00
/* */
/* ************************************************************************** */
2003-08-12 19:36:17 +02:00
if ( $errmsg != '' )
{
2003-03-05 18:22:02 +01:00
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">' ;
print '<th>Erreur dans l\'execution du formulaire</th>' ;
print " <tr><td class= \" delete \" ><b> $errmsg </b></td></tr> \n " ;
print '</table>' ;
}
2002-12-28 19:12:22 +01:00
2003-02-19 18:47:22 +01:00
// fetch optionals attributes and labels
$adho -> fetch_optionals ();
2002-12-28 19:12:22 +01:00
if ( $action == 'create' ) {
2002-12-30 16:13:28 +01:00
print_titre ( " Nouvel adh<64> rent " );
2003-01-10 16:18:06 +01:00
print " <form action= \" $PHP_SELF\ " method = \ " post \" > \n " ;
2003-01-10 16:26:02 +01:00
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">' ;
2002-12-28 19:12:22 +01:00
2003-01-10 16:26:02 +01:00
print '<input type="hidden" name="action" value="add">' ;
2002-12-28 19:12:22 +01:00
2002-12-30 16:13:28 +01:00
$htmls = new Form ( $db );
$adht = new AdherentType ( $db );
2002-12-28 19:12:22 +01:00
2002-12-31 04:51:00 +01:00
print '<tr><td width="15%">Type</td><td width="35%">' ;
2002-12-30 16:13:28 +01:00
$htmls -> select_array ( " type " , $adht -> liste_array ());
2003-01-10 16:18:06 +01:00
print " </td> \n " ;
2002-12-31 04:51:00 +01:00
2003-01-10 16:26:02 +01:00
print '<td width="50%" valign="top">Commentaires :</td></tr>' ;
2002-12-28 19:12:22 +01:00
2002-12-30 17:29:21 +01:00
$morphys [ " phy " ] = " Physique " ;
$morphys [ " mor " ] = " Morale " ;
2003-01-10 16:18:06 +01:00
print " <tr><td>Personne</td><td> \n " ;
2002-12-30 17:29:21 +01:00
$htmls -> select_array ( " morphy " , $morphys );
2003-01-10 16:18:06 +01:00
print " </td> \n " ;
2002-12-31 04:51:00 +01:00
2003-01-22 18:51:49 +01:00
print '<td valign="top" rowspan="13"><textarea name="comment" wrap="soft" cols="40" rows="25"></textarea></td></tr>' ;
2002-12-30 17:29:21 +01:00
2003-01-10 16:26:02 +01:00
print '<tr><td>Pr<50> nom</td><td><input type="text" name="prenom" size="40"></td></tr>' ;
2002-12-28 19:12:22 +01:00
2002-12-31 04:51:00 +01:00
2002-12-28 19:12:22 +01:00
2003-01-10 16:26:02 +01:00
print '<tr><td>Nom</td><td><input type="text" name="nom" size="40"></td></tr>' ;
print '<tr><td>Societe</td><td><input type="text" name="societe" size="40"></td></tr>' ;
print '<tr><td>Adresse</td><td>' ;
print '<textarea name="adresse" wrap="soft" cols="40" rows="3"></textarea></td></tr>' ;
print '<tr><td>CP Ville</td><td><input type="text" name="cp" size="8"> <input type="text" name="ville" size="40"></td></tr>' ;
print '<tr><td>Pays</td><td><input type="text" name="pays" size="40"></td></tr>' ;
2002-12-28 19:12:22 +01:00
print '<tr><td>Email</td><td><input type="text" name="email" size="40"></td></tr>' ;
2003-01-13 18:01:30 +01:00
print '<tr><td>Login</td><td><input type="text" name="login" size="40"></td></tr>' ;
2003-09-03 16:48:34 +02:00
print '<tr><td>Password</td><td><input type="password" name="pass" size="40"></td></tr>' ;
2003-01-22 18:51:49 +01:00
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>Url photo</td><td><input type="text" name="photo" size="40"></td></tr>' ;
2003-02-19 18:47:22 +01:00
foreach ( $adho -> attribute_label as $key => $value ){
print " <tr><td> $value </td><td><input type= \" text \" name= \" options_ $key\ " size = \ " 40 \" ></td></tr> \n " ;
2003-02-10 18:36:55 +01:00
}
2002-12-30 16:13:28 +01:00
2003-01-10 16:18:06 +01:00
print " <tr><td>Date de cotisation</td><td> \n " ;
2002-12-30 16:13:28 +01:00
print_date_select ();
2003-01-10 16:18:06 +01:00
print " </td></tr> \n " ;
2002-12-30 16:13:28 +01:00
print " <tr><td>Mode de paiement</td><td> \n " ;
2003-09-05 16:11:38 +02:00
print '<select name="operation">' ;
print '<option value="CHQ" SELECTED>Ch<43> que' ;
print '<option value="CB">Carte Bleue' ;
print '<option value="DEP">Espece' ;
print '<option value="TIP">TIP' ;
print '<option value="PRE">PRE' ;
print '<option value="VIR">Virement' ;
print '</select>' ;
// $paiement = new Paiement($db);
// $paiement->select("modepaiement","cr<63> dit");
2002-12-30 16:13:28 +01:00
print " </td></tr> \n " ;
2003-09-05 16:11:38 +02:00
if ( defined ( " ADHERENT_BANK_USE " ) && ADHERENT_BANK_USE != 0 &&
defined ( " ADHERENT_BANK_USE_AUTO " ) && ADHERENT_BANK_USE_AUTO != 0 ){
print " <tr><td>Numero de cheque</td><td> \n " ;
print '<input name="num_chq" type="text" size="6">' ;
print " </td></tr> \n " ;
}
2003-01-10 16:26:02 +01:00
print '<tr><td>Cotisation</td><td><input type="text" name="cotisation" size="6"> euros</td></tr>' ;
2003-09-05 16:11:38 +02:00
if ( defined ( " ADHERENT_BANK_USE " ) && ADHERENT_BANK_USE != 0 &&
defined ( " ADHERENT_BANK_USE_AUTO " ) && ADHERENT_BANK_USE_AUTO != 0 ){
print '<tr><td>Libelle</td><td><input name="label" type="text" size=20 value="Cotisation " ></td></tr>' ;
}
2003-01-10 16:26:02 +01:00
print '<tr><td colspan="2" align="center"><input type="submit" value="Enregistrer"></td></tr>' ;
2002-12-28 19:12:22 +01:00
print " </form> \n " ;
print " </table> \n " ;
}
/* ************************************************************************** */
/* */
2002-12-30 16:13:28 +01:00
/* Edition de la fiche */
2002-12-28 19:12:22 +01:00
/* */
/* ************************************************************************** */
2002-12-30 16:13:28 +01:00
if ( $rowid > 0 )
2002-12-28 19:12:22 +01:00
{
2002-12-30 16:13:28 +01:00
$adh = new Adherent ( $db );
$adh -> id = $rowid ;
$adh -> fetch ( $rowid );
2003-02-10 18:36:55 +01:00
$adh -> fetch_optionals ( $rowid );
2003-02-19 18:47:22 +01:00
//$myattr=$adh->fetch_name_optionals();
2003-03-07 19:53:17 +01:00
$adht = new AdherentType ( $db );
$adht -> fetch ( $adh -> typeid );
2002-12-28 19:12:22 +01:00
2002-12-30 16:13:28 +01:00
print_titre ( " Edition de la fiche adh<64> rent " );
2002-12-28 19:12:22 +01:00
2003-01-10 16:18:06 +01:00
/*
* Confirmation de la suppression de l ' adh<EFBFBD> rent
*
*/
if ( $action == 'delete' )
{
2003-01-10 16:26:02 +01:00
print '<form method="post" action="' . $PHP_SELF . '?rowid=' . $rowid . '">' ;
print '<input type="hidden" name="action" value="confirm_delete">' ;
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">' ;
2003-01-10 16:18:06 +01:00
2003-01-10 16:26:02 +01:00
print '<tr><td colspan="3">Supprimer un adh<64> rent</td></tr>' ;
2003-01-10 16:18:06 +01:00
print " <tr><td colspan= \" 3 \" >La suppression d'un adh<64> rent entraine la suppression de toutes ses cotisations !!!</td></tr> \n " ;
print '<tr><td class="delete">Etes-vous sur de vouloir supprimer cet adh<64> rent ?</td><td class="delete">' ;
$htmls = new Form ( $db );
$htmls -> selectyesno ( " confirm " , " no " );
print " </td> \n " ;
2003-01-10 16:26:02 +01:00
print '<td class="delete" align="center"><input type="submit" value="Confirmer"</td></tr>' ;
print '</table>' ;
2003-01-10 16:18:06 +01:00
print " </form> \n " ;
}
/*
* Confirmation de la validation
*
*/
if ( $action == 'valid' )
{
2003-01-10 16:26:02 +01:00
print '<form method="post" action="' . $PHP_SELF . '?rowid=' . $rowid . '">' ;
print '<input type="hidden" name="action" value="confirm_valid">' ;
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">' ;
2003-01-10 16:18:06 +01:00
2003-01-10 16:26:02 +01:00
print '<tr><td colspan="3">Valider un adh<64> rent</td></tr>' ;
2003-01-10 16:18:06 +01:00
print '<tr><td class="valid">Etes-vous sur de vouloir valider cet adh<64> rent ?</td><td class="valid">' ;
$htmls = new Form ( $db );
$htmls -> selectyesno ( " confirm " , " no " );
print " </td> \n " ;
2003-01-10 16:26:02 +01:00
print '<td class="valid" align="center"><input type="submit" value="Confirmer"</td></tr>' ;
print '</table>' ;
2003-01-10 16:18:06 +01:00
print " </form> \n " ;
}
/*
* Confirmation de la R<EFBFBD> siliation
*
*/
if ( $action == 'resign' )
{
2003-01-10 16:26:02 +01:00
print '<form method="post" action="' . $PHP_SELF . '?rowid=' . $rowid . '">' ;
print '<input type="hidden" name="action" value="confirm_resign">' ;
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">' ;
2003-01-10 16:18:06 +01:00
2003-01-10 16:26:02 +01:00
print '<tr><td colspan="3">R<> silier une adh<64> sion</td></tr>' ;
2003-01-10 16:18:06 +01:00
print '<tr><td class="delete">Etes-vous sur de vouloir r<> silier cette adh<64> sion ?</td><td class="delete">' ;
$htmls = new Form ( $db );
$htmls -> selectyesno ( " confirm " , " no " );
print " </td> \n " ;
2003-01-10 16:26:02 +01:00
print '<td class="delete" align="center"><input type="submit" value="Confirmer"</td></tr>' ;
print '</table>' ;
2003-01-10 16:18:06 +01:00
print " </form> \n " ;
}
2003-03-06 20:33:23 +01:00
/*
* Confirmation de l ' ajout dans glasnost
*
*/
if ( $action == 'add_glasnost' )
{
print '<form method="post" action="' . $PHP_SELF . '?rowid=' . $rowid . '">' ;
print '<input type="hidden" name="action" value="confirm_add_glasnost">' ;
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">' ;
print '<tr><td colspan="3">Valider un adh<64> rent</td></tr>' ;
2003-09-01 01:03:13 +02:00
print '<tr><td class="valid">Etes-vous sur de vouloir ajouter cet adh<64> rent dans glasnost ? (serveur : ' . ADHERENT_GLASNOST_SERVEUR . ')</td><td class="valid">' ;
2003-03-06 20:33:23 +01:00
$htmls = new Form ( $db );
$htmls -> selectyesno ( " confirm " , " no " );
print " </td> \n " ;
print '<td class="valid" align="center"><input type="submit" value="Confirmer"</td></tr>' ;
print '</table>' ;
print " </form> \n " ;
}
/*
* Confirmation de la suppression dans glasnost
*
*/
if ( $action == 'del_glasnost' )
{
print '<form method="post" action="' . $PHP_SELF . '?rowid=' . $rowid . '">' ;
print '<input type="hidden" name="action" value="confirm_del_glasnost">' ;
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">' ;
print '<tr><td colspan="3">Valider un adh<64> rent</td></tr>' ;
2003-09-01 01:03:13 +02:00
print '<tr><td class="delete">Etes-vous sur de vouloir effacer cet adh<64> rent de glasnost ? (serveur : ' . ADHERENT_GLASNOST_SERVEUR . ')</td><td class="delete">' ;
2003-03-07 19:53:17 +01:00
$htmls = new Form ( $db );
$htmls -> selectyesno ( " confirm " , " no " );
print " </td> \n " ;
print '<td class="delete" align="center"><input type="submit" value="Confirmer"</td></tr>' ;
print '</table>' ;
print " </form> \n " ;
}
/*
* Confirmation de l ' ajout dans spip
*
*/
if ( $action == 'add_spip' )
{
print '<form method="post" action="' . $PHP_SELF . '?rowid=' . $rowid . '">' ;
print '<input type="hidden" name="action" value="confirm_add_spip">' ;
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">' ;
print '<tr><td colspan="3">Valider un adh<64> rent</td></tr>' ;
2003-09-01 01:03:13 +02:00
print '<tr><td class="valid">Etes-vous sur de vouloir ajouter cet adh<64> rent dans spip ? (serveur : ' . ADHERENT_SPIP_SERVEUR . ')</td><td class="valid">' ;
2003-03-07 19:53:17 +01:00
$htmls = new Form ( $db );
$htmls -> selectyesno ( " confirm " , " no " );
print " </td> \n " ;
print '<td class="valid" align="center"><input type="submit" value="Confirmer"</td></tr>' ;
print '</table>' ;
print " </form> \n " ;
}
/*
* Confirmation de la suppression dans spip
*
*/
if ( $action == 'del_spip' )
{
print '<form method="post" action="' . $PHP_SELF . '?rowid=' . $rowid . '">' ;
print '<input type="hidden" name="action" value="confirm_del_spip">' ;
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">' ;
print '<tr><td colspan="3">Valider un adh<64> rent</td></tr>' ;
2003-09-01 01:03:13 +02:00
print '<tr><td class="delete">Etes-vous sur de vouloir effacer cet adh<64> rent de glasnost ? (serveur : ' . ADHERENT_SPIP_SERVEUR . ')</td><td class="delete">' ;
2003-03-06 20:33:23 +01:00
$htmls = new Form ( $db );
$htmls -> selectyesno ( " confirm " , " no " );
print " </td> \n " ;
print '<td class="delete" align="center"><input type="submit" value="Confirmer"</td></tr>' ;
print '</table>' ;
print " </form> \n " ;
}
2002-12-28 19:12:22 +01:00
2003-01-10 16:18:06 +01:00
print " <form action= \" $PHP_SELF\ " method = \ " post \" > \n " ;
2003-01-10 16:26:02 +01:00
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">' ;
2002-12-30 17:29:21 +01:00
2003-03-07 19:53:17 +01:00
print '<tr><td>Numero</td><td class="valeur">' . $adh -> id . ' </td>' ;
2003-01-10 16:26:02 +01:00
print '<td valign="top" width="50%">Commentaires</tr>' ;
2002-12-28 19:12:22 +01:00
2003-03-07 19:53:17 +01:00
print " <tr><td>Type</td><td class= \" valeur \" > $adh->type </td> \n " ;
2002-12-30 17:29:21 +01:00
2003-01-22 18:51:49 +01:00
print '<td rowspan="13" valign="top" width="50%">' ;
2003-01-10 16:26:02 +01:00
print nl2br ( $adh -> commentaire ) . ' </td></tr>' ;
2003-01-10 16:18:06 +01:00
2003-03-07 19:53:17 +01:00
print '<tr><td>Personne</td><td class="valeur">' . $adh -> morphy . ' </td></tr>' ;
2003-01-10 16:26:02 +01:00
print '<tr><td width="15%">Pr<50> nom</td><td class="valeur" width="35%">' . $adh -> prenom . ' </td></tr>' ;
2003-01-10 16:18:06 +01:00
2003-03-07 19:53:17 +01:00
print '<tr><td>Nom</td><td class="valeur">' . $adh -> nom . ' </td></tr>' ;
2002-12-30 17:29:21 +01:00
2003-01-10 16:26:02 +01:00
print '<tr><td>Soci<63> t<EFBFBD> </td><td class="valeur">' . $adh -> societe . ' </td></tr>' ;
print '<tr><td>Adresse</td><td class="valeur">' . nl2br ( $adh -> adresse ) . ' </td></tr>' ;
print '<tr><td>CP Ville</td><td class="valeur">' . $adh -> cp . ' ' . $adh -> ville . ' </td></tr>' ;
print '<tr><td>Pays</td><td class="valeur">' . $adh -> pays . ' </td></tr>' ;
print '<tr><td>Email</td><td class="valeur">' . $adh -> email . ' </td></tr>' ;
2003-01-13 18:01:30 +01:00
print '<tr><td>Login</td><td class="valeur">' . $adh -> login . ' </td></tr>' ;
2003-09-03 16:48:34 +02:00
// print '<tr><td>Pass</td><td class="valeur">'.$adh->pass.' </td></tr>';
2003-01-22 18:51:49 +01:00
print '<tr><td>Date de Naissance</td><td class="valeur">' . $adh -> naiss . ' </td></tr>' ;
print '<tr><td>URL Photo</td><td class="valeur">' . $adh -> photo . ' </td></tr>' ;
2003-01-28 18:34:15 +01:00
print '<tr><td>Public ?</td><td class="valeur">' ;
if ( $adh -> public == 1 ){
print 'Yes' ;
} else {
print " No " ;
}
print ' </td></tr>' ;
2002-12-28 19:12:22 +01:00
2003-02-10 18:36:55 +01:00
// print "</table>\n";
2002-12-28 19:12:22 +01:00
2003-02-10 18:36:55 +01:00
// print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
// print '<tr><td colspan="2">Champs optionnels</td></tr>';
2003-02-19 18:47:22 +01:00
foreach ( $adho -> attribute_label as $key => $value ){
print " <tr><td> $value </td><td> " . $adh -> array_options [ " options_ $key " ] . " </td></tr> \n " ;
2003-02-10 18:36:55 +01:00
}
print " </table> \n " ;
2002-12-28 19:12:22 +01:00
2002-12-30 16:13:28 +01:00
if ( $user -> admin )
{
2003-03-06 20:33:23 +01:00
print " <p><TABLE border= \" 1 \" width= \" 100% \" cellspacing= \" 0 \" cellpadding= \" 4 \" ><tr class= \" barreBouton \" > \n " ;
2002-12-30 16:13:28 +01:00
/*
* Case 1
*/
2003-06-05 15:05:44 +02:00
print '<td align="center" width="25%" class="bouton">[<a href="edit.php?rowid=' . $adh -> id . '">Editer</a>]</td>' ;
2002-12-30 16:13:28 +01:00
/*
* Case 2
*/
2002-12-30 22:07:11 +01:00
if ( $adh -> statut < 1 )
2002-12-30 16:13:28 +01:00
{
2003-03-07 19:53:17 +01:00
print " <td align= \" center \" width= \" 25% \" class= \" bouton \" >[<a href= \" $PHP_SELF ?rowid= $rowid &action=valid \" >Valider l'adh<64> sion</a>]</td> \n " ;
2002-12-30 16:13:28 +01:00
}
else
{
2003-03-07 19:53:17 +01:00
print " <td align= \" center \" width= \" 25% \" class= \" bouton \" >-</td> \n " ;
2002-12-30 16:13:28 +01:00
}
/*
* Case 3
*/
2002-12-30 22:07:11 +01:00
if ( $adh -> statut == 1 )
{
2003-03-07 19:53:17 +01:00
print " <td align= \" center \" width= \" 25% \" class= \" bouton \" >[<a href= \" $PHP_SELF ?rowid= $rowid &action=resign \" >R<> silier l'adh<64> sion</a>]</td> \n " ;
2002-12-30 22:07:11 +01:00
}
else
{
2003-03-07 19:53:17 +01:00
print " <td align= \" center \" width= \" 25% \" class= \" bouton \" >-</td> \n " ;
2002-12-30 22:07:11 +01:00
}
2002-12-30 16:13:28 +01:00
/*
* Case 4
*/
2002-12-30 17:29:21 +01:00
2003-03-07 19:53:17 +01:00
print " <td align= \" center \" width= \" 25% \" class= \" bouton \" >[<a href= \" $PHP_SELF ?rowid= $adh->id &action=delete \" >Supprimer</a>]</td> \n " ;
print " </tr><tr class= \" barreBouton \" > \n " ;
2003-03-06 20:33:23 +01:00
2003-09-03 17:21:06 +02:00
/*
* bouton : " Envoie des informations "
*/
print " <td align= \" center \" width= \" 25% \" class= \" bouton \" colspan= \" 4 \" >[<a href= \" $PHP_SELF ?rowid= $adh->id &action=sendinfo \" >Envoyer sa fiche a l'adh<64> rent</a>]</td> \n " ;
print " </tr><tr class= \" barreBouton \" > \n " ;
2003-09-01 01:03:13 +02:00
if ( $adht -> vote == 'yes' && defined ( " ADHERENT_USE_GLASNOST " ) && ADHERENT_USE_GLASNOST == 1 ){
2003-03-06 20:33:23 +01:00
define ( " XMLRPC_DEBUG " , 1 );
2003-06-03 17:13:56 +02:00
2003-03-06 20:33:23 +01:00
/*
2003-06-03 17:13:56 +02:00
* Case 1 & 2
2003-03-06 20:33:23 +01:00
*/
2003-06-05 15:05:44 +02:00
/* retrait car bug inexplicable pour l ' instant
2003-06-03 17:13:56 +02:00
if ( $adh -> is_in_glasnost () == 1 ){
print " <td align= \" center \" width= \" 25% \" class= \" bouton \" >-</td> \n " ;
print " <td align= \" center \" width= \" 25% \" class= \" bouton \" >[<a href= \" $PHP_SELF ?rowid= $adh->id &action=del_glasnost \" >Suppression dans Glasnost</a>]</td> \n " ;
} else {
print " <td align= \" center \" width= \" 25% \" class= \" bouton \" >[<a href= \" $PHP_SELF ?rowid= $adh->id &action=add_glasnost \" >Ajout dans Glasnost</a>]</td> \n " ;
print " <td align= \" center \" width= \" 25% \" class= \" bouton \" >-</td> \n " ;
}
2003-06-05 15:05:44 +02:00
*/
print " <td align= \" center \" width= \" 25% \" class= \" bouton \" >[<a href= \" $PHP_SELF ?rowid= $adh->id &action=add_glasnost \" >Ajout dans Glasnost</a>]</td> \n " ;
print " <td align= \" center \" width= \" 25% \" class= \" bouton \" >[<a href= \" $PHP_SELF ?rowid= $adh->id &action=del_glasnost \" >Suppression dans Glasnost</a>]</td> \n " ;
2003-03-07 19:53:17 +01:00
} else {
/*
* Case 1
*/
print " <td align= \" center \" width= \" 25% \" class= \" bouton \" >-</td> \n " ;
/*
* Case 2
*/
print " <td align= \" center \" width= \" 25% \" class= \" bouton \" >-</td> \n " ;
2003-03-06 20:33:23 +01:00
}
2003-09-01 01:03:13 +02:00
if ( defined ( " ADHERENT_USE_SPIP " ) && ADHERENT_USE_SPIP == 1 ){
2003-03-07 19:53:17 +01:00
/*
2003-06-03 17:13:56 +02:00
* Case 3 & 4
2003-03-07 19:53:17 +01:00
*/
2003-06-03 17:13:56 +02:00
if ( $adh -> is_in_spip () == 1 ){
print " <td align= \" center \" width= \" 20% \" class= \" bouton \" >-</td> \n " ;
print " <td align= \" center \" width= \" 20% \" class= \" bouton \" >[<a href= \" $PHP_SELF ?rowid= $adh->id &action=del_spip \" >Suppression dans Spip</a>]</td> \n " ;
} else {
print " <td align= \" center \" width= \" 20% \" class= \" bouton \" >[<a href= \" $PHP_SELF ?rowid= $adh->id &action=add_spip \" >Ajout dans Spip</a>]</td> \n " ;
print " <td align= \" center \" width= \" 20% \" class= \" bouton \" >-</td> \n " ;
}
2003-03-07 19:53:17 +01:00
} else {
/*
* Case 3
*/
print " <td align= \" center \" width= \" 25% \" class= \" bouton \" >-</td> \n " ;
2002-12-30 17:29:21 +01:00
2003-03-07 19:53:17 +01:00
/*
* Case 4
*/
print " <td align= \" center \" width= \" 25% \" class= \" bouton \" >-</td> \n " ;
}
2002-12-28 19:12:22 +01:00
2003-01-10 16:18:06 +01:00
print " </tr></table></form><p> \n " ;
2002-12-30 16:13:28 +01:00
}
2002-12-28 19:12:22 +01:00
2003-01-15 01:03:47 +01:00
/*
* Cotisations
*
*
*/
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">' ;
print '<tr>' ;
2003-09-05 16:11:38 +02:00
if ( defined ( " ADHERENT_BANK_USE " ) && ADHERENT_BANK_USE != 0 &&
defined ( " ADHERENT_BANK_USE_AUTO " ) && ADHERENT_BANK_USE_AUTO != 0 ){
print '<td rowspan="8" valign="top">' ;
} else {
print '<td rowspan="6" valign="top">' ;
}
2003-01-15 01:03:47 +01:00
2002-12-28 19:12:22 +01:00
/*
2002-12-30 16:13:28 +01:00
*
2002-12-30 22:07:11 +01:00
* Liste des cotisations
2002-12-30 16:13:28 +01:00
*
2002-12-28 19:12:22 +01:00
*/
2002-12-30 16:13:28 +01:00
$sql = " SELECT d.rowid, d.prenom, d.nom, d.societe, c.cotisation, " . $db -> pdate ( " c.dateadh " ) . " as dateadh " ;
2004-02-01 01:42:23 +01:00
$sql .= " FROM " . MAIN_DB_PREFIX . " adherent as d, " . MAIN_DB_PREFIX . " cotisation as c " ;
2002-12-30 16:13:28 +01:00
$sql .= " WHERE d.rowid = c.fk_adherent AND d.rowid= $rowid " ;
2002-12-28 19:12:22 +01:00
2002-12-30 16:13:28 +01:00
$result = $db -> query ( $sql );
if ( $result )
2002-12-28 19:12:22 +01:00
{
2002-12-30 16:13:28 +01:00
$num = $db -> num_rows ();
$i = 0 ;
2003-01-10 16:18:06 +01:00
print " <TABLE border= \" 0 \" cellspacing= \" 0 \" cellpadding= \" 4 \" > \n " ;
2002-12-30 16:13:28 +01:00
2003-01-10 16:26:02 +01:00
print '<TR class="liste_titre">' ;
2003-01-10 16:18:06 +01:00
print " <td>Cotisations</td> \n " ;
print " <td>Date</td> \n " ;
print " <td align= \" right \" >Montant</TD> \n " ;
2002-12-30 16:13:28 +01:00
print " </TR> \n " ;
$var = True ;
while ( $i < $num )
{
$objp = $db -> fetch_object ( $i );
$var =! $var ;
print " <TR $bc[$var] ><td> </td> " ;
print " <TD> " . strftime ( " %d %B %Y " , $objp -> dateadh ) . " </td> \n " ;
print '<TD align="right">' . price ( $objp -> cotisation ) . '</TD>' ;
print " </tr> " ;
$i ++ ;
}
print " </table> " ;
2002-12-28 19:12:22 +01:00
}
else
{
2002-12-30 16:13:28 +01:00
print $sql ;
print $db -> error ();
2002-12-28 19:12:22 +01:00
}
2002-12-30 16:13:28 +01:00
2003-01-15 01:03:47 +01:00
print '</td>' ;
2002-12-28 19:12:22 +01:00
/*
2002-12-30 22:07:11 +01:00
* Ajout d ' une nouvelle cotis
2002-12-30 16:13:28 +01:00
*
*
2002-12-28 19:12:22 +01:00
*/
2002-12-30 22:07:11 +01:00
if ( $user -> admin )
2002-12-30 17:29:21 +01:00
{
2003-01-10 16:26:02 +01:00
print '<form method="post" action="' . $PHP_SELF . '?rowid=' . $rowid . '&action=edit">' ;
print '<input type="hidden" name="action" value="cotisation">' ;
2003-01-03 00:52:24 +01:00
2003-01-10 16:26:02 +01:00
print '<td width="15%">Fin adh<64> sion</td>' ;
2003-01-03 00:52:24 +01:00
if ( $adh -> datefin < time ())
{
print '<td width="35%" class="delete">' ;
}
else
{
print '<td width="35%" class="valeur">' ;
}
2003-01-10 16:26:02 +01:00
print strftime ( " %d %B %Y " , $adh -> datefin ) . ' </td>' ;
2003-01-03 00:52:24 +01:00
2003-01-15 01:03:47 +01:00
print '</tr>' ;
2002-12-30 22:07:11 +01:00
2003-01-15 01:03:47 +01:00
print '<tr><td colspan="2">Nouvelle adh<64> sion</td></tr>' ;
2002-12-30 22:07:11 +01:00
2003-01-10 16:18:06 +01:00
print " <tr><td>Date de cotisation</td><td> \n " ;
2002-12-30 22:07:11 +01:00
if ( $adh -> datefin > 0 )
{
print_date_select ( $adh -> datefin + ( 3600 * 24 ));
}
else
{
print_date_select ();
}
2003-01-03 00:52:24 +01:00
print " </td></tr> " ;
2002-12-30 22:07:11 +01:00
print " <tr><td>Mode de paiement</td><td> \n " ;
2003-09-05 16:11:38 +02:00
print '<select name="operation">' ;
print '<option value="CHQ" SELECTED>Ch<43> que' ;
print '<option value="CB">Carte Bleue' ;
print '<option value="DEP">Espece' ;
print '<option value="TIP">TIP' ;
print '<option value="PRE">PRE' ;
print '<option value="VIR">Virement' ;
print '</select>' ;
// $paiement = new Paiement($db);
//$paiement->select("modepaiement","cr<63> dit");
2003-01-15 01:03:47 +01:00
print " </td></tr> \n " ;
2003-09-05 16:11:38 +02:00
if ( defined ( " ADHERENT_BANK_USE " ) && ADHERENT_BANK_USE != 0 &&
defined ( " ADHERENT_BANK_USE_AUTO " ) && ADHERENT_BANK_USE_AUTO != 0 ){
print " <tr><td>Numero de cheque</td><td> \n " ;
print '<input name="num_chq" type="text" size="6">' ;
print " </td></tr> \n " ;
}
2003-01-10 16:26:02 +01:00
print '<tr><td>Cotisation</td><td colspan="2"><input type="text" name="cotisation" size="6"> euros</td></tr>' ;
2003-09-05 16:11:38 +02:00
if ( defined ( " ADHERENT_BANK_USE " ) && ADHERENT_BANK_USE != 0 &&
defined ( " ADHERENT_BANK_USE_AUTO " ) && ADHERENT_BANK_USE_AUTO != 0 ){
print '<tr><td>Libelle</td><td colspan="2"><input name="label" type="text" size=20 value="Cotisation ' . stripslashes ( $adh -> prenom ) . ' ' . stripslashes ( $adh -> nom ) . ' ' . strftime ( " %Y " , $adh -> datefin ) . '" ></td></tr>' ;
}
2003-01-10 16:26:02 +01:00
print '<tr><td colspan="2" align="center"><input type="submit" value="Enregistrer"</td></tr>' ;
2003-01-10 16:18:06 +01:00
print " </form> \n " ;
2002-12-30 22:07:11 +01:00
}
2002-12-28 19:12:22 +01:00
2002-12-30 17:29:21 +01:00
2003-01-15 01:03:47 +01:00
print '</table>' ;
2002-12-28 19:12:22 +01:00
}
$db -> close ();
llxFooter ( " <em>Dernière modification $Date $ révision $Revision $ </em> " );
?>