[ 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/contact/ -> perso.php (source)

   1  <?php
   2  /* Copyright (C) 2004      Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2004-2005 Laurent Destailleur  <eldy@users.sourceforge.net>
   4   *
   5   * This program is free software; you can redistribute it and/or modify
   6   * it under the terms of the GNU General Public License as published by
   7   * the Free Software Foundation; either version 2 of the License, or
   8   * (at your option) any later version.
   9   *
  10   * This program is distributed in the hope that it will be useful,
  11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13   * GNU General Public License for more details.
  14   *
  15   * You should have received a copy of the GNU General Public License
  16   * along with this program; if not, write to the Free Software
  17   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18   *
  19   * $Id: perso.php,v 1.24 2005/12/02 11:55:43 hregis Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/contact/perso.php,v $
  21   */
  22  
  23  /**
  24          \file       htdocs/contact/perso.php
  25          \ingroup    societe
  26          \brief      Onglet informations personnelles d'un contact
  27          \version    $Revision: 1.24 $
  28  */
  29  
  30  require ("./pre.inc.php");
  31  require_once (DOL_DOCUMENT_ROOT."/contact.class.php");
  32  require_once(DOL_DOCUMENT_ROOT."/lib/vcard/vcard.class.php");
  33  
  34  $langs->load("companies");
  35  
  36  
  37  if ($_POST["action"] == 'update')
  38  {
  39      $contact = new Contact($db);
  40      $contact->id = $_POST["contactid"];
  41  
  42      if ($_POST["birthdayyear"])
  43      {
  44          if ($_POST["birthdayyear"]<=1970 && $_SERVER["WINDIR"])
  45          {
  46          // windows mktime does not support negative date timestamp so birthday is not supported for old persons
  47          $contact->birthday = $_POST["birthdayyear"].'-'.$_POST["birthdaymonth"].'-'.$_POST["birthdayday"];
  48          // array_push($error,"Windows ne sachant pas gérer des dates avant 1970, les dates de naissance avant cette date ne seront pas sauvegardées");
  49          } else {
  50              $contact->birthday     = mktime(0,0,0,$_POST["birthdaymonth"],$_POST["birthdayday"],$_POST["birthdayyear"]);
  51          }
  52      }
  53  
  54      $contact->birthday_alert = $_POST["birthday_alert"];
  55  
  56      $result = $contact->update_perso($_POST["contactid"], $user);
  57  }
  58  
  59  
  60  /*
  61   *
  62   *
  63   */
  64  
  65  llxHeader();
  66  
  67  $form = new Form($db);
  68  
  69  $contact = new Contact($db);
  70  $contact->fetch($_GET["id"], $user);
  71  
  72  
  73  $h=0;
  74  
  75  $head[$h][0] = DOL_URL_ROOT.'/contact/fiche.php?id='.$_GET["id"];
  76  $head[$h][1] = $langs->trans("General");
  77  $h++;
  78  
  79  $head[$h][0] = DOL_URL_ROOT.'/contact/perso.php?id='.$_GET["id"];
  80  $head[$h][1] = $langs->trans("PersonalInformations");
  81  $hselected=$h;
  82  $h++;
  83  
  84  $head[$h][0] = DOL_URL_ROOT.'/contact/exportimport.php?id='.$_GET["id"];
  85  $head[$h][1] = $langs->trans("ExportImport");
  86  $h++;
  87  
  88  $head[$h][0] = DOL_URL_ROOT.'/contact/info.php?id='.$_GET["id"];
  89  $head[$h][1] = $langs->trans("Info");
  90  $h++;
  91  
  92  dolibarr_fiche_head($head, $hselected, $langs->trans("Contact").": ".$contact->firstname.' '.$contact->name);
  93  
  94  
  95  if ($_GET["action"] == 'edit')
  96  {
  97      /*
  98       * Fiche en mode edition
  99       */
 100  
 101      print '<table class="border" width="100%">';
 102  
 103      print '<form method="post" action="perso.php?id='.$_GET["id"].'">';
 104      print '<input type="hidden" name="action" value="update">';
 105      print '<input type="hidden" name="contactid" value="'.$contact->id.'">';
 106  
 107      if ($contact->socid > 0)
 108      {
 109          $objsoc = new Societe($db);
 110          $objsoc->fetch($contact->socid);
 111  
 112          print '<tr><td width="15%">'.$langs->trans("Company").'</td><td colspan="3">'.$objsoc->nom_url.'</td>';
 113      }
 114      else
 115      {
 116          print '<tr><td width="15%">'.$langs->trans("Company").'</td><td colspan="3">';
 117          print $langs->trans("ContactNotLinkedToCompany");
 118          print '</td></tr>';
 119      }
 120      
 121      print '<tr><td>'.$langs->trans("UserTitle").'</td><td colspan="3">';
 122      print $form->civilite_name($contact->civilite_id);
 123      print '</td></tr>';
 124      
 125      print '<tr><td width="15%">'.$langs->trans("Lastname").'</td><td>'.$contact->nom.'</td>';
 126      print '<td width="20%">'.$langs->trans("Firstname").'</td><td width="25%">'.$contact->prenom.'</td>';
 127      
 128  
 129      print '<tr><td>'.$langs->trans("Birthday").'</td><td>';
 130      $html=new Form($db);
 131      if ($contact->birthday && $contact->birthday > 0)
 132      {
 133          print $html->select_date($contact->birthday,'birthday',0,0,0);
 134      } else {
 135          print $html->select_date(0,'birthday',0,0,1);
 136      }
 137      print '</td>';
 138  
 139      print '<td colspan="2">'.$langs->trans("Alert").': ';
 140      if ($contact->birthday_alert)
 141      {
 142          print '<input type="checkbox" name="birthday_alert" checked></td>';
 143      }
 144      else
 145      {
 146          print '<input type="checkbox" name="birthday_alert"></td>';
 147      }
 148      print '</tr>';
 149  
 150      print '<tr><td colspan="4" align="center"><input class="button" type="submit" value="'.$langs->trans("Save").'"></td></tr>';
 151      print "</table>";
 152  
 153      print "</form>";
 154  }
 155  else
 156  {
 157      /*
 158       * Fiche en mode visu
 159       */
 160      print '<table class="border" width="100%">';
 161  
 162      if ($contact->socid > 0)
 163      {
 164          $objsoc = new Societe($db);
 165          $objsoc->fetch($contact->socid);
 166  
 167          print '<tr><td width="15%">'.$langs->trans("Company").'</td><td colspan="3">'.$objsoc->nom_url.'</td></tr>';
 168      }
 169  
 170      else
 171      {
 172          print '<tr><td width="15%">'.$langs->trans("Company").'</td><td colspan="3">';
 173          print $langs->trans("ContactNotLinkedToCompany");
 174          print '</td></tr>';
 175      }
 176      
 177      print '<tr><td>'.$langs->trans("UserTitle").'</td><td colspan="3">';
 178      print $form->civilite_name($contact->civilite_id);
 179      print '</td></tr>';
 180      
 181      print '<tr><td width="15%">'.$langs->trans("Lastname").'</td><td>'.$contact->name.'</td>';
 182      print '<td width="20%">'.$langs->trans("Firstname").'</td><td width="25%">'.$contact->firstname.'</td></tr>';
 183  
 184      if ($contact->birthday && $contact->birthday > 0) {
 185          print '<tr><td>'.$langs->trans("Birthdate").'</td><td colspan="3">'.dolibarr_print_date($contact->birthday);
 186  
 187          if ($contact->birthday_alert)
 188          print ' (alerte anniversaire active)</td>';
 189          else
 190          print ' (alerte anniversaire inactive)</td>';
 191      }
 192      else {
 193          print '<tr><td>'.$langs->trans("Birthday").'</td><td colspan="3">'.$langs->trans("Unknown")."</td>";
 194      }
 195      print "</tr>";
 196  
 197      print "</table>";
 198  
 199      print "</div>";
 200  
 201  
 202      // Barre d'actions
 203      if ($user->societe_id == 0)
 204      {
 205          print '<div class="tabsAction">';
 206                  
 207                  if ($user->rights->societe->contact->creer)
 208              {
 209              print '<a class="butAction" href="perso.php?id='.$_GET["id"].'&amp;action=edit">'.$langs->trans('Edit').'</a>';
 210          }
 211  
 212          print "</div>";
 213      }
 214  
 215  }
 216  
 217  $db->close();
 218  
 219  llxFooter('$Date: 2005/12/02 11:55:43 $ - $Revision: 1.24 $');
 220  ?>


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