diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index f544797d1b7..7b78756486f 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -599,10 +599,10 @@ if ($action == 'edit') print ""; print "statut."\">"; - print ''; - $htmls = new Form($db); + print '
'; + // Ref print ''; @@ -636,10 +636,10 @@ if ($action == 'edit') print ''; // Login - print ''; + print ''; // Password - print ''; + print ''; // Type print ''; print '
'.$langs->trans("Ref").''.$adh->id.' 
'.$langs->trans("Login").'*
'.$langs->trans("Login").'*
'.$langs->trans("Password").'*
'.$langs->trans("Password").'*
'.$langs->trans("Type").'*'; @@ -703,6 +703,7 @@ if ($action == 'edit') print '
'; + print ''; print ''; diff --git a/htdocs/public/adherents/index.php b/htdocs/public/adherents/index.php index 83c297e6010..68158747d9a 100644 --- a/htdocs/public/adherents/index.php +++ b/htdocs/public/adherents/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2006 Laurent Destailleur + * Copyright (C) 2006-2007 Laurent Destailleur * * 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 diff --git a/htdocs/public/adherents/new.php b/htdocs/public/adherents/new.php index 61410858753..af1bafd1128 100644 --- a/htdocs/public/adherents/new.php +++ b/htdocs/public/adherents/new.php @@ -2,6 +2,7 @@ /* Copyright (C) 2001-2002 Rodolphe Quiedeville * Copyright (C) 2001-2002 Jean-Louis Bergamo * Copyright (C) 2006-2007 Laurent Destailleur + * * 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 @@ -28,9 +29,9 @@ */ require("./pre.inc.php"); -require(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php"); -require(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php"); -require(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php"); +require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php"); +require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php"); +require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php"); $adho = new AdherentOptions($db); $errmsg=''; diff --git a/htdocs/public/adherents/priv_edit.php b/htdocs/public/adherents/priv_edit.php index e3e6fcfc5dd..58768aee803 100644 --- a/htdocs/public/adherents/priv_edit.php +++ b/htdocs/public/adherents/priv_edit.php @@ -1,6 +1,7 @@ * Copyright (C) 2001-2002 Jean-Louis Bergamo + * Copyright (C) 2007 Laurent Destailleur * * 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 @@ -20,234 +21,255 @@ * $Source$ */ +/** + \file htdocs/public/adherents/priv_edit.php + \ingroup adherent + \brief Page edition de sa fiche adherent + \version $Revision$ +*/ + require("./pre.inc.php"); -require(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php"); -require(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php"); -require(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php"); +require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php"); +require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php"); +require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php"); $adho = new AdherentOptions($db); +$langs->load("companies"); +$langs->load("main"); +$langs->load("other"); +$langs->load("users"); + $errmsg=''; $num=0; $error=0; + + /* - * Enregistrer les modifs + * Actions */ if ($action == 'update') { - if ($_POST["bouton"] == $langs->trans("Save")) - { - if (isset($user->login)){ - $adh = new Adherent($db); - $adh->fetch_login($user->login); - if ($_POST["rowid"] == $adh->id){ - // user and rowid is the same => good + if ($_POST["bouton"] == $langs->trans("Save")) + { + if (isset($user->login)){ + $adh = new Adherent($db); + $adh->fetch_login($user->login); + if ($_POST["rowid"] == $adh->id){ + // user and rowid is the same => good - // test some values - // test si le login existe deja - $sql = "SELECT rowid,login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$user->login."';"; - $result = $db->query($sql); - if ($result) { - $num = $db->num_rows(); - } - if (!isset($nom) || !isset($prenom) || $prenom=='' || $nom==''){ - $error+=1; - $errmsg .="Nom et Prenom obligatoires
\n"; - } - if (!isset($email) || $email == '' || !ereg('@',$email)){ - $error+=1; - $errmsg .="Adresse Email invalide
\n"; - } - if ($num !=0){ - $obj=$db->fetch_object(0); - if ($obj->rowid != $adh->id){ - $error+=1; - $errmsg .="Login deja utilise. Veuillez en changer
\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)
\n"; - } - } - if (!$error){ - // email a peu pres correct et le login n'existe pas - $adh->id = $_POST["rowid"]; - $adh->prenom = $prenom; - $adh->nom = $nom; - $adh->societe = $societe; - $adh->adresse = $adresse; - $adh->amount = $amount; - $adh->cp = $cp; - $adh->ville = $_POST["ville"]; - $adh->email = $_POST["email"]; - // interdiction de la modif du login adherent - // $adh->login = $_POST["login"]; - $adh->login = $adh->login; - $adh->pass = $_POST["pass"]; - $adh->naiss = $_POST["naiss"]; - $adh->photo = $_POST["photo"]; - $adh->date = mktime(12, 0 , 0, $remonth, $reday, $reyear); - $adh->note = $_POST["note"]; - $adh->pays = $_POST["pays"]; - $adh->typeid = $_POST["type"]; - $adh->commentaire = $_POST["comment"]; - $adh->morphy = $_POST["morphy"]; - // recuperation du statut et public - $adh->statut = $_POST["statut"]; - if (isset($public)){ - $public=1; - }else{ - $public=0; - } - $adh->public = $public; - foreach($_POST as $key => $value){ - if (ereg("^options_",$key)){ - $adh->array_options[$key]=$_POST[$key]; - } - } - if ($adh->update($user->id) ) - { - $adh->send_an_email($email,$conf->adherent->email_edit,$conf->adherent->email_edit_subject); - //Header("Location: fiche.php?rowid=$adh->id&action=edit"); - Header("Location: priv_edit.php"); - } - } - }else{ - Header("Location: priv_edit.php"); + // test some values + // test si le login existe deja + $sql = "SELECT rowid,login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$user->login."';"; + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows(); + } + if (!isset($nom) || !isset($prenom) || $prenom=='' || $nom==''){ + $error+=1; + $errmsg .="Nom et Prenom obligatoires
\n"; + } + if (!isset($email) || $email == '' || !ereg('@',$email)){ + $error+=1; + $errmsg .="Adresse Email invalide
\n"; + } + if ($num !=0){ + $obj=$db->fetch_object(0); + if ($obj->rowid != $adh->id){ + $error+=1; + $errmsg .="Login deja utilise. Veuillez en changer
\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)
\n"; + } + } + if (!$error){ + // email a peu pres correct et le login n'existe pas + $adh->id = $_POST["rowid"]; + $adh->prenom = $prenom; + $adh->nom = $nom; + $adh->societe = $societe; + $adh->adresse = $adresse; + $adh->amount = $amount; + $adh->cp = $cp; + $adh->ville = $_POST["ville"]; + $adh->email = $_POST["email"]; + // interdiction de la modif du login adherent + // $adh->login = $_POST["login"]; + $adh->login = $adh->login; + $adh->pass = $_POST["pass"]; + $adh->naiss = $_POST["naiss"]; + $adh->photo = $_POST["photo"]; + $adh->date = mktime(12, 0 , 0, $remonth, $reday, $reyear); + $adh->note = $_POST["note"]; + $adh->pays = $_POST["pays"]; + $adh->typeid = $_POST["type"]; + $adh->commentaire = $_POST["comment"]; + $adh->morphy = $_POST["morphy"]; + // recuperation du statut et public + $adh->statut = $_POST["statut"]; + if (isset($public)){ + $public=1; + }else{ + $public=0; + } + $adh->public = $public; + foreach($_POST as $key => $value){ + if (ereg("^options_",$key)){ + $adh->array_options[$key]=$_POST[$key]; + } + } + if ($adh->update($user->id) ) + { + $adh->send_an_email($email,$conf->adherent->email_edit,$conf->adherent->email_edit_subject); + //Header("Location: fiche.php?rowid=$adh->id&action=edit"); + Header("Location: priv_edit.php"); + } + } + }else{ + Header("Location: priv_edit.php"); + } + } + } + else + { + //Header("Location: fiche.php?rowid=$rowid&action=edit"); + Header("Location: priv_edit.php"); } - } - } - else - { - //Header("Location: fiche.php?rowid=$rowid&action=edit"); - Header("Location: priv_edit.php"); - } } llxHeaderVierge(); -if (isset($user->login)) +if (isset($_GET["id"])) { + $adh = new Adherent($db); + $result=$adh->fetch($_GET["id"]); + $adh->fetch_optionals($adh->id); + // fetch optionals attibutes + $adho->fetch_optionals(); - $adh = new Adherent($db); - $adh->login = $user->login; - $adh->fetch_login($user->login); - $adh->fetch_optionals($adh->id); - // fetch optionals attibutes - $adho->fetch_optionals(); + $adht = new AdherentType($db); - $adht = new AdherentType($db); + print_titre("Edition de la fiche adhérent de $adh->prenom $adh->nom"); - print_titre("Edition de la fiche adhérent de $adh->prenom $adh->nom"); + if ($errmsg != ''){ + print ''; + + print ''; + print "\n"; + // print "$errmsg\n"; + print '
Erreur dans le formulaire
$errmsg
'; + } - if ($errmsg != ''){ - print ''; - - print ''; - print "\n"; - // print "$errmsg\n"; - print '
Erreur dans le formulaire
$errmsg
'; - } + // Formulaire modifications + print '
'; + print ""; + print "id\">"; + print "statut."\">"; + print "login."\">"; + print "typeid."\">"; + print "morphy."\">"; + // print "public."\">"; - print ''; + $htmls = new Form($db); + $caneditfield=1; + + print '
'; - print ''; - print ''; + // Nom + print ''; - print ''; - print ''; + // Photo + $rowspan=14; + $rowspan+=sizeof($adho->attribute_label); + print ''; + print ''; + + // Prenom + print ''; + print ''; + + // Login +// print ''; + print ''; + + // Password + print ''; - print ''; + // Société + print ''; - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - if ($adh->public==1){ - print ''; - }else{ - print ''; - } - foreach($adho->attribute_label as $key=>$value){ - print "\n"; - } + // Adresse + print ''; - print "
'.$langs->trans("Type").''.$adh->type.''.$langs->trans("Comments").'
'.$langs->trans("Lastname").'*
Personne'.$adh->morphy.' '; - print nl2br($adh->commentaire).' 
'; + if (file_exists($conf->adherent->dir_output."/".$adh->id.".jpg")) + { + print ''; + } + else + { + print ''; + } + if ($caneditfield) + { + print '

