[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/adherents/ -> edit.php (source)

   1  <?php
   2  /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2002      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: edit.php,v 1.28 2005/09/06 20:58:15 eldy Exp $
  21   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/adherents/edit.php,v $
  22   */
  23  
  24  /** 
  25          \file       htdocs/adherents/edit.php
  26          \ingroup    adherent
  27          \brief      Page d'edition d'un adherent
  28          \version    $Revision: 1.28 $
  29  */
  30  
  31  require ("./pre.inc.php");
  32  require (DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
  33  require(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php");
  34  require(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php");
  35  
  36  $langs->load("members");
  37  
  38  
  39  $action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
  40  $rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"];
  41  
  42  /* 
  43   * Enregistrer les modifs
  44   */
  45  
  46  if ($action == 'update')
  47  {
  48  
  49    if ($_POST["bouton"] == $langs->trans("Save"))
  50      {
  51  
  52        $adh = new Adherent($db);
  53  
  54        $adh->id          = $_POST["rowid"];
  55        $adh->prenom      = $_POST["prenom"];
  56        $adh->nom         = $_POST["nom"];
  57        $adh->societe     = $_POST["societe"];
  58        $adh->adresse     = $_POST["adresse"];
  59        $adh->amount      = $_POST["amount"];
  60        $adh->cp          = $_POST["cp"];
  61        $adh->ville       = $_POST["ville"];
  62        $adh->email       = $_POST["email"];
  63        $adh->login       = $_POST["login"];
  64        $adh->pass        = $_POST["pass"];
  65        $adh->naiss       = $_POST["naiss"];
  66        $adh->photo       = $_POST["photo"];
  67        $adh->date        = mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
  68        $adh->note        = $_POST["note"];
  69        $adh->pays        = $_POST["pays"];
  70        $adh->typeid      = $_POST["type"];
  71        $adh->commentaire = $_POST["comment"];
  72        $adh->morphy      = $_POST["morphy"];
  73        // recuperation du statut et public
  74        $adh->statut      = $_POST["statut"];
  75        $adh->public      = $_POST["public"];
  76        
  77        foreach($_POST as $key => $value){
  78      if (ereg("^options_",$key)){
  79        $adh->array_options[$key]=$_POST[$key];
  80      }
  81        }
  82        if ($adh->update($user->id) ) 
  83      {      
  84        Header("Location: fiche.php?rowid=$adh->id&action=edit");
  85      }
  86        else
  87      {
  88        Header("Location: edit.php?rowid=$adh->id");
  89      }
  90  
  91      }
  92    else
  93      {
  94        Header("Location: fiche.php?rowid=$rowid&action=edit");
  95      }
  96  }
  97  
  98  
  99  llxHeader();
 100  
 101  
 102  if ($rowid)
 103  {
 104  
 105    $adho = new AdherentOptions($db);
 106    $adh = new Adherent($db);
 107    $adh->id = $rowid;
 108    $adh->fetch($rowid);
 109    // fetch optionals value
 110    $adh->fetch_optionals($rowid);
 111    // fetch optionals attributes and labels
 112    $adho->fetch_optionals();
 113  
 114    $sql = "SELECT s.nom,s.idp, f.amount, f.total, f.facnumber";
 115    $sql .= " FROM societe as s, ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.idp";
 116    $sql .= " AND f.rowid = $facid";
 117  
 118    $result = $db->query($sql);
 119    if ($result) {
 120      $num = $db->num_rows();
 121      if ($num) {
 122        $obj = $db->fetch_object($result);
 123  
 124        $total = $obj->total;
 125      }
 126    }
 127  
 128    $adht = new AdherentType($db);
 129  
 130  
 131      /*
 132       * Affichage onglets
 133       */
 134      $h = 0;
 135  
 136      $head[$h][0] = DOL_URL_ROOT.'/adherents/fiche.php?rowid='.$rowid;
 137      $head[$h][1] = $langs->trans("MemberCard");
 138      $hselected=$h;
 139      $h++;
 140  
 141      dolibarr_fiche_head($head, $hselected, $adh->fullname);
 142  
 143  
 144    print "<form action=\"edit.php\" method=\"post\">";
 145    print '<table class="border" width="100%">';
 146    
 147    print "<input type=\"hidden\" name=\"action\" value=\"update\">";
 148    print "<input type=\"hidden\" name=\"rowid\" value=\"$rowid\">";
 149    print "<input type=\"hidden\" name=\"statut\" value=\"".$adh->statut."\">";
 150    print "<input type=\"hidden\" name=\"public\" value=\"".$adh->public."\">";
 151  
 152    $htmls = new Form($db);
 153  
 154  
 155    print '<tr><td>'.$langs->trans("Type").'</td><td>';
 156    $htmls->select_array("type",  $adht->liste_array(), $adh->typeid);
 157    print "</td>";
 158  
 159    print '<td valign="top" width="50%">'.$langs->trans("Comments").'</td></tr>';
 160  
 161    $morphys["phy"] = $langs->trans("Physical");
 162    $morphys["mor"] = $langs->trans("Morale");
 163  
 164    print "<tr><td>".$langs->trans("Person")."</td><td>";
 165    $htmls->select_array("morphy",  $morphys, $adh->morphy);
 166    print "</td>";
 167  
 168    print '<td rowspan="15" valign="top">';
 169    print '<textarea name="comment" wrap="soft" cols="40" rows="15">'.$adh->commentaire.'</textarea></td></tr>';
 170    
 171    print '<tr><td width="15%">'.$langs->trans("Firstname").'</td><td width="35%"><input type="text" name="prenom" size="40" value="'.$adh->prenom.'"></td></tr>';
 172    
 173    print '<tr><td>'.$langs->trans("Name").'</td><td><input type="text" name="nom" size="40" value="'.$adh->nom.'"></td></tr>';
 174  
 175  
 176    print '<tr><td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" size="40" value="'.$adh->societe.'"></td></tr>';
 177    print '<tr><td>'.$langs->trans("Address").'</td><td>';
 178    print '<textarea name="adresse" wrap="soft" cols="40" rows="2">'.$adh->adresse.'</textarea></td></tr>';
 179    print '<tr><td>'.$langs->trans("Zip").'/'.$langs->trans("Town").'</td><td><input type="text" name="cp" size="6" value="'.$adh->cp.'"> <input type="text" name="ville" size="20" value="'.$adh->ville.'"></td></tr>';
 180    print '<tr><td>'.$langs->trans("Country").'</td><td>';
 181    $htmls->select_pays($adh->pays_id?$adh->pays_id:MAIN_INFO_SOCIETE_PAYS,'pays');
 182    print '</td></tr>';
 183    print '<tr><td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" size="40" value="'.$adh->email.'"></td></tr>';
 184    print '<tr><td>'.$langs->trans("Login").'</td><td><input type="text" name="login" size="40" value="'.$adh->login.'"></td></tr>';
 185    print '<tr><td>'.$langs->trans("Password").'</td><td><input type="password" name="pass" size="40" value="'.$adh->pass.'"></td></tr>';
 186    print '<tr><td>'.$langs->trans("Birthday").'</td><td><input type="text" name="naiss" size="10" value="'.$adh->naiss.'"> ('.$langs->trans("DateFormatYYYYMMDD").')</td></tr>';
 187    print '<tr><td>URL photo</td><td><input type="text" name="photo" size="40" value="'.$adh->photo.'"></td></tr>';
 188    //  $myattr=$adho->fetch_name_optionals();
 189    foreach($adho->attribute_label as $key=>$value){
 190      //  foreach($myattr as $key){
 191      print "<tr><td>$value</td><td><input type=\"text\" name=\"options_$key\" size=\"40\" value=\"".$adh->array_options["options_$key"]."\"></td></tr>\n";
 192    }
 193    print '<tr><td colspan="2" align="center">';
 194    print '<input type="submit" class="button" name="bouton" value="'.$langs->trans("Save").'">&nbsp;';
 195    print '<input type="submit" class="button" value="'.$langs->trans("Cancel").'">';
 196    print '</td></tr>';
 197    print '</table>';
 198    print '</form>';
 199  
 200    print '</div>';       
 201  }
 202  
 203  $db->close();
 204  
 205  llxFooter('$Date: 2005/09/06 20:58:15 $ - $Revision: 1.28 $');
 206  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics