Fix: Corrections bugs diverses, amélioration IHM, gestion du register_globals=off

This commit is contained in:
Laurent Destailleur 2004-07-17 12:41:15 +00:00
parent 8ab203fc46
commit 2fe7930b5b
6 changed files with 240 additions and 253 deletions

View File

@ -26,7 +26,8 @@ require(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
require(DOL_DOCUMENT_ROOT."/adherents/adherent_type.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/adherent_options.class.php");
$adho = new AdherentOptions($db); $action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
$rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"];
/* /*
* Enregistrer les modifs * Enregistrer les modifs
@ -91,6 +92,7 @@ llxHeader();
if ($rowid) if ($rowid)
{ {
$adho = new AdherentOptions($db);
$adh = new Adherent($db); $adh = new Adherent($db);
$adh->id = $rowid; $adh->id = $rowid;
$adh->fetch($rowid); $adh->fetch($rowid);

View File

@ -33,6 +33,7 @@ $adho = new AdherentOptions($db);
$errmsg=''; $errmsg='';
$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"]; $action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
$rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"];
if ($_POST["action"] == 'sendinfo') if ($_POST["action"] == 'sendinfo')
@ -94,12 +95,51 @@ if ($_POST["action"] == 'cotisation')
if ($_POST["action"] == 'add') if ($_POST["action"] == 'add')
{ {
$type=$_POST["type"]; $type=$_POST["type"];
$nom=$_POST["nom"];
$prenom=$_POST["prenom"];
$societe=$_POST["societe"];
$adresse=$_POST["adresse"];
$cp=$_POST["cp"];
$ville=$_POST["ville"];
$naiss=$_POST["pays"];
$email=$_POST["email"];
$login=$_POST["login"];
$pass=$_POST["pass"];
$naiss=$_POST["naiss"];
$naiss=$_POST["photo"];
$naiss=$_POST["note"];
$comment=$_POST["comment"];
$morphy=$_POST["morphy"];
$adh = new Adherent($db);
$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 = $comment;
$adh->morphy = $morphy;
foreach($_POST as $key => $value){
if (ereg("^options_",$key)){
$adh->array_options[$key]=$_POST[$key];
}
}
// Test validite des paramètres
if(!isset($type) || $type==''){ if(!isset($type) || $type==''){
$error+=1; $error+=1;
$errmsg .="Le type d'adhérent n'est pas renseigné. Vous devez configurer les types d'adhérents avant de pouvoir les ajouter.<br>\n"; $errmsg .="Le type d'adhérent n'est pas renseigné. Vous devez configurer les types d'adhérents avant de pouvoir les ajouter.<br>\n";
} }
$login=$_POST["login"]; // Test si le login existe deja
// test si le login existe deja
if(!isset($login) || $login==''){ if(!isset($login) || $login==''){
$error+=1; $error+=1;
$errmsg .="Login vide. Veuillez en positionner un<br>\n"; $errmsg .="Login vide. Veuillez en positionner un<br>\n";
@ -134,34 +174,10 @@ if ($_POST["action"] == 'add')
if (isset($public)){ if (isset($public)){
$public=1; $public=1;
}else{ }else{
$public=0; $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 = $_POST["comment"];
$adh->morphy = $_POST["morphy"];
foreach($_POST as $key => $value){
if (ereg("^options_",$key)){
$adh->array_options[$key]=$_POST[$key];
}
} }
if (!$error){
// email a peu pres correct et le login n'existe pas
if ($adh->create($user->id) ) if ($adh->create($user->id) )
{ {
if ($cotisation > 0) if ($cotisation > 0)
@ -195,7 +211,7 @@ if (!$error){
} }
} }
} }
Header("Location: liste.php"); Header("Location: liste.php?statut=-1");
} }
} }
} }
@ -207,6 +223,9 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == yes)
Header("Location: liste.php"); Header("Location: liste.php");
} }
llxHeader();
if ($_POST["action"] == 'confirm_valid' && $_POST["confirm"] == yes) if ($_POST["action"] == 'confirm_valid' && $_POST["confirm"] == yes)
{ {
$adh = new Adherent($db, $rowid); $adh = new Adherent($db, $rowid);
@ -252,8 +271,6 @@ if ($_POST["action"] == 'confirm_resign' && $_POST["confirm"] == yes)
} }
} }
llxHeader();
if ($_POST["action"] == 'confirm_add_glasnost' && $_POST["confirm"] == yes) if ($_POST["action"] == 'confirm_add_glasnost' && $_POST["confirm"] == yes)
{ {
$adh = new Adherent($db, $rowid); $adh = new Adherent($db, $rowid);
@ -349,11 +366,6 @@ if ($action == 'create') {
print '<td valign="top" rowspan="13"><textarea name="comment" wrap="soft" cols="40" rows="25"></textarea></td></tr>'; print '<td valign="top" rowspan="13"><textarea name="comment" wrap="soft" cols="40" rows="25"></textarea></td></tr>';
print '<tr><td>Prénom</td><td><input type="text" name="prenom" size="40"></td></tr>'; print '<tr><td>Prénom</td><td><input type="text" name="prenom" size="40"></td></tr>';
print '<tr><td>Nom</td><td><input type="text" name="nom" size="40"></td></tr>'; 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>Societe</td><td><input type="text" name="societe" size="40"></td></tr>';
print '<tr><td>Adresse</td><td>'; print '<tr><td>Adresse</td><td>';

View File

@ -48,7 +48,7 @@ $AdherentsResilies=array();
$Cotisants=array(); $Cotisants=array();
# Liste les adherents # Liste les adherents
$sql = "SELECT count(*) as somme , t.libelle, d.statut FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t"; $sql = "SELECT count(*) as somme , t.rowid, t.libelle, d.statut FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
$sql .= " WHERE d.fk_adherent_type = t.rowid GROUP BY t.libelle, d.statut"; $sql .= " WHERE d.fk_adherent_type = t.rowid GROUP BY t.libelle, d.statut";
$result = $db->query($sql); $result = $db->query($sql);
@ -60,7 +60,7 @@ if ($result)
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object( $i); $objp = $db->fetch_object( $i);
$AdherentsAll[$objp->libelle]+=$objp->somme; $AdherentsAll[$objp->libelle]=$objp->rowid;
if ($objp->statut == -1) { $AdherentsAValider[$objp->libelle]=$objp->somme; } if ($objp->statut == -1) { $AdherentsAValider[$objp->libelle]=$objp->somme; }
if ($objp->statut == 1) { $Adherents[$objp->libelle]=$objp->somme; } if ($objp->statut == 1) { $Adherents[$objp->libelle]=$objp->somme; }
if ($objp->statut == 0) { $AdherentsResilies[$objp->libelle]=$objp->somme; } if ($objp->statut == 0) { $AdherentsResilies[$objp->libelle]=$objp->somme; }
@ -97,11 +97,11 @@ $SommeD=0;
foreach ($AdherentsAll as $key=>$value){ foreach ($AdherentsAll as $key=>$value){
$var=!$var; $var=!$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print '<td><a href="liste.php">'.$key.'</a></TD>'; print '<td><a href="liste.php?type='.$AdherentsAll[$key].'">'.$key.'</a></td>';
print '<td align="right">'.$AdherentsAValider[$key].'</TD>'; print '<td align="right">'.$AdherentsAValider[$key].'</td>';
print '<td align="right">'.$Adherents[$key].'</TD>'; print '<td align="right">'.$Adherents[$key].'</td>';
print '<td align="right">'.$Cotisants[$key].'</TD>'; print '<td align="right">'.$Cotisants[$key].'</td>';
print '<td align="right">'.$AdherentsResilies[$key].'</TD>'; print '<td align="right">'.($AdherentsResilies[$key]?$AdherentsResilies[$key]:0).'</td>';
print "</tr>\n"; print "</tr>\n";
$SommeA+=$AdherentsAValider[$key]; $SommeA+=$AdherentsAValider[$key];
$SommeB+=$Adherents[$key]; $SommeB+=$Adherents[$key];
@ -121,7 +121,8 @@ print "</table>";
print '<br>'; print '<br>';
print '<form action="liste.php" method="post" name="action" value="search">'; // Formulaire recherche adhérent
print '<form action="liste.php" method="post">';
print '<input type="hidden" name="action" value="search">'; print '<input type="hidden" name="action" value="search">';
print '<table class="noborder" cellspacing="0" cellpadding="3">'; print '<table class="noborder" cellspacing="0" cellpadding="3">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -138,8 +139,6 @@ print '</td></tr>';
print "</table></form>"; print "</table></form>";
$db->close(); $db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>"); llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");

View File

@ -31,6 +31,7 @@ llxHeader();
$sortorder=$_GET["sortorder"]; $sortorder=$_GET["sortorder"];
$sortfield=$_GET["sortfield"]; $sortfield=$_GET["sortfield"];
$page=$_GET["page"]; $page=$_GET["page"];
$statut=isset($_GET["statut"])?$_GET["statut"]:1;
if ($sortorder == "") { $sortorder="ASC"; } if ($sortorder == "") { $sortorder="ASC"; }
if ($sortfield == "") { $sortfield="d.nom"; } if ($sortfield == "") { $sortfield="d.nom"; }
@ -42,15 +43,16 @@ $offset = $conf->liste_limit * $page ;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (! isset($_GET["statut"]))
{
$statut = 1 ;
}
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, ".$db->pdate("d.datefin")." as datefin"; $sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, ".$db->pdate("d.datefin")." as datefin";
$sql .= " , d.email, t.libelle as type, d.morphy, d.statut, t.cotisation"; $sql .= " , d.email, t.libelle as type, d.morphy, d.statut, t.cotisation";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = $statut"; $sql .= " WHERE d.fk_adherent_type = t.rowid ";
if ($_GET["type"]) {
$sql.=" AND t.rowid=".$_GET["type"];
}
if (isset($_GET["statut"])) {
$sql.=" AND d.statut = $statut";
}
if ( $_POST["action"] == 'search') if ( $_POST["action"] == 'search')
{ {
if (isset($_POST['search']) && $_POST['search'] != ''){ if (isset($_POST['search']) && $_POST['search'] != ''){
@ -66,17 +68,27 @@ if ($result)
$i = 0; $i = 0;
$titre="Liste des adhérents"; $titre="Liste des adhérents";
if (isset($_GET["statut"]) && $_GET["statut"] == -1) { $titre="Liste des adhérents à valider"; } if (isset($_GET["statut"])) {
if (isset($_GET["statut"]) && $_GET["statut"] == 1) { $titre="Liste des adhérents valides"; } if ($statut == -1) { $titre="Liste des adhérents à valider"; }
if (isset($_GET["statut"]) && $_GET["statut"] == 0) { $titre="Liste des adhérents résiliés"; } if ($statut == 1) { $titre="Liste des adhérents valides"; }
if ($statut == 0) { $titre="Liste des adhérents résiliés"; }
}
elseif ($_POST["action"] == 'search') {
$titre="Liste des adhérents répondant aux critères";
}
if ($_GET["type"]) {
$objp = $db->fetch_object(0);
$titre.=" (".$objp->type.")";
}
print_barre_liste($titre, $page, $PHP_SELF, "&statut=$statut&sortorder=$sortorder&sortfield=$sortfield",$sortfield,$sortorder,'',$num);
print_barre_liste($titre, $page, $PHP_SELF, "&statut=$statut&sortorder=$sortorder&sortfield=$sortfield");
print "<table class=\"noborder\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">"; print "<table class=\"noborder\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'; print '<td>';
// print_liste_field_titre("Prenom",$PHP_SELF,"d.prenom","&page=$page&statut=$statut");
print_liste_field_titre("Prenom Nom / Société",$PHP_SELF,"d.nom","&page=$page&statut=$statut"); print_liste_field_titre("Prenom Nom / Société",$PHP_SELF,"d.nom","&page=$page&statut=$statut");
print "</td>\n"; print "</td>\n";
@ -106,8 +118,11 @@ if ($result)
$var=True; $var=True;
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($i); if ($_GET["type"] && $i==0) { # Fetch deja fait
} else {
$objp = $db->fetch_object($i);
}
$adh=new Adherent($db); $adh=new Adherent($db);
$var=!$var; $var=!$var;
@ -161,10 +176,9 @@ if ($result)
print "</table><br>\n"; print "</table><br>\n";
print "<table class=\"noborder\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">"; print "<table class=\"noborder\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">";
print '<tr>'; print_barre_liste("", $page, $PHP_SELF, "&statut=$statut&sortorder=$sortorder&sortfield=$sortfield",$sortfield,$sortorder,'',$num);
print '<td align="right">';
print_fleche_navigation($page,$PHP_SELF,"&statut=$statut&sortorder=$sortorder&sortfield=$sortfield",1); // print_fleche_navigation($page,$PHP_SELF,"&statut=$statut&sortorder=$sortorder&sortfield=$sortfield",1);
print '</td>';
print "</table><br>\n"; print "</table><br>\n";
} }

View File

@ -1,6 +1,7 @@
<?PHP <?PHP
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -26,88 +27,94 @@ require(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php");
$adho = new AdherentOptions($db); $adho = new AdherentOptions($db);
$form = new Form($db); $form = new Form($db);
if ($HTTP_POST_VARS["action"] == 'add' && $user->admin) if ($_POST["action"] == 'add' && $user->admin)
{ {
// type et taille non encore pris en compte => varchar(255) if ($_POST["button"] != "Annuler") {
if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-]*$/",$_POST['attrname'])){ // Type et taille non encore pris en compte => varchar(255)
$adho->create($_POST['attrname'],$_POST['type'],$_POST['size']); if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-]*$/",$_POST['attrname'])){
} $adho->create($_POST['attrname'],$_POST['type'],$_POST['size']);
if (isset($_POST['label'])){ }
$adho->create_label($_POST['attrname'],$_POST['label']); if (isset($_POST['label'])){
} $adho->create_label($_POST['attrname'],$_POST['label']);
Header("Location: $PHP_SELF"); }
}
Header("Location: ".$_SERVER["PHP_SELF"]);
} }
if ($HTTP_POST_VARS["action"] == 'update' && $user->admin) if ($_POST["action"] == 'update' && $user->admin)
{ {
//if ($adho->update($user->id) ) if ($_POST["button"] != "Annuler") {
// { if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-]*$/",$_POST['attrname'])){
// } $adho->update($_POST['attrname'],$_POST['type'],$_POST['size']);
if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-]*$/",$_POST['attrname'])){ }
$adho->update($_POST['attrname'],$_POST['type'],$_POST['size']); if (isset($_POST['label'])){
} $adho->update_label($_POST['attrname'],$_POST['label']);
if (isset($_POST['label'])){ }
$adho->update_label($_POST['attrname'],$_POST['label']); }
} Header("Location: ".$_SERVER["PHP_SELF"]);
Header("Location: $PHP_SELF");
} }
if ($action == 'delete' && $user->admin) # Suppression attribut
if ($_GET["action"] == 'delete' && $user->admin)
{ {
if(isset($attrname) && preg_match("/^\w[a-zA-Z0-9-]*$/",$attrname)){ if(isset($_GET["attrname"]) && preg_match("/^\w[a-zA-Z0-9-]*$/",$_GET["attrname"])){
$adho->delete($attrname); $adho->delete($_GET["attrname"]);
} }
Header("Location: $PHP_SELF"); Header("Location: ".$_SERVER["PHP_SELF"]);
} }
llxHeader(); llxHeader();
print_titre("Configuration des champs optionnels");
/* ************************************************************************** */ //if ($_GET["action"] != 'create') {
/* */
/* */
/* */
/* ************************************************************************** */
$array_options=$adho->fetch_name_optionals(); print_titre("Configuration des champs optionnels");
$array_label=$adho->fetch_name_optionals_label(); print '<br>';
if (sizeof($array_options)>0)
{ /* ************************************************************************** */
print "<TABLE border=\"0\" cellspacing=\"0\" cellpadding=\"4\">"; /* */
/* */
print '<TR class="liste_titre">'; /* */
print "<td>Libelle</td>"; /* ************************************************************************** */
print "<td>Nom de l'attribut</td>";
print "<td>type</td><td>&nbsp;</td><td>&nbsp;</td>"; $array_options=$adho->fetch_name_optionals();
print "</TR>\n"; $array_label=$adho->fetch_name_optionals_label();
if (sizeof($array_options)>0)
$var=True;
foreach($adho->attribute_name as $key => $value)
{ {
$var=!$var; print "<table class=\"noborder\" cellspacing=\"0\" cellpadding=\"3\">";
print "<TR $bc[$var]>";
print "<TD>".$adho->attribute_label[$key]."&nbsp;</td>\n"; print '<tr class="liste_titre">';
print "<TD>$key</td>\n"; print "<td>Libelle</td>";
print "<TD>$value</TD>\n"; print "<td>Nom de l'attribut</td>";
print "<TD><a href=\"$PHP_SELF?action=edit&attrname=$key\">Editer</TD>\n"; print "<td>Type</td><td width=\"80\">&nbsp;</td>";
print "<TD><a href=\"$PHP_SELF?action=delete&attrname=$key\">Supprimer</TD>\n"; print "</tr>\n";
print "</tr>";
// $i++; $var=True;
foreach($adho->attribute_name as $key => $value)
{
$var=!$var;
print "<tr $bc[$var]>";
print "<td>".$adho->attribute_label[$key]."&nbsp;</td>\n";
print "<td>$key</td>\n";
print "<td>$value</TD>\n";
print "<td align=\"center\"><a href=\"$PHP_SELF?action=edit&attrname=$key\">".img_edit()."</a>";
print "&nbsp; <a href=\"$PHP_SELF?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>";
// $i++;
}
print "</table>";
/*
* Barre d'actions
*
*/
print '<div class="tabsAction">';
print "<a class=\"tabAction\" href=\"$PHP_SELF?action=create\">Nouvel attribut</a>";
print "</div>";
} }
print "</table>";
}
/*
* Barre d'actions
*
*/
print '<div class="tabsAction">';
print "<a class=\"tabAction\" href=\"$PHP_SELF?action=create\">Nouvel attribut</a>";
print "</div>";
//}
/* ************************************************************************** */ /* ************************************************************************** */
/* */ /* */
@ -115,39 +122,29 @@ if (sizeof($array_options)>0)
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
if ($_GET["action"] == 'create') {
if ($action == 'create') {
print_titre("Nouvel attribut"); print_titre("Nouvel attribut");
print '<br>';
print "<form action=\"$PHP_SELF\" method=\"post\">"; print "<form action=\"$PHP_SELF\" method=\"post\">";
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">'; print '<table class="border" cellspacing="0" width="100%" cellpadding="3">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
print '<tr><td>Libellé</td><td class="valeur"><input type="text" name="label" size="40"></td></tr>'; print '<tr><td>Libellé</td><td class="valeur"><input type="text" name="label" size="40"></td></tr>';
print '<tr><td>Nom de l\'attribut (pas d\'espace et uniquement des carateres alphanumeriques)</td><td class="valeur"><input type="text" name="attrname" size="40"></td></tr>'; print '<tr><td>Nom de l\'attribut (pas d\'espace et uniquement des carateres alphanumeriques)</td><td class="valeur"><input type="text" name="attrname" size="40"></td></tr>';
print '<tr><td>Type</td><td class="valeur">';
print '<tr><td>Type (non pris en compte)</td><td class="valeur">';
$form->select_array('type',array('varchar'=>'chaine', $form->select_array('type',array('varchar'=>'chaine',
'text'=>'texte', 'text'=>'texte',
'integer'=>'entier', 'int'=>'entier',
'date'=>'date', 'date'=>'date',
'datetime'=>'date et heure')); 'datetime'=>'date et heure'));
/*
print '<select name="type">';
print '<option value="varchar">chaine</option>';
print '<option value="text">texte</option>';
print '<option value="integer">entier</option>';
print '<option value="date">date</option>';
print '<option value="datetime">date et heure</option>';
print '</select>';
*/
print '</td></tr>'; print '</td></tr>';
print '<tr><td>Taille</td><td><input type="text" name="size" size="5" value="255"></td></tr>';
print '<tr><td>taille</td><td><input type="text" name="size" size="5" value="255"></td></tr>';
print '<tr><td colspan="2" align="center"><input type="submit" value="Enregistrer"></td></tr>'; print '<tr><td colspan="2" align="center"><input type="submit" name="button" value="Enregistrer"> &nbsp; ';
print '<input type="submit" name="button" value="Annuler"></td></tr>';
print "</form>\n"; print "</form>\n";
print "</table>\n"; print "</table>\n";
@ -158,41 +155,34 @@ if ($action == 'create') {
/* Edition d'un champ optionnel */ /* Edition d'un champ optionnel */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
if (isset($attrname) && $attrname != '' && $action == 'edit') if ($_GET["attrname"] && $_GET["action"] == 'edit')
{ {
print_titre("Edition du champ $attrname"); print_titre("Edition du champ $attrname");
print "<form action=\"$PHP_SELF\" method=\"post\">"; print '<br>';
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
print '<tr><td>Libellé</td><td class="valeur">'.$adho->attribute_label[$attrname].'&nbsp;</td></tr>';
print '<tr><td>Nom de l\'attribut</td><td class="valeur">'.$attrname.'&nbsp;</td></tr>';
print '<tr><td>Type</td><td class="valeur">'.$adho->attribute_name[$attrname].'&nbsp;</td></tr>';
print "</table>\n";
/* /*
* formulaire d'edition * formulaire d'edition
*/ */
print '<form method="post" action="'.$PHP_SELF.'?attrname='.$attrname.'">'; print '<form method="post" action="'.$PHP_SELF.'?attrname='.$_GET["attrname"].'">';
print '<input type="hidden" name="attrname" value="'.$attrname.'">'; print '<input type="hidden" name="attrname" value="'.$_GET["attrname"].'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">'; print '<table class="border" cellspacing="0" width="100%" cellpadding="3">';
print '<tr><td>Libellé</td><td class="valeur"><input type="text" name="label" size="40" value="'.$adho->attribute_label[$attrname].'"></td></tr>'; print '<tr><td>Libellé</td><td class="valeur"><input type="text" name="label" size="40" value="'.$adho->attribute_label[$_GET["attrname"]].'"></td></tr>';
print '<tr><td>Nom de l\'attribut</td><td class="valeur">'.$attrname.'&nbsp;</td></tr>'; print '<tr><td>Nom de l\'attribut</td><td class="valeur">'.$_GET["attrname"].'&nbsp;</td></tr>';
list($type,$size)=preg_split('/\(|\)/',$adho->attribute_name[$attrname]); list($type,$size)=preg_split('/\(|\)/',$adho->attribute_name[$_GET["attrname"]]);
print '<tr><td>Type (non pris en compte)</td><td class="valeur">'; print '<tr><td>Type</td><td class="valeur">';
$form->select_array('type',array('varchar'=>'chaine', $form->select_array('type',array('varchar'=>'chaine',
'text'=>'texte', 'text'=>'texte',
'integer'=>'entier', 'int'=>'entier',
'date'=>'date', 'date'=>'date',
'datetime'=>'date et heure'),$type); 'datetime'=>'date et heure'),$type);
print '</td></tr>'; print '</td></tr>';
// print '<tr><td>Type (non pris en compte)</td><td class="valeur"><input type="text" name="type" size="40" value="'.$adho->attribute_name[$attrname].'"></td></tr>'; // print '<tr><td>Type (non pris en compte)</td><td class="valeur"><input type="text" name="type" size="40" value="'.$adho->attribute_name[$attrname].'"></td></tr>';
print '<tr><td>taille</td><td class="valeur"><input type="text" name="size" size="5" value="'.$size.'"></td></tr>'; print '<tr><td>Taille</td><td class="valeur"><input type="text" name="size" size="5" value="'.$size.'"></td></tr>';
print '<tr><td colspan="2" align="center"><input type="submit" value="Enregistrer"</td></tr>'; print '<tr><td colspan="2" align="center"><input type="submit" value="Enregistrer"> &nbsp; ';
print '<input type="submit" name="button" value="Annuler"></td></tr>';
print '</table>'; print '</table>';
print "</form>"; print "</form>";

View File

@ -1,6 +1,7 @@
<?PHP <?PHP
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -26,45 +27,43 @@ require(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php");
if ($_POST["action"] == 'add' && $user->admin) if ($_POST["action"] == 'add' && $user->admin)
{ {
if ($_POST["button"] != "Annuler") {
$adht = new AdherentType($db);
$adht->libelle = $_POST["libelle"];
$adht->cotisation = $_POST["cotisation"];
$adht->commentaire = $_POST["comment"];
$adht->mail_valid = $_POST["mail_valid"];
$adht->vote = $_POST["vote"];
$adht = new AdherentType($db); if ($_POST["libelle"]) { $adht->create($user->id); }
$adht->libelle = $_POST["libelle"];
$adht->cotisation = $_POST["cotisation"];
$adht->commentaire = $_POST["comment"];
$adht->mail_valid = $_POST["mail_valid"];
$adht->vote = $_POST["vote"];
if ($adht->create($user->id) )
{
Header("Location: type.php");
} }
Header("Location: type.php");
} }
if ($_POST["action"] == 'update' && $user->admin) if ($_POST["action"] == 'update' && $user->admin)
{ {
if ($_POST["button"] != "Annuler") {
$adht = new AdherentType($db); $adht = new AdherentType($db);
$adht->id = $rowid; $adht->id = $_POST["rowid"];;
$adht->libelle = $_POST["libelle"]; $adht->libelle = $_POST["libelle"];
$adht->cotisation = $_POST["cotisation"]; $adht->cotisation = $_POST["cotisation"];
$adht->commentaire = $_POST["comment"]; $adht->commentaire = $_POST["comment"];
$adht->mail_valid = $_POST["mail_valid"]; $adht->mail_valid = $_POST["mail_valid"];
$adht->vote = $_POST["vote"]; $adht->vote = $_POST["vote"];
if ($adht->update($user->id) ) $adht->update($user->id);
{ }
Header("Location: type.php"); Header("Location: type.php");
}
} }
if ($action == 'delete') if ($_GET["action"] == 'delete')
{ {
$adh = new Adherent($db); $adh = new Adherent($db);
$adh->delete($rowid); $adh->delete($rowid);
Header("Location: liste.php"); Header("Location: liste.php");
} }
if ($action == 'commentaire') if ($_GET["action"] == 'commentaire')
{ {
$don = new Don($db); $don = new Don($db);
$don->set_commentaire($rowid,$_POST["commentaire"]); $don->set_commentaire($rowid,$_POST["commentaire"]);
@ -75,7 +74,8 @@ if ($action == 'commentaire')
llxHeader(); llxHeader();
print_titre("Configuration"); print_titre("Configuration des types d'adhérents");
print '<br>';
/* ************************************************************************** */ /* ************************************************************************** */
/* */ /* */
@ -92,24 +92,24 @@ if ($result)
$num = $db->num_rows(); $num = $db->num_rows();
$i = 0; $i = 0;
print "<TABLE border=\"0\" cellspacing=\"0\" cellpadding=\"4\">"; print "<table class=\"noborder\" cellspacing=\"0\" cellpadding=\"3\">";
print '<TR class="liste_titre">'; print '<tr class="liste_titre">';
print "<td>Id</td>"; print "<td>Id</td>";
print "<td>Libellé</td><td>Cotisation ?</td><td>Vote ?</td><td>&nbsp;</td>"; print "<td>Libellé</td><td>Cotisation ?</td><td>Vote ?</td><td>&nbsp;</td>";
print "</TR>\n"; print "</tr>\n";
$var=True; $var=True;
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object( $i); $objp = $db->fetch_object( $i);
$var=!$var; $var=!$var;
print "<TR $bc[$var]>"; print "<tr $bc[$var]>";
print "<TD>".$objp->rowid."</td>\n"; print "<td>".$objp->rowid."</td>\n";
print '<TD>'.$objp->libelle.'</TD>'; print '<td>'.$objp->libelle.'</td>';
print '<TD>'.$objp->cotisation.'</TD>'; print '<td align="center">'.$objp->cotisation.'</td>';
print '<TD>'.$objp->vote.'</TD>'; print '<td align="center">'.$objp->vote.'</td>';
print '<TD><a href="type.php?action=edit&rowid='.$objp->rowid.'">Editer</TD>'; print '<td><a href="type.php?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</td>';
print "</tr>"; print "</tr>";
$i++; $i++;
} }
@ -140,28 +140,13 @@ else
/* ************************************************************************** */ /* ************************************************************************** */
if ($action == 'create') { if ($_GET["action"] == 'create') {
/*
* $sql = "SELECT s.nom,s.idp, f.amount, f.total, f.facnumber";
* $sql .= " FROM societe as s, ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.idp";
* $sql .= " AND f.rowid = $facid";
* $result = $db->query($sql);
* if ($result) {
* $num = $db->num_rows();
* if ($num) {
* $obj = $db->fetch_object( 0);
*
* $total = $obj->total;
* }
* }
*/
print_titre("Nouveau type"); print_titre("Nouveau type");
print '<br>';
print "<form action=\"$PHP_SELF\" method=\"post\">"; print "<form action=\"$PHP_SELF\" method=\"post\">";
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">'; print '<table cellspacing="0" class="border" width="100%" cellpadding="3">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
@ -183,7 +168,9 @@ if ($action == 'create') {
print '<tr><td valign="top">Mail d\'accueil :</td><td>'; print '<tr><td valign="top">Mail d\'accueil :</td><td>';
print "<textarea name=\"mail_valid\" wrap=\"soft\" cols=\"60\" rows=\"15\"></textarea></td></tr>"; print "<textarea name=\"mail_valid\" wrap=\"soft\" cols=\"60\" rows=\"15\"></textarea></td></tr>";
print '<tr><td colspan="2" align="center"><input type="submit" value="Enregistrer"></td></tr>'; print '<tr><td colspan="2" align="center"><input type="submit" name="button" value="Enregistrer"> &nbsp;';
print '<input type="submit" name="button" value="Annuler"></td></tr>';
print "</form>\n"; print "</form>\n";
print "</table>\n"; print "</table>\n";
@ -194,41 +181,22 @@ if ($action == 'create') {
/* Edition de la fiche */ /* Edition de la fiche */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
if ($rowid > 0 && $action == 'edit') if ($_GET["rowid"] > 0 && $_GET["action"] == 'edit')
{ {
$adht = new AdherentType($db); $adht = new AdherentType($db);
$adht->id = $rowid; $adht->id = $_GET["rowid"];
$adht->fetch($rowid); $adht->fetch($_GET["rowid"]);
print_titre("Edition de la fiche"); print_titre("Edition de la fiche");
print "<form action=\"$PHP_SELF\" method=\"post\">"; print '<br>';
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
print '<tr><td>Libellé</td><td class="valeur">'.$adht->libelle.'&nbsp;</td></tr>';
print '<tr><td>Soumis à cotisation</td><td class="valeur">'.$adht->cotisation.'&nbsp;</td></tr>';
print '<tr><td>Droit de vote</td><td class="valeur">'.$adht->vote.'&nbsp;</td></tr>';
print '<tr><td valign="top">Commentaires</td>';
print '<td valign="top" width="75%" class="valeur">';
print nl2br($adht->commentaire).'&nbsp;</td></tr>';
print '<tr><td valign="top">Mail d\'accueil</td>';
print '<td valign="top" width="75%" class="valeur">';
print nl2br($adht->mail_valid).'&nbsp;</td></tr>';
print "</table>\n";
/* /*
*
* *
* *
*/ */
print '<form method="post" action="'.$PHP_SELF.'?rowid='.$rowid.'">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?rowid='.$_GET["rowid"].'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">'; print '<input type="hidden" name="rowid" value="'.$_GET["rowid"].'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">'; print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
@ -251,7 +219,9 @@ if ($rowid > 0 && $action == 'edit')
print '<tr><td valign="top">Mail d\'accueil :</td><td>'; print '<tr><td valign="top">Mail d\'accueil :</td><td>';
print "<textarea name=\"mail_valid\" wrap=\"soft\" cols=\"60\" rows=\"15\">".$adht->mail_valid."</textarea></td></tr>"; print "<textarea name=\"mail_valid\" wrap=\"soft\" cols=\"60\" rows=\"15\">".$adht->mail_valid."</textarea></td></tr>";
print '<tr><td colspan="2" align="center"><input type="submit" value="Enregistrer"</td></tr>'; print '<tr><td colspan="2" align="center"><input type="submit" value="Enregistrer"> &nbsp;';
print '<input type="submit" name="button" value="Annuler"></td></tr>';
print '</table>'; print '</table>';
print "</form>"; print "</form>";