'; + print '
'.$langs->trans("PhotoFile").'
'; + print ''; + print '
'; + } + print '
'.$langs->trans("Firstname").'*
'.$langs->trans("Login").'*
'.$langs->trans("Login").'*'.$adh->login.'
'.$langs->trans("Password").'*
Prénom'.$adh->prenom.' 
'.$langs->trans("Company").'
Nom'.$adh->nom.' 
Société'.$adh->societe.' 
Adresse'.nl2br($adh->adresse).' 
CP Ville'.$adh->cp.' '.$adh->ville.' 
Pays'.$adh->pays.' 
Email'.$adh->email.' 
Login'.$adh->login.' 
Password'.$adh->pass.' 
Date de naissance
Format AAAA-MM-JJ
'.$adh->naiss.' 
URL Photo'.$adh->photo.' 
Profil public ? Oui
Profil public ? Non
$value".$adh->array_options["options_$key"]." 
'.$langs->trans("Address").''; + print '
\n"; + // Cp + print ''.$langs->trans("Zip").'/'.$langs->trans("Town").' '; - print "
"; + // Pays + print ''.$langs->trans("Country").''; + $htmls->select_pays($adh->pays_code?$adh->pays_code:$mysoc->pays_code,'pays'); + print ''; - print ""; - print ''; - - print ""; - print "id\">"; - print "statut."\">"; - print "login."\">"; - // print "public."\">"; + // Tel + print ''; - $htmls = new Form($db); + // Tel perso + print ''; + // Tel mobile + print ''; - print '"; + // EMail + print ''; - print ''; + // Date naissance + print "\n"; - $morphys["phy"] = "Physique"; - $morphys["mor"] = "Morale"; + // Profil public + print "\n"; - print ""; + // Attributs supplémentaires + foreach($adho->attribute_label as $key=>$value) + { + print "\n"; + } - print ''; - - print ''; - - print ''; + print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - // print ''; - print ''; - print ''; - print ''; - if ($adh->public==1){ - print ''; - }else{ - print ''; - } - foreach($adho->attribute_label as $key=>$value){ - print "\n"; - } - print ''; - print ''; - print '
'.$langs->trans("PhonePro").'
'.$langs->trans("PhonePerso").'
'.$langs->trans("PhoneMobile").'
'.$langs->trans("Type").''; - $htmls->select_array("type", $adht->liste_array(), $adh->typeid); - print "
'.$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'*':'').'
'.$langs->trans("Comments").'
".$langs->trans("Birthday")."\n"; + $htmls->select_date(($adh->naiss ? $adh->naiss : -1),'naiss','','',1,'update'); + print "
".$langs->trans("Public")."\n"; + print $htmls->selectyesno("public",$adh->public,1); + print "
Personne"; - $htmls->select_array("morphy", $morphys, $adh->morphy); - print "
$valuearray_options["options_$key"]."\">
'; - print '
Prénom
Nom
'; + print ''; +// print '       '; +// print ''; + print '
Societe
Adresse'; - print '
CP Ville
Pays
Email
Login'.$adh->login.' 
Login
Password
Date de naissance
Format AAAA-MM-JJ
URL photo
Profil public ?
Profil public ?
$valuearray_options["options_$key"]."\">
'; - print ' '; - print ''; - print '
'; - + print ''; + + print ''; } $db->close(); diff --git a/htdocs/public/adherents/priv_fiche.php b/htdocs/public/adherents/priv_fiche.php index 10a73e5f5f8..3b68b36bb7a 100644 --- a/htdocs/public/adherents/priv_fiche.php +++ b/htdocs/public/adherents/priv_fiche.php @@ -1,6 +1,7 @@ * Copyright (C) 2002-2003 Jean-Louis Bergamo + * Copyright (C) 2007 Laurent Destailleur * * 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 @@ -18,14 +19,14 @@ * * $Id$ * $Source$ - * */ + 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/cotisation.class.php"); -require(DOL_DOCUMENT_ROOT."/paiement.class.php"); -require(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php"); +require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php"); +require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php"); +require_once(DOL_DOCUMENT_ROOT."/adherents/cotisation.class.php"); +require_once(DOL_DOCUMENT_ROOT."/paiement.class.php"); +require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php"); $adho = new AdherentOptions($db); diff --git a/htdocs/public/adherents/priv_liste.php b/htdocs/public/adherents/priv_liste.php index f1970248c01..103c9f15c65 100644 --- a/htdocs/public/adherents/priv_liste.php +++ b/htdocs/public/adherents/priv_liste.php @@ -1,7 +1,7 @@ * Copyright (C) 2002-2003 Jean-Louis Bergamo - * Copyright (C) 2004-2006 Laurent Destailleur + * Copyright (C) 2004-2007 Laurent Destailleur * * 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