* Copyright (C) 2002 Jean-Louis Bergamo * Copyright (C) 2004 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 * (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$ * */ /*! \file htdocs/adherents/edit.php \ingroup adherent \brief Page d'edition d'un 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"); $action=isset($_GET["action"])?$_GET["action"]:$_POST["action"]; $rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"]; /* * Enregistrer les modifs */ if ($action == 'update') { if ($_POST["bouton"] == $langs->trans("Save")) { $adh = new Adherent($db); $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"]; $adh->login = $_POST["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"]; $adh->public = $_POST["public"]; foreach($_POST as $key => $value){ if (ereg("^options_",$key)){ $adh->array_options[$key]=$_POST[$key]; } } if ($adh->update($user->id) ) { Header("Location: fiche.php?rowid=$adh->id&action=edit"); } else { Header("Location: edit.php?rowid=$adh->id"); } } else { Header("Location: fiche.php?rowid=$rowid&action=edit"); } } llxHeader(); if ($rowid) { $adho = new AdherentOptions($db); $adh = new Adherent($db); $adh->id = $rowid; $adh->fetch($rowid); // fetch optionals value $adh->fetch_optionals($rowid); // fetch optionals attributes and labels $adho->fetch_optionals(); $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($result); $total = $obj->total; } } $adht = new AdherentType($db); print_titre("Edition de la fiche adhérent"); print "
"; print ''; print ""; print ""; print "statut."\">"; print "public."\">"; $htmls = new Form($db); print '"; print ''; $morphys["phy"] = "Physique"; $morphys["mor"] = "Morale"; print ""; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; // $myattr=$adho->fetch_name_optionals(); foreach($adho->attribute_label as $key=>$value){ // foreach($myattr as $key){ print "\n"; } print ''; print ''; print '
'.$langs->trans("Type").''; $htmls->select_array("type", $adht->liste_array(), $adh->typeid); print "'.$langs->trans("Comments").'
Personne"; $htmls->select_array("morphy", $morphys, $adh->morphy); print "'; print '
Prénom
Nom
Societe
Adresse'; print '
CP Ville
Pays
Email
Login
Password
Date de naissance
Format AAAA-MM-JJ
URL photo
$valuearray_options["options_$key"]."\">
'; print ' '; print ''; print '
'; } $db->close(); llxFooter("Dernière modification $Date$ révision $Revision$"); ?>