| [ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org> 4 * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 * 20 * $Id: fiche.php,v 1.66 2005/12/07 22:56:57 eldy Exp $ 21 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/adherents/fiche.php,v $ 22 */ 23 24 /** 25 \file htdocs/adherents/fiche.php 26 \ingroup adherent 27 \brief Page d'ajout, edition, suppression d'une fiche adhérent 28 \version $Revision: 1.66 $ 29 */ 30 31 require ("./pre.inc.php"); 32 require_once (DOL_DOCUMENT_ROOT."/adherents/adherent.class.php"); 33 require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php"); 34 require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php"); 35 require_once (DOL_DOCUMENT_ROOT."/compta/bank/account.class.php"); 36 require_once(DOL_DOCUMENT_ROOT."/lib/xmlrpc.php"); 37 38 $langs->load("companies"); 39 $langs->load("bills"); 40 $langs->load("members"); 41 $langs->load("users"); 42 43 $adho = new AdherentOptions($db); 44 $errmsg=''; 45 46 $action=isset($_GET["action"])?$_GET["action"]:$_POST["action"]; 47 $rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"]; 48 49 50 if ($_POST["action"] == 'sendinfo') 51 { 52 $adh = new Adherent($db); 53 $adh->id = $rowid; 54 $adh->fetch($rowid); 55 $adh->send_an_email($adh->email,"Voici le contenu de votre fiche\n\n%INFOS%\n\n","Contenu de votre fiche adherent"); 56 } 57 58 59 if ($_POST["action"] == 'cotisation') 60 { 61 $reday=$_POST["reday"]; 62 $remonth=$_POST["remonth"]; 63 $reyear=$_POST["reyear"]; 64 $cotisation=$_POST["cotisation"]; 65 66 if ($cotisation > 0) 67 { 68 $db->begin(); 69 70 $adh = new Adherent($db); 71 $adh->id = $rowid; 72 $adh->fetch($rowid); 73 74 // Rajout du nouveau cotisant dans les listes qui vont bien 75 // if (defined("ADHERENT_MAILMAN_LISTS_COTISANT") && ADHERENT_MAILMAN_LISTS_COTISANT!='' && $adh->datefin == "0000-00-00 00:00:00"){ 76 if (defined("ADHERENT_MAILMAN_LISTS_COTISANT") && ADHERENT_MAILMAN_LISTS_COTISANT!='' && $adh->datefin == 0) 77 { 78 $adh->add_to_mailman(ADHERENT_MAILMAN_LISTS_COTISANT); 79 } 80 81 $crowid=$adh->cotisation(mktime(12, 0 , 0, $remonth, $reday, $reyear), $cotisation); 82 if ($crowid > 0) 83 { 84 // Insertion dans la gestion banquaire si configuré pour 85 if ($conf->global->ADHERENT_BANK_USE) 86 { 87 $acct=new Account($db,$_POST["accountid"]); 88 89 $dateop=strftime("%Y%m%d",time()); 90 $amount=$cotisation; 91 92 $insertid=$acct->addline($dateop, $_POST["operation"], $_POST["label"], $amount, $_POST["num_chq"], '', $user); 93 if ($insertid > 0) 94 { 95 $inserturlid=$acct->add_url_line($insertid, $adh->id, DOL_URL_ROOT.'/adherents/fiche.php?rowid=', $adh->getFullname(), 'member'); 96 if ($inserturlid > 0) 97 { 98 // Met a jour la table cotisation 99 $sql="UPDATE ".MAIN_DB_PREFIX."cotisation SET fk_bank=".$insertid." WHERE rowid=".$crowid; 100 $resql = $db->query($sql); 101 if ($resql) 102 { 103 $db->commit(); 104 //Header("Location: fiche.php"); 105 } 106 else 107 { 108 $db->rollback(); 109 dolibarr_print_error($db); 110 } 111 } 112 else 113 { 114 $db->rollback(); 115 dolibarr_print_error($db,$acct->error); 116 } 117 } 118 else 119 { 120 $db->rollback(); 121 dolibarr_print_error($db,$acct->error); 122 } 123 } 124 else 125 { 126 $db->commit(); 127 } 128 } 129 else 130 { 131 $db->rollback(); 132 dolibarr_print_error($db); 133 } 134 135 // Envoi mail 136 if (defined("ADHERENT_MAIL_COTIS") && defined("ADHERENT_MAIL_COTIS_SUBJECT")){ 137 $adh->send_an_email($adh->email,ADHERENT_MAIL_COTIS,ADHERENT_MAIL_COTIS_SUBJECT); 138 } 139 } 140 else 141 { 142 $adh = new Adherent($db); 143 $adh->id = $rowid; 144 $adh->fetch($rowid); 145 } 146 $mesg='<div class="error">'.$langs->trans("FieldRequired",$langs->trans("Amount")).'</div>'; 147 148 $action = "edit"; 149 } 150 151 if ($_POST["action"] == 'add') 152 { 153 $type=$_POST["type"]; 154 $nom=$_POST["nom"]; 155 $prenom=$_POST["prenom"]; 156 $societe=$_POST["societe"]; 157 $adresse=$_POST["adresse"]; 158 $cp=$_POST["cp"]; 159 $ville=$_POST["ville"]; 160 $pays=$_POST["pays"]; 161 $email=$_POST["email"]; 162 $login=$_POST["login"]; 163 $pass=$_POST["pass"]; 164 $naiss=$_POST["naiss"]; 165 $photo=$_POST["photo"]; 166 $note=$_POST["note"]; 167 $comment=$_POST["comment"]; 168 $morphy=$_POST["morphy"]; 169 $reday=$_POST["reday"]; 170 $remonth=$_POST["remonth"]; 171 $reyear=$_POST["reyear"]; 172 $cotisation=$_POST["cotisation"]; 173 174 $adh = new Adherent($db); 175 $adh->prenom = $prenom; 176 $adh->nom = $nom; 177 $adh->societe = $societe; 178 $adh->adresse = $adresse; 179 $adh->cp = $cp; 180 $adh->ville = $ville; 181 $adh->pays = $pays; 182 $adh->email = $email; 183 $adh->login = $login; 184 $adh->pass = $pass; 185 $adh->naiss = $naiss; 186 $adh->photo = $photo; 187 $adh->note = $note; 188 $adh->typeid = $type; 189 $adh->commentaire = $comment; 190 $adh->morphy = $morphy; 191 foreach($_POST as $key => $value){ 192 if (ereg("^options_",$key)){ 193 $adh->array_options[$key]=$_POST[$key]; 194 } 195 } 196 197 // Test validite des paramètres 198 if(!isset($type) || $type==''){ 199 $error++; 200 $errmsg .= $langs->trans("ErrorMemberTypeNotDefined")."<br>\n"; 201 } 202 // Test si le login existe deja 203 if(!isset($login) || $login==''){ 204 $error++; 205 $errmsg .= $langs->trans("ErrorFieldRequired",$langs->trans("Login"))."<br>\n"; 206 } 207 else { 208 $sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='$login';"; 209 $result = $db->query($sql); 210 if ($result) { 211 $num = $db->num_rows($result); 212 } 213 if ($num) { 214 $error++; 215 $errmsg .= $langs->trans("ErrorLoginAlreadyExists",$login)."<br>\n"; 216 } 217 } 218 if (!isset($nom) || $nom=='') { 219 $error++; 220 $errmsg .= $langs->trans("ErrorFieldRequired",$langs->trans("Lastname"))."<br>\n"; 221 } 222 if (!isset($prenom) || $prenom=='') { 223 $error++; 224 $errmsg .= $langs->trans("ErrorFieldRequired",$langs->trans("Firstname"))."<br>\n"; 225 } 226 if ($conf->global->ADHERENT_MAIL_REQUIRED && ! ValidEMail($email)) { 227 $error++; 228 $errmsg .= $langs->trans("ErrorBadEMail",$email)."<br>\n"; 229 } 230 if (!isset($pass) || $pass == '' ) { 231 $error++; 232 $errmsg .= $langs->trans("ErrorFieldRequired",$langs->trans("Password"))."<br>\n"; 233 } 234 if (isset($naiss) && $naiss !=''){ 235 if (!preg_match("/^\d\d\d\d-\d\d-\d\d$/",$naiss)) { 236 $error++; 237 $errmsg .= $langs->trans("DateSubscription")." (".$langs->trans("DateFormatYYYYMMDD").")<br>\n"; 238 } 239 } 240 if (isset($public)) { 241 $public=1; 242 } else { 243 $public=0; 244 } 245 246 if (!$error) 247 { 248 // Email a peu pres correct et le login n'existe pas 249 if ($adh->create($user->id)) 250 { 251 if ($cotisation > 0) 252 { 253 $crowid=$adh->cotisation(mktime(12, 0 , 0, $remonth, $reday, $reyear), $cotisation); 254 // insertion dans la gestion banquaire si configure pour 255 if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE) 256 { 257 $dateop=strftime("%Y%m%d",time()); 258 $amount=$cotisation; 259 $acct=new Account($db,$_POST["accountid"]); 260 $insertid=$acct->addline($dateop, $_POST["operation"], $_POST["label"], $amount, $_POST["num_chq"], '', $user); 261 if ($insertid == '') 262 { 263 dolibarr_print_error($db); 264 } 265 else 266 { 267 // met a jour la table cotisation 268 $sql="UPDATE ".MAIN_DB_PREFIX."cotisation SET fk_bank=$insertid WHERE rowid=$crowid "; 269 $result = $db->query($sql); 270 if ($result) 271 { 272 //Header("Location: fiche.php"); 273 } 274 else 275 { 276 dolibarr_print_error($db); 277 } 278 } 279 } 280 } 281 Header("Location: liste.php?statut=-1"); 282 } 283 else { 284 dolibarr_print_error($db); 285 } 286 } 287 else { 288 $action = 'create'; 289 } 290 } 291 292 if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes') 293 { 294 $adh = new Adherent($db); 295 $adh->delete($rowid); 296 Header("Location: liste.php"); 297 } 298 299 300 if ($_POST["action"] == 'confirm_valid' && $_POST["confirm"] == 'yes') 301 { 302 $adh = new Adherent($db, $rowid); 303 $adh->validate($user->id); 304 $adh->fetch($rowid); 305 306 $adht = new AdherentType($db); 307 $adht->fetch($adh->typeid); 308 309 if (isset($adht->mail_valid) && $adht->mail_valid != '') 310 { 311 $adh->send_an_email($adh->email,$adht->mail_valid,$conf->adherent->email_valid_subject); 312 } 313 else 314 { 315 $adh->send_an_email($adh->email,$conf->adherent->email_valid,$conf->adherent->email_valid_subject); 316 } 317 // rajoute l'utilisateur dans les divers abonnements .. 318 if (!$adh->add_to_abo($adht)) 319 { 320 // error 321 $errmsg.="echec du rajout de l'utilisateur aux abonnements: ".$adh->errostr."<BR>\n"; 322 } 323 324 } 325 326 if ($_POST["action"] == 'confirm_resign' && $_POST["confirm"] == 'yes') 327 { 328 $adh = new Adherent($db, $rowid); 329 $adh->resiliate($user->id); 330 $adh->fetch($rowid); 331 332 $adht = new AdherentType($db); 333 $adht->fetch($adh->typeid); 334 335 $adh->send_an_email($adh->email,$conf->adherent->email_resil,$conf->adherent->email_resil_subject); 336 337 // supprime l'utilisateur des divers abonnements .. 338 if (!$adh->del_to_abo($adht)) 339 { 340 // error 341 $errmsg.="echec de la suppression de l'utilisateur aux abonnements: ".$adh->errostr."<BR>\n"; 342 } 343 } 344 345 if ($_POST["action"] == 'confirm_add_glasnost' && $_POST["confirm"] == 'yes') 346 { 347 $adh = new Adherent($db, $rowid); 348 $adh->fetch($rowid); 349 $adht = new AdherentType($db); 350 $adht->fetch($adh->typeid); 351 if ($adht->vote == 'yes'){ 352 define("XMLRPC_DEBUG", 1); 353 if (!$adh->add_to_glasnost()){ 354 $errmsg.="Echec du rajout de l'utilisateur dans glasnost: ".$adh->errostr."<BR>\n"; 355 } 356 XMLRPC_debug_print(); 357 } 358 } 359 360 if ($_POST["action"] == 'confirm_del_glasnost' && $_POST["confirm"] == 'yes') 361 { 362 $adh = new Adherent($db, $rowid); 363 $adh->fetch($rowid); 364 $adht = new AdherentType($db); 365 $adht->fetch($adh->typeid); 366 if ($adht->vote == 'yes'){ 367 define("XMLRPC_DEBUG", 1); 368 if(!$adh->del_to_glasnost()){ 369 $errmsg.="Echec de la suppression de l'utilisateur dans glasnost: ".$adh->errostr."<BR>\n"; 370 } 371 XMLRPC_debug_print(); 372 } 373 } 374 375 if ($_POST["action"] == 'confirm_del_spip' && $_POST["confirm"] == 'yes') 376 { 377 $adh = new Adherent($db, $rowid); 378 $adh->fetch($rowid); 379 if(!$adh->del_to_spip()){ 380 $errmsg.="Echec de la suppression de l'utilisateur dans spip: ".$adh->errostr."<BR>\n"; 381 } 382 } 383 384 if ($_POST["action"] == 'confirm_add_spip' && $_POST["confirm"] == 'yes') 385 { 386 $adh = new Adherent($db, $rowid); 387 $adh->fetch($rowid); 388 if (!$adh->add_to_spip()){ 389 $errmsg.="Echec du rajout de l'utilisateur dans spip: ".$adh->errostr."<BR>\n"; 390 } 391 } 392 393 394 395 llxHeader(); 396 397 398 399 /* ************************************************************************** */ 400 /* */ 401 /* Création d'une fiche */ 402 /* */ 403 /* ************************************************************************** */ 404 if ($errmsg != '') 405 { 406 print '<table class="border" width="100%">'; 407 print "<tr><td class=\"error\"><b>$errmsg</b></td></tr>\n"; 408 print '</table><br>'; 409 } 410 411 // fetch optionals attributes and labels 412 $adho->fetch_optionals(); 413 414 415 if ($action == 'create') 416 { 417 418 print_titre($langs->trans("NewMember")); 419 print "<form action=\"fiche.php\" method=\"post\">\n"; 420 print '<table class="border" width="100%">'; 421 422 print '<input type="hidden" name="action" value="add">'; 423 424 $htmls = new Form($db); 425 $adht = new AdherentType($db); 426 427 print '<tr><td width="15%">'.$langs->trans("MemberType").'</td><td width="35%">'; 428 $listetype=$adht->liste_array(); 429 if (sizeof($listetype)) { 430 $htmls->select_array("type", $listetype); 431 } else { 432 print '<font class="error">'.$langs->trans("NoTypeDefinedGoToSetup").'</font>'; 433 } 434 print "</td>\n"; 435 436 print '<td width="50%" valign="top">'.$langs->trans("Comments").' :</td></tr>'; 437 438 $morphys["phy"] = "Physique"; 439 $morphys["mor"] = "Morale"; 440 441 print "<tr><td>".$langs->trans("Person")."</td><td>\n"; 442 $htmls->select_array("morphy", $morphys); 443 print "</td>\n"; 444 445 print '<td valign="top" rowspan="12"><textarea name="comment" wrap="soft" cols="40" rows="16"></textarea></td></tr>'; 446 447 print '<tr><td>'.$langs->trans("Firstname").'*</td><td><input type="text" name="prenom" size="40" value="'.$adh->prenom.'"></td></tr>'; 448 print '<tr><td>'.$langs->trans("Lastname").'*</td><td><input type="text" name="nom" value="'.$adh->nom.'" size="40"></td></tr>'; 449 print '<tr><td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" size="40" value="'.$adh->societe.'"></td></tr>'; 450 print '<tr><td valign="top">'.$langs->trans("Address").'</td><td>'; 451 print '<textarea name="adresse" wrap="soft" cols="40" rows="2"></textarea></td></tr>'; 452 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" value="'.$adh->ville.'"></td></tr>'; 453 print '<tr><td>'.$langs->trans("Country").'</td><td>'; 454 $htmls->select_pays($adh->pays?$adh->pays:$mysoc->pays,'pays'); 455 print '</td></tr>'; 456 print '<tr><td>'.$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'*':'').'</td><td><input type="text" name="email" size="40" value="'.$adh->email.'"></td></tr>'; 457 print '<tr><td>'.$langs->trans("Login").'*</td><td><input type="text" name="login" size="40" value="'.$adh->login.'"></td></tr>'; 458 print '<tr><td>'.$langs->trans("Password").'*</td><td><input type="password" name="pass" size="40" value="'.$adh->password.'"></td></tr>'; 459 print '<tr><td>'.$langs->trans("Birthday").'</td><td><input type="text" name="naiss" size="10"> ('.$langs->trans("DateFormatYYYYMMDD").')</td></tr>'; 460 print '<tr><td>Url photo</td><td><input type="text" name="photo" size="40"></td></tr>'; 461 foreach($adho->attribute_label as $key=>$value){ 462 print "<tr><td>$value</td><td><input type=\"text\" name=\"options_$key\" size=\"40\"></td></tr>\n"; 463 } 464 print "</table>\n"; 465 print '<br>'; 466 467 // Boite cotisations 468 print '<table class="border" width="100%">'; 469 print "<tr><td>".$langs->trans("DateSubscription")."</td><td>\n"; 470 $htmls->select_date(); 471 print "</td></tr>\n"; 472 473 if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE) 474 { 475 print '<tr><td>'.$langs->trans("PaymentMode").'</td><td>'; 476 $htmls->select_types_paiements('','operation'); 477 print "</td></tr>\n"; 478 479 print '<tr><td>'.$langs->trans("FinancialAccount").'</td><td>'; 480 $htmls->select_comptes('','accountid'); 481 print "</td></tr>\n"; 482 483 print '<tr><td>'.$langs->trans("Numero").'</td><td>'; 484 print '<input name="num_chq" type="text" size="6">'; 485 print "</td></tr>\n"; 486 487 print '<tr><td>'.$langs->trans("Label").'</td><td><input name="label" type="text" size="50" value="'.$langs->trans("Subscription").' " ></td></tr>'; 488 } 489 print '<tr><td>'.$langs->trans("Subscription").'</td><td><input type="text" name="cotisation" size="6"> '.$langs->trans("Currency".$conf->monnaie).'</td></tr>'; 490 491 print "</table>\n"; 492 print '<br>'; 493 494 print '<center><input type="submit" class="button" value="'.$langs->trans("AddMember").'"></center>'; 495 496 print "</form>\n"; 497 498 } 499 500 501 /* ************************************************************************** */ 502 /* */ 503 /* Edition de la fiche */ 504 /* */ 505 /* ************************************************************************** */ 506 if ($rowid) 507 { 508 $adh = new Adherent($db); 509 $adh->id = $rowid; 510 $adh->fetch($rowid); 511 $adh->fetch_optionals($rowid); 512 513 $adht = new AdherentType($db); 514 $adht->fetch($adh->typeid); 515 516 $html = new Form($db); 517 518 /* 519 * Affichage onglets 520 */ 521 $h = 0; 522 523 $head[$h][0] = DOL_URL_ROOT.'/adherents/fiche.php?rowid='.$rowid; 524 $head[$h][1] = $langs->trans("MemberCard"); 525 $hselected=$h; 526 $h++; 527 528 dolibarr_fiche_head($head, $hselected, $adh->fullname); 529 530 /* 531 * Confirmation de la suppression de l'adhérent 532 */ 533 if ($action == 'delete') 534 { 535 $html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_delete"); 536 print '<br>'; 537 } 538 539 /* 540 * Confirmation de la validation 541 */ 542 if ($action == 'valid') 543 { 544 $html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid"); 545 print '<br>'; 546 } 547 548 /* 549 * Confirmation de la Résiliation 550 */ 551 if ($action == 'resign') 552 { 553 $html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign"); 554 print '<br>'; 555 } 556 557 /* 558 * Confirmation de l'ajout dans glasnost 559 */ 560 if ($action == 'add_glasnost') 561 { 562 $html->form_confirm("fiche.php?rowid=$rowid","Ajouter dans glasnost","Etes-vous sur de vouloir ajouter cet adhérent dans glasnost ? (serveur : ".ADHERENT_GLASNOST_SERVEUR.")","confirm_add_glasnost"); 563 print '<br>'; 564 } 565 566 /* 567 * Confirmation de la suppression dans glasnost 568 */ 569 if ($action == 'del_glasnost') 570 { 571 $html->form_confirm("fiche.php?rowid=$rowid","Supprimer dans glasnost","Etes-vous sur de vouloir effacer cet adhérent dans glasnost ? (serveur : ".ADHERENT_GLASNOST_SERVEUR.")","confirm_del_glasnost"); 572 print '<br>'; 573 } 574 575 /* 576 * Confirmation de l'ajout dans spip 577 */ 578 if ($action == 'add_spip') 579 { 580 $html->form_confirm("fiche.php?rowid=$rowid","Ajouter dans spip","Etes-vous sur de vouloir ajouter cet adhérent dans spip ? (serveur : ".ADHERENT_SPIP_SERVEUR.")","confirm_add_spip"); 581 print '<br>'; 582 } 583 584 /* 585 * Confirmation de la suppression dans spip 586 */ 587 if ($action == 'del_spip') 588 { 589 $html->form_confirm("fiche.php?rowid=$rowid","Supprimer dans spip","Etes-vous sur de vouloir effacer cet adhérent dans spip ? (serveur : ".ADHERENT_SPIP_SERVEUR.")","confirm_del_spip"); 590 $html->form_confirm("fiche.php?rowid=$rowid","Ajouter dans glasnost","Etes-vous sur de vouloir ajouter cet adhérent dans glasnost ? (serveur : ".ADHERENT_GLASNOST_SERVEUR.")","confirm_del_spip"); 591 print '<br>'; 592 } 593 594 595 print '<table class="border" width="100%">'; 596 print '<form action="fiche.php" method="post">'; 597 598 print '<tr><td>'.$langs->trans("Ref").'</td><td class="valeur">'.$adh->id.' </td>'; 599 print '<td valign="top" width="50%">'.$langs->trans("Comments").'</tr>'; 600 601 print '<tr><td>'.$langs->trans("Type").'*</td><td class="valeur">'.$adh->type."</td>\n"; 602 603 print '<td rowspan="'.(14+count($adh->array_options)).'" valign="top" width="50%">'; 604 print nl2br($adh->commentaire).' </td></tr>'; 605 606 print '<tr><td>'.$langs->trans("Person").'</td><td class="valeur">'.$adh->getmorphylib().' </td></tr>'; 607 608 print '<tr><td width="15%">'.$langs->trans("Firstname").'*</td><td class="valeur" width="35%">'.$adh->prenom.' </td></tr>'; 609 610 print '<tr><td>'.$langs->trans("Lastname").'*</td><td class="valeur">'.$adh->nom.' </td></tr>'; 611 612 print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$adh->societe.' </td></tr>'; 613 print '<tr><td>'.$langs->trans("Address").'</td><td class="valeur">'.nl2br($adh->adresse).' </td></tr>'; 614 print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td class="valeur">'.$adh->cp.' '.$adh->ville.' </td></tr>'; 615 print '<tr><td>'.$langs->trans("Country").'</td><td class="valeur">'.$adh->pays.'</td></tr>'; 616 print '<tr><td>'.$langs->trans("EMail").(ADHERENT_MAIL_REQUIRED&&ADHERENT_MAIL_REQUIRED==1?'*':'').'</td><td class="valeur">'.$adh->email.' </td></tr>'; 617 print '<tr><td>'.$langs->trans("Login").'*</td><td class="valeur">'.$adh->login.' </td></tr>'; 618 // print '<tr><td>Pass</td><td class="valeur">'.$adh->pass.' </td></tr>'; 619 print '<tr><td>'.$langs->trans("Birthday").'</td><td class="valeur">'.$adh->naiss.' </td></tr>'; 620 print '<tr><td>URL Photo</td><td class="valeur">'.$adh->photo.' </td></tr>'; 621 print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'; 622 if ($adh->public==1) print $langs->trans("Yes"); 623 else print $langs->trans("No"); 624 print '</td></tr>'; 625 print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$adh->getLibStatut($adh).'</td></tr>'; 626 627 foreach($adho->attribute_label as $key=>$value){ 628 print "<tr><td>$value</td><td>".$adh->array_options["options_$key"]." </td></tr>\n"; 629 } 630 631 print '</form>'; 632 print "</table>\n"; 633 634 print "</div>\n"; 635 636 637 /* 638 * Barre d'actions 639 * 640 */ 641 print '<div class="tabsAction">'; 642 643 644 print "<a class=\"butAction\" href=\"edit.php?rowid=$rowid\">".$langs->trans("Edit")."</a>"; 645 646 // Valider 647 if ($adh->statut < 1) 648 { 649 print "<a class=\"butAction\" href=\"fiche.php?rowid=$rowid&action=valid\">".$langs->trans("Validate")."</a>\n"; 650 } 651 652 // Envoi fiche par mail 653 print "<a class=\"butAction\" href=\"fiche.php?rowid=$adh->id&action=sendinfo\">".$langs->trans("SendCardByMail")."</a>\n"; 654 655 // Résilier 656 if ($adh->statut == 1) 657 { 658 print "<a class=\"butAction\" href=\"fiche.php?rowid=$rowid&action=resign\">".$langs->trans("Resiliate")."</a>\n"; 659 } 660 661 // Supprimer 662 if ($user->admin) { 663 print "<a class=\"butActionDelete\" href=\"fiche.php?rowid=$adh->id&action=delete\">".$langs->trans("Delete")."</a>\n"; 664 } 665 666 // Action Glasnost 667 if ($adht->vote == 'yes' && defined("ADHERENT_USE_GLASNOST") && ADHERENT_USE_GLASNOST ==1) 668 { 669 define("XMLRPC_DEBUG", 1); 670 $isinglasnost=$adh->is_in_glasnost(); 671 if ($isinglasnost == 1) 672 { 673 print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=del_glasnost\">Suppression dans Glasnost</a>\n"; 674 } 675 if ($isinglasnost == 0) { 676 print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=add_glasnost\">Ajout dans Glasnost</a>\n"; 677 } 678 if ($isinglasnost == -1) { 679 print '<br><font class="error">Failed to connect to SPIP: '.$adh->errorstr.'</font>'; 680 } 681 } 682 683 // Action SPIP 684 if (defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1) 685 { 686 $isinspip=$adh->is_in_spip(); 687 if ($isinspip == 1) 688 { 689 print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=del_spip\">Suppression dans Spip</a>\n"; 690 } 691 if ($isinspip == 0) 692 { 693 print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=add_spip\">Ajout dans Spip</a>\n"; 694 } 695 if ($isinspip == -1) { 696 print '<br><font class="error">Failed to connect to SPIP: '.$adh->errorstr.'</font>'; 697 } 698 } 699 700 print '</div>'; 701 print "<br>\n"; 702 703 704 705 /* 706 * Bandeau des cotisations 707 * 708 */ 709 710 print '<table border=0 width="100%">'; 711 712 print '<tr>'; 713 print '<td valign="top">'; 714 715 716 /* 717 * Liste des cotisations 718 * 719 */ 720 $sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, c.cotisation, ".$db->pdate("c.dateadh")." as dateadh"; 721 $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c"; 722 $sql .= " WHERE d.rowid = c.fk_adherent AND d.rowid=$rowid"; 723 724 $result = $db->query($sql); 725 if ($result) 726 { 727 $num = $db->num_rows(); 728 $i = 0; 729 730 print "<table class=\"noborder\" width=\"100%\">\n"; 731 732 print '<tr class="liste_titre">'; 733 print '<td>'.$langs->trans("DateSubscription").'</td>'; 734 print "<td align=\"right\">".$langs->trans("Amount")."</td>\n"; 735 print "</tr>\n"; 736 737 $var=True; 738 while ($i < $num) 739 { 740 $objp = $db->fetch_object($result); 741 $var=!$var; 742 print "<tr $bc[$var]>"; 743 print "<td>".dolibarr_print_date($objp->dateadh)."</td>\n"; 744 print '<td align="right">'.price($objp->cotisation).'</td>'; 745 print "</tr>"; 746 $i++; 747 } 748 print "</table>"; 749 } 750 else 751 { 752 dolibarr_print_error($db); 753 } 754 755 print '</td><td>'; 756 757 758 /* 759 * Ajout d'une nouvelle cotisation 760 */ 761 if ($user->rights->adherent->cotisation->creer) 762 { 763 print "<table class=\"border\" width=\"100%\">\n"; 764 765 print '<form method="post" action="fiche.php">'; 766 print '<input type="hidden" name="action" value="cotisation">'; 767 print '<input type="hidden" name="rowid" value="'.$rowid.'">'; 768 769 print '<tr><td width="15%">'.$langs->trans("SubscriptionEndDate").'</td>'; 770 print '<td width="35%">'; 771 if ($adh->datefin) 772 { 773 if ($adh->datefin < time()) 774 { 775 print dolibarr_print_date($adh->datefin)." ".img_warning($langs->trans("Late")); 776 } 777 else 778 { 779 print dolibarr_print_date($adh->datefin); 780 } 781 } 782 else 783 { 784 print $langs->trans("SubscriptionNotReceived")." ".img_warning($langs->trans("Late")); 785 } 786 print '</td>'; 787 print '</tr>'; 788 789 print '<tr><td colspan="2"><b>'.$langs->trans("NewCotisation").'</b></td></tr>'; 790 791 print '<tr><td>'.$langs->trans("DateSubscription").'</td><td>'; 792 if ($adh->datefin > 0) 793 { 794 $html->select_date($adh->datefin + (3600*24)); 795 } 796 else 797 { 798 $html->select_date(); 799 } 800 print "</td></tr>"; 801 802 803 print '<tr><td>'.$langs->trans("Amount").'</td><td><input type="text" name="cotisation" size="6"> '.$langs->trans("Currency".$conf->monnaie).'</td></tr>'; 804 805 if ($conf->global->ADHERENT_BANK_USE) 806 { 807 print '<tr><td>'.$langs->trans("PaymentMode").'</td><td>'; 808 $html->select_types_paiements('','operation'); 809 print "</td></tr>\n"; 810 811 print '<tr><td>'.$langs->trans("FinancialAccount").'</td><td>'; 812 $html->select_comptes('','accountid'); 813 print "</td></tr>\n"; 814 815 print '<tr><td>'.$langs->trans("Numero").'</td><td>'; 816 print '<input name="num_chq" type="text" size="8">'; 817 print "</td></tr>\n"; 818 819 print '<tr><td>'.$langs->trans("Label").'</td>'; 820 print '<td><input name="label" type="text" size="50" value="'.$langs->trans("Subscription").' '; 821 print strftime("%Y",($adh->datefin?$adh->datefin:time())).'" ></td></tr>'; 822 } 823 824 print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"</td></tr>'; 825 826 print '</form>'; 827 print '</table>'; 828 } 829 830 print '</td></tr>'; 831 print '</table>'; 832 833 } 834 835 836 $db->close(); 837 838 llxFooter('$Date: 2005/12/07 22:56:57 $ - $Revision: 1.66 $'); 839 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
|