From 359586449abf066fab3401b2fffb877aebfb7cbc Mon Sep 17 00:00:00 2001 From: jlb Date: Mon, 13 Jan 2003 17:01:30 +0000 Subject: [PATCH] rajout du support d'un login/mot de passe pour acces ades futurs interfaces par utilisateur. ajout d'un formulaire new pour adhesion libre. tout ceci est a tester :-)) --- htdocs/adherent.class.php | 21 +- htdocs/adherents/edit.php | 4 + htdocs/adherents/fiche.php | 7 +- htdocs/adherents/public/new.php | 413 ++++++++++++++++++++++++++++++++ 4 files changed, 442 insertions(+), 3 deletions(-) create mode 100644 htdocs/adherents/public/new.php diff --git a/htdocs/adherent.class.php b/htdocs/adherent.class.php index 8b252812da4..b14b514f7c5 100644 --- a/htdocs/adherent.class.php +++ b/htdocs/adherent.class.php @@ -1,6 +1,6 @@ - * + * Jean-Louis Bergamo * 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 @@ -37,6 +37,8 @@ class Adherent var $public; var $commentaire; var $statut; + var $login; + var $pass; var $errorstr; /* @@ -103,6 +105,17 @@ class Adherent $err++; } + if (strlen(trim($this->login)) == 0) + { + $error_string[$err] = "Le login saisi est invalide"; + $err++; + } + + if (strlen(trim($this->pass)) == 0) + { + $error_string[$err] = "Le pass saisi est invalide"; + $err++; + } $this->amount = trim($this->amount); $map = range(0,9); @@ -200,6 +213,8 @@ class Adherent $sql .= ",pays='".$this->pays."'"; $sql .= ",note='".$this->commentaire."'"; $sql .= ",email='".$this->email."'"; + $sql .= ",login='".$this->login."'"; + $sql .= ",pass='".$this->pass."'"; $sql .= ",statut=".$this->statut; $sql .= ",fk_adherent_type=".$this->typeid; $sql .= ",morphy='".$this->morphy."'"; @@ -260,7 +275,7 @@ class Adherent */ Function fetch($rowid) { - $sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, d.statut, d.adresse, d.cp, d.ville, d.pays, d.note, d.email, d.fk_adherent_type, d.morphy, t.libelle as type"; + $sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, d.statut, d.adresse, d.cp, d.ville, d.pays, d.note, d.email, d.login, d.pass, d.fk_adherent_type, d.morphy, t.libelle as type"; $sql .= ",".$this->db->pdate("d.datefin")." as datefin"; $sql .= " FROM llx_adherent as d, llx_adherent_type as t"; $sql .= " WHERE d.rowid = $rowid AND d.fk_adherent_type = t.rowid"; @@ -284,6 +299,8 @@ class Adherent $this->cp = stripslashes($obj->cp); $this->ville = stripslashes($obj->ville); $this->email = stripslashes($obj->email); + $this->login = stripslashes($obj->login); + $this->pass = stripslashes($obj->pass); $this->pays = stripslashes($obj->pays); $this->datefin = $obj->datefin; $this->commentaire = stripslashes($obj->note); diff --git a/htdocs/adherents/edit.php b/htdocs/adherents/edit.php index 937d6d32d06..c12fa0f4d2a 100644 --- a/htdocs/adherents/edit.php +++ b/htdocs/adherents/edit.php @@ -46,6 +46,8 @@ if ($action == 'update') $adh->cp = $cp; $adh->ville = $HTTP_POST_VARS["ville"]; $adh->email = $HTTP_POST_VARS["email"]; + $adh->login = $HTTP_POST_VARS["login"]; + $adh->pass = $HTTP_POST_VARS["pass"]; $adh->date = mktime(12, 0 , 0, $remonth, $reday, $reyear); $adh->note = $HTTP_POST_VARS["note"]; $adh->pays = $HTTP_POST_VARS["pays"]; @@ -114,6 +116,8 @@ if ($rowid) print 'CP Ville'.$adh->cp.' '.$adh->ville.' '; print 'Pays'.$adh->pays.' '; print 'Email'.$adh->email.' '; + print 'Login'.$adh->login.' '; + print 'Password'.$adh->pass.' '; print "\n"; diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index 52e0281a329..212e16be823 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -52,6 +52,8 @@ if ($HTTP_POST_VARS["action"] == 'add') $adh->cp = $cp; $adh->ville = $ville; $adh->email = $email; + $adh->login = $login; + $adh->pass = $pass; $adh->note = $note; $adh->pays = $pays; $adh->typeid = $type; @@ -149,7 +151,8 @@ if ($action == 'create') { print 'CP Ville '; print 'Pays'; print 'Email'; - + print 'Login'; + print 'Password'; print "Date de cotisation\n"; print_date_select(); @@ -283,6 +286,8 @@ if ($rowid > 0) print 'CP Ville'.$adh->cp.' '.$adh->ville.' '; print 'Pays'.$adh->pays.' '; print 'Email'.$adh->email.' '; + print 'Login'.$adh->login.' '; + print 'Pass'.$adh->pass.' '; print "\n"; diff --git a/htdocs/adherents/public/new.php b/htdocs/adherents/public/new.php new file mode 100644 index 00000000000..6e4066693fd --- /dev/null +++ b/htdocs/adherents/public/new.php @@ -0,0 +1,413 @@ + + * Jean-Louis Bergamo + * 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$ + * + */ +require("../pre.inc.php"); +require("../../adherent.class.php"); +require("../../adherent_type.class.php"); +require("../../cotisation.class.php"); +require("../../paiement.class.php"); + + +$db = new Db(); + +if ($HTTP_POST_VARS["action"] == 'add') +{ + + $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->note = $note; + $adh->pays = $pays; + $adh->typeid = $type; + $adh->commentaire = $HTTP_POST_VARS["comment"]; + $adh->morphy = $HTTP_POST_VARS["morphy"]; + + if ($adh->create($user->id) ) + { + if ($cotisation > 0) + { + $adh->cotisation(mktime(12, 0 , 0, $remonth, $reday, $reyear), $cotisation); + } + Header("Location: new.php"); + } +} + +//llxHeader(); +// Header +print ""; +print ''; +print ''; +print "\n"; +print 'Dolibarr'; +print "\n"; + + +print "\n"; + +print ''; + +print ''; + +print '
'; + +/* ************************************************************************** */ +/* */ +/* Création d'une fiche */ +/* */ +/* ************************************************************************** */ + + +if ($action == 'create') { + + $sql = "SELECT s.nom,s.idp, f.amount, f.total, f.facnumber"; + $sql .= " FROM societe as s, llx_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("Nouvel adhérent"); + print "
\n"; + print ''; + + print ''; + + $htmls = new Form($db); + $adht = new AdherentType($db); + + print '\n"; + + print ''; + + $morphys["phy"] = "Physique"; + $morphys["mor"] = "Morale"; + + print "\n"; + + print ''; + + print ''; + + + + + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + + print ''; + print "\n"; + print "
Type'; + $htmls->select_array("type", $adht->liste_array()); + print "Commentaires :
Personne\n"; + $htmls->select_array("morphy", $morphys); + print "
Prénom
Nom
Societe
Adresse'; + print '
CP Ville
Pays
Email
Login
Password
\n"; + + +} +/* ************************************************************************** */ +/* */ +/* Edition de la fiche */ +/* */ +/* ************************************************************************** */ +if ($rowid > 0) +{ + + $adh = new Adherent($db); + $adh->id = $rowid; + $adh->fetch($rowid); + + print_titre("Edition de la fiche adhérent"); + + /* + * Confirmation de la suppression de l'adhérent + * + */ + + if ($action == 'delete') + { + + print '
'; + print ''; + print ''; + + print ''; + print "\n"; + + print '\n"; + print ''; + print '
Supprimer un adhérent
La suppression d'un adhérent entraine la suppression de toutes ses cotisations !!!
Etes-vous sur de vouloir supprimer cet adhérent ?'; + $htmls = new Form($db); + + $htmls->selectyesno("confirm","no"); + + print "
'; + print "
\n"; + } + + + /* + * Confirmation de la validation + * + */ + + if ($action == 'valid') + { + + print '
'; + print ''; + print ''; + + print ''; + + print '\n"; + print ''; + print '
Valider un adhérent
Etes-vous sur de vouloir valider cet adhérent ?'; + $htmls = new Form($db); + + $htmls->selectyesno("confirm","no"); + + print "
'; + print "
\n"; + } + + /* + * Confirmation de la Résiliation + * + */ + + if ($action == 'resign') + { + + print '
'; + print ''; + print ''; + + print ''; + + print '\n"; + print ''; + print '
Résilier une adhésion
Etes-vous sur de vouloir résilier cette adhésion ?'; + $htmls = new Form($db); + + $htmls->selectyesno("confirm","no"); + + print "
'; + print "
\n"; + } + + + print "
\n"; + print ''; + + print "\n"; + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + + + print ''; + print ''; + print ''; + print ''; + print ''; + + print "
Type$adh->typeCommentaires
Personne'.$adh->morphy.' '; + print nl2br($adh->commentaire).' 
Prénom'.$adh->prenom.' 
Nom'.$adh->nom.' 
Société'.$adh->societe.' 
Adresse'.nl2br($adh->adresse).' 
CP Ville'.$adh->cp.' '.$adh->ville.' 
Pays'.$adh->pays.' 
Email'.$adh->email.' 
\n"; + + + if ($user->admin) + { + + print "

\n"; + + /* + * Case 1 + */ + + print ''; + + /* + * Case 2 + */ + + if ($adh->statut < 1) + { + print "\n"; + } + else + { + print "\n"; + } + /* + * Case 3 + */ + if ($adh->statut == 1) + { + print "\n"; + } + else + { + print "\n"; + } + + /* + * Case 4 + */ + + print "\n"; + + + print "
[Editer][Valider l'adhésion]-[Résilier l'adhésion]-[id&action=delete\">Supprimer]

\n"; + } + + /* + * + * Liste des cotisations + * + */ + $sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, c.cotisation, ".$db->pdate("c.dateadh")." as dateadh"; + $sql .= " FROM llx_adherent as d, llx_cotisation as c"; + $sql .= " WHERE d.rowid = c.fk_adherent AND d.rowid=$rowid"; + + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows(); + $i = 0; + + print "\n"; + + print ''; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + print ''; + print ""; + $i++; + } + print "
CotisationsDateMontant
 ".strftime("%d %B %Y",$objp->dateadh)."'.price($objp->cotisation).'
"; + } + else + { + print $sql; + print $db->error(); + } + + /* + * Ajout d'une nouvelle cotis + * + * + */ + if ($user->admin) + { + print '

'; + print ''; + print ''; + + print ''; + + print ''; + + print ''; + if ($adh->datefin < time()) + { + print ''; + + print ''; + + print ''; + + print ""; + print "\n"; + print ''; + print ''; + print '
'; + + print 'Fin adhésion'; + } + else + { + print ''; + } + print strftime("%d %B %Y",$adh->datefin).'  
Nouvelle adhésion
Date de cotisation\n"; + if ($adh->datefin > 0) + { + print_date_select($adh->datefin + (3600*24)); + } + else + { + print_date_select(); + } + print "
Mode de paiement\n"; + + $paiement = new Paiement($db); + + $paiement->select("modepaiement","crédit"); + + print " 
Cotisation euros
'; + print "
\n"; + } + + +} + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?>