2004-10-19 22:43:23 +02:00
< ? php
2005-01-14 16:58:48 +01:00
/* Copyright ( C ) 2004 - 2005 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2004-06-09 00:46:48 +02:00
* Copyright ( C ) 2004 Laurent Destailleur < eldy @ users . sourceforge . net >
2004-07-17 17:35:08 +02:00
* Copyright ( C ) 2004 Benoit Mortier < benoit . mortier @ opensides . be >
2004-01-23 12:32:02 +01:00
*
* 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 $
*
*/
2004-10-23 02:46:11 +02:00
2004-12-25 19:16:10 +01:00
/**
2005-01-14 16:58:48 +01:00
\file htdocs / contact / fiche . php
\ingroup societe
\brief Onglet g<EFBFBD> n<EFBFBD> ral d ' un contact
\version $Revision $
2004-10-23 02:46:11 +02:00
*/
2004-01-23 12:32:02 +01:00
require ( " ./pre.inc.php " );
2004-10-05 16:33:52 +02:00
require_once ( " ../contact.class.php " );
2004-01-30 18:24:36 +01:00
require ( DOL_DOCUMENT_ROOT . " /lib/vcard/vcard.class.php " );
2004-01-23 12:32:02 +01:00
2004-10-30 13:39:14 +02:00
$langs -> load ( " companies " );
2004-08-09 00:19:04 +02:00
2004-04-13 16:10:56 +02:00
$error = array ();
2004-07-29 15:23:02 +02:00
if ( $_GET [ " action " ] == 'create_user' && $user -> admin )
{
2005-01-14 16:58:48 +01:00
// Recuperation contact actuel
$contact = new Contact ( $db );
$result = $contact -> fetch ( $_GET [ " id " ]);
// Creation user
$nuser = new User ( $db );
$nuser -> nom = $contact -> nom ;
$nuser -> prenom = $contact -> prenom ;
$nuser -> create_from_contact ( $contact );
2004-07-29 15:23:02 +02:00
}
2004-06-09 00:46:48 +02:00
if ( $_POST [ " action " ] == 'add' )
2004-01-23 12:32:02 +01:00
{
2005-01-14 16:58:48 +01:00
if ( ! $_POST [ " name " ] && ! $_POST [ " firstname " ])
{
array_push ( $error , 'Le champ nom ou pr<70> nom est obligatoire.' );
$_GET [ " action " ] = " create " ;
}
else
{
2004-07-17 17:35:08 +02:00
$contact = new Contact ( $db );
2005-01-14 16:58:48 +01:00
2004-07-17 17:35:08 +02:00
$contact -> socid = $_POST [ " socid " ];
2005-01-14 16:58:48 +01:00
2004-07-17 17:35:08 +02:00
$contact -> name = $_POST [ " name " ];
$contact -> firstname = $_POST [ " firstname " ];
$contact -> civilite_id = $_POST [ " civilite_id " ];
$contact -> poste = $_POST [ " poste " ];
$contact -> address = $_POST [ " adresse " ];
$contact -> cp = $_POST [ " cp " ];
$contact -> ville = $_POST [ " ville " ];
$contact -> email = $_POST [ " email " ];
$contact -> phone_pro = $_POST [ " phone_pro " ];
$contact -> phone_perso = $_POST [ " phone_perso " ];
$contact -> phone_mobile = $_POST [ " phone_mobile " ];
$contact -> fax = $_POST [ " fax " ];
$contact -> jabberid = $_POST [ " jabberid " ];
$contact -> note = $_POST [ " note " ];
$_GET [ " id " ] = $contact -> create ( $user );
2005-01-14 16:58:48 +01:00
}
2004-01-23 12:32:02 +01:00
}
2004-09-23 21:53:05 +02:00
if ( $_POST [ " action " ] == 'confirm_delete' AND $_POST [ " confirm " ] == 'yes' )
2004-01-23 12:32:02 +01:00
{
$contact = new Contact ( $db );
2004-06-09 00:46:48 +02:00
$contact -> old_name = $_POST [ " old_name " ];
$contact -> old_firstname = $_POST [ " old_firstname " ];
2004-01-23 12:32:02 +01:00
$result = $contact -> delete ( $_GET [ " id " ]);
Header ( " Location: index.php " );
}
2004-07-14 12:15:21 +02:00
if ( $_POST [ " action " ] == 'update' )
2004-01-23 12:32:02 +01:00
{
$contact = new Contact ( $db );
2004-06-09 00:46:48 +02:00
$contact -> old_name = $_POST [ " old_name " ];
$contact -> old_firstname = $_POST [ " old_firstname " ];
2004-01-23 12:32:02 +01:00
2004-06-09 00:46:48 +02:00
$contact -> socid = $_POST [ " socid " ];
$contact -> name = $_POST [ " name " ];
$contact -> firstname = $_POST [ " firstname " ];
2004-07-17 17:35:08 +02:00
$contact -> civilite_id = $_POST [ " civilite_id " ];
2004-06-09 00:46:48 +02:00
$contact -> poste = $_POST [ " poste " ];
2004-01-23 12:32:02 +01:00
2004-06-09 00:46:48 +02:00
$contact -> address = $_POST [ " adresse " ];
$contact -> cp = $_POST [ " cp " ];
$contact -> ville = $_POST [ " ville " ];
2004-02-13 18:32:22 +01:00
2004-07-17 17:35:08 +02:00
$contact -> email = $_POST [ " email " ];
2004-06-09 00:46:48 +02:00
$contact -> phone_pro = $_POST [ " phone_pro " ];
$contact -> phone_perso = $_POST [ " phone_perso " ];
$contact -> phone_mobile = $_POST [ " phone_mobile " ];
$contact -> fax = $_POST [ " fax " ];
$contact -> jabberid = $_POST [ " jabberid " ];
2004-01-30 18:24:36 +01:00
2004-07-17 17:35:08 +02:00
$contact -> note = $_POST [ " note " ];
2004-06-09 00:46:48 +02:00
$result = $contact -> update ( $_POST [ " contactid " ], $user );
2004-06-16 15:23:35 +02:00
2004-12-01 13:04:18 +01:00
if ( $contact -> error )
{
$error = $contact -> error ;
}
2004-01-23 12:32:02 +01:00
}
/*
*
*
*/
llxHeader ();
2004-06-16 15:23:35 +02:00
$form = new Form ( $db );
2004-01-23 12:32:02 +01:00
2004-10-23 02:46:11 +02:00
2004-12-16 20:45:40 +01:00
// Affiche les erreurs
if ( sizeof ( $error ))
{
print " <div class='error'> " ;
print join ( " <br> " , $error );
print " </div> \n " ;
}
2004-06-09 00:46:48 +02:00
/*
* Onglets
*/
if ( $_GET [ " id " ] > 0 )
{
2004-11-15 15:20:16 +01:00
// Si edition contact deja existant
2004-11-11 22:15:34 +01:00
2004-11-15 15:20:16 +01:00
$contact = new Contact ( $db );
2005-01-14 23:00:58 +01:00
$return = $contact -> fetch ( $_GET [ " id " ], $user );
if ( $return < 0 ) {
dolibarr_print_error ( '' , $contact -> error );
}
2004-11-15 15:20:16 +01:00
$h = 0 ;
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/contact/fiche.php?id=' . $_GET [ " id " ];
2004-12-25 19:37:40 +01:00
$head [ $h ][ 1 ] = $langs -> trans ( " General " );
2004-11-15 15:20:16 +01:00
$hselected = $h ;
$h ++ ;
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/contact/perso.php?id=' . $_GET [ " id " ];
2004-12-25 19:37:40 +01:00
$head [ $h ][ 1 ] = $langs -> trans ( " PersonalInformations " );
2004-11-15 15:20:16 +01:00
$h ++ ;
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/contact/vcard.php?id=' . $_GET [ " id " ];
$head [ $h ][ 1 ] = $langs -> trans ( " VCard " );
$h ++ ;
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/contact/info.php?id=' . $_GET [ " id " ];
$head [ $h ][ 1 ] = $langs -> trans ( " Info " );
$h ++ ;
dolibarr_fiche_head ( $head , $hselected , $contact -> firstname . ' ' . $contact -> name );
2004-06-09 00:46:48 +02:00
}
2004-02-13 18:32:22 +01:00
2004-07-17 17:35:08 +02:00
2004-11-11 22:15:34 +01:00
/*
* Confirmation de la suppression du contact
*
*/
if ( $_GET [ " action " ] == 'delete' )
{
2005-01-14 16:58:48 +01:00
$form -> form_confirm ( $_SERVER [ " PHP_SELF " ] . " ?id= " . $_GET [ " id " ], " Supprimer le contact " , " <EFBFBD> tes-vous s<> r de vouloir supprimer ce contact ?" , " confirm_delete " );
print '<br>' ;
2004-11-11 22:15:34 +01:00
}
2004-01-31 12:55:37 +01:00
if ( $_GET [ " socid " ] > 0 )
{
$objsoc = new Societe ( $db );
$objsoc -> fetch ( $_GET [ " socid " ]);
}
2004-12-25 19:37:40 +01:00
2004-06-16 15:23:35 +02:00
if ( $_GET [ " action " ] == 'create' )
2004-01-23 12:32:02 +01:00
{
2004-12-31 14:43:06 +01:00
/*
* Fiche en mode creation
*
*/
2004-07-17 17:35:08 +02:00
print '<br>' ;
2004-01-23 12:32:02 +01:00
2004-12-31 14:43:06 +01:00
print '<form method="post" action="fiche.php">' ;
2004-01-23 12:32:02 +01:00
print '<input type="hidden" name="action" value="add">' ;
2004-06-09 00:46:48 +02:00
print '<table class="border" width="100%">' ;
2004-01-31 12:55:37 +01:00
if ( $_GET [ " socid " ] > 0 )
{
2004-12-31 14:43:06 +01:00
/* On remplit avec le num<75> ro de la soci<63> t<EFBFBD> par d<> faut */
if ( strlen ( trim ( $contact -> phone_pro )) == 0 )
{
$contact -> phone_pro = $objsoc -> tel ;
}
2004-08-09 00:19:04 +02:00
print '<tr><td>' . $langs -> trans ( " Company " ) . '</td><td colspan="5">' . $objsoc -> nom . '</td>' ;
2004-01-31 12:55:37 +01:00
print '<input type="hidden" name="socid" value="' . $objsoc -> id . '">' ;
2004-08-09 00:19:04 +02:00
print '</td></tr>' ;
2004-01-31 12:55:37 +01:00
}
2004-08-09 00:19:04 +02:00
else {
2005-01-14 16:58:48 +01:00
print '<tr><td>' . $langs -> trans ( " Company " ) . '</td><td colspan="5">' ;
print $form -> select_societes ( '' , 'socid' );
print '</td></tr>' ;
2004-08-09 00:19:04 +02:00
}
2004-01-31 12:55:37 +01:00
2004-12-10 20:49:02 +01:00
print '<tr><td>' . $langs -> trans ( " UserTitle " ) . '</td><td colspan="5">' ;
2004-08-08 21:40:44 +02:00
print $form -> select_civilite ( $obj -> civilite );
2004-07-17 17:35:08 +02:00
print '</td></tr>' ;
2004-06-16 15:23:35 +02:00
2004-12-10 20:57:46 +01:00
print '<tr><td>' . $langs -> trans ( " Lastname " ) . '</td><td><input name="name" type="text" size="20" maxlength="80"></td>' ;
2004-12-10 20:49:02 +01:00
print '<td>' . $langs -> trans ( " Firstname " ) . '</td><td><input name="firstname" type="text" size="15" maxlength="80"></td>' ;
2004-01-23 12:32:02 +01:00
2004-06-09 00:46:48 +02:00
print '<td>Tel Pro</td><td><input name="phone_pro" type="text" size="18" maxlength="80" value="' . $contact -> phone_pro . '"></td></tr>' ;
2004-01-23 12:32:02 +01:00
2004-07-17 17:35:08 +02:00
print '<tr><td>Poste/Fonction</td><td colspan="3"><input name="poste" type="text" size="50" maxlength="80" value="' . $contact -> poste . '"></td>' ;
2004-01-23 12:32:02 +01:00
2004-06-09 00:46:48 +02:00
print '<td>Tel Perso</td><td><input name="phone_perso" type="text" size="18" maxlength="80" value="' . $contact -> phone_perso . '"></td></tr>' ;
2004-01-23 12:32:02 +01:00
2004-08-09 00:19:04 +02:00
print '<tr><td>' . $langs -> trans ( " Address " ) . '</td><td colspan="3"><input name="adresse" type="text" size="50" maxlength="80"></td>' ;
2004-01-23 12:32:02 +01:00
2004-06-09 00:46:48 +02:00
print '<td>Portable</td><td><input name="phone_mobile" type="text" size="18" maxlength="80" value="' . $contact -> phone_mobile . '"></td></tr>' ;
2004-01-23 12:32:02 +01:00
2005-01-14 16:58:48 +01:00
print '<tr><td>' . $langs -> trans ( " Zip " ) . ' / ' . $langs -> trans ( " Town " ) . '</td><td colspan="3"><input name="cp" type="text" size="6" maxlength="80" value="' . $contact -> cp . '"> ' ;
print '<input name="ville" type="text" size="20" value="' . $contact -> ville . '" maxlength="80"></td>' ;
2004-01-23 12:32:02 +01:00
2004-08-09 00:19:04 +02:00
print '<td>' . $langs -> trans ( " Fax " ) . '</td><td><input name="fax" type="text" size="18" maxlength="80"></td></tr>' ;
print '<tr><td>' . $langs -> trans ( " Email " ) . '</td><td colspan="5"><input name="email" type="text" size="50" maxlength="80" value="' . $contact -> email . '"></td></tr>' ;
2004-06-09 00:46:48 +02:00
print '<tr><td>Jabberid</td><td colspan="5"><input name="jabberid" type="text" size="50" maxlength="80" value="' . $contact -> jabberid . '"></td></tr>' ;
2004-08-09 00:19:04 +02:00
print '<tr><td>' . $langs -> trans ( " Note " ) . '</td><td colspan="5"><textarea name="note" cols="60" rows="3"></textarea></td></tr>' ;
2004-10-05 16:33:52 +02:00
print '<tr><td>Contact facturation</td><td colspan="5"><select name="facturation"><option value="0">Non<option value="1">Oui</select></td></tr>' ;
2004-07-31 14:52:37 +02:00
print '<tr><td align="center" colspan="6"><input type="submit" value="' . $langs -> trans ( " Add " ) . '"></td></tr>' ;
2004-10-31 14:31:22 +01:00
print " </table><br> " ;
2004-01-23 12:32:02 +01:00
print " </form> " ;
}
elseif ( $_GET [ " action " ] == 'edit' )
{
2005-01-14 16:58:48 +01:00
/*
* Fiche en mode edition
*
*/
2004-07-17 17:35:08 +02:00
2004-01-23 12:32:02 +01:00
print '<form method="post" action="fiche.php?id=' . $_GET [ " id " ] . '">' ;
print '<input type="hidden" name="action" value="update">' ;
print '<input type="hidden" name="contactid" value="' . $contact -> id . '">' ;
print '<input type="hidden" name="old_name" value="' . $contact -> name . '">' ;
print '<input type="hidden" name="old_firstname" value="' . $contact -> firstname . '">' ;
2004-06-09 00:46:48 +02:00
print '<table class="border" width="100%">' ;
2004-01-31 12:55:37 +01:00
if ( $_GET [ " socid " ] > 0 )
{
2004-10-23 02:46:11 +02:00
print '<tr><td>' . $langs -> trans ( " Company " ) . '</td><td colspan="5">' . $objsoc -> nom . '</td>' ;
2004-06-09 00:46:48 +02:00
print '<input type="hidden" name="socid" value="' . $objsoc -> id . '">' ;
2004-01-31 12:55:37 +01:00
}
2004-12-10 20:49:02 +01:00
print '<tr><td>' . $langs -> trans ( " UserTitle " ) . '</td><td colspan="5">' ;
2004-07-17 17:35:08 +02:00
print $form -> select_civilite ( $contact -> civilite_id );
print '</td></tr>' ;
2004-06-16 15:23:35 +02:00
2004-10-23 02:46:11 +02:00
print '<tr><td>' . $langs -> trans ( " Lastname " ) . '</td><td><input name="name" type="text" size="20" maxlength="80" value="' . $contact -> name . '"></td>' ;
print '<td>' . $langs -> trans ( " Firstname " ) . '</td><td><input name="firstname" type="text" size="15" maxlength="80" value="' . $contact -> firstname . '"></td>' ;
2004-01-23 12:32:02 +01:00
print '<td>Tel Pro</td><td><input name="phone_pro" type="text" size="18" maxlength="80" value="' . $contact -> phone_pro . '"></td></tr>' ;
2004-07-17 17:35:08 +02:00
print '<tr><td>Poste/Fonction</td><td colspan="3"><input name="poste" type="text" size="50" maxlength="80" value="' . $contact -> poste . '"></td>' ;
2004-01-23 12:32:02 +01:00
2004-01-30 18:24:36 +01:00
print '<td>Tel Perso</td><td><input name="phone_perso" type="text" size="18" maxlength="80" value="' . $contact -> phone_perso . '"></td></tr>' ;
2004-01-23 12:32:02 +01:00
2004-10-23 02:46:11 +02:00
print '<tr><td>' . $langs -> trans ( " Address " ) . '</td><td colspan="3"><input name="adresse" type="text" size="50" maxlength="80" value="' . $contact -> address . '"></td>' ;
2004-01-23 12:32:02 +01:00
2004-01-30 18:24:36 +01:00
print '<td>Portable</td><td><input name="phone_mobile" type="text" size="18" maxlength="80" value="' . $contact -> phone_mobile . '"></td></tr>' ;
2004-01-23 12:32:02 +01:00
2005-01-14 16:58:48 +01:00
print '<tr><td>' . $langs -> trans ( " Zip " ) . ' / ' . $langs -> trans ( " Town " ) . '</td><td colspan="3"><input name="cp" type="text" size="6" maxlength="80" value="' . $contact -> cp . '"> ' ;
print '<input name="ville" type="text" size="20" value="' . $contact -> ville . '" maxlength="80"></td>' ;
2004-01-23 12:32:02 +01:00
2004-10-23 02:46:11 +02:00
print '<td>' . $langs -> trans ( " Fax " ) . '</td><td><input name="fax" type="text" size="18" maxlength="80" value="' . $contact -> fax . '"></td></tr>' ;
print '<tr><td>' . $langs -> trans ( " EMail " ) . '</td><td colspan="5"><input name="email" type="text" size="50" maxlength="80" value="' . $contact -> email . '"></td></tr>' ;
2004-01-30 18:24:36 +01:00
print '<tr><td>Jabberid</td><td colspan="5"><input name="jabberid" type="text" size="50" maxlength="80" value="' . $contact -> jabberid . '"></td></tr>' ;
2004-01-23 12:32:02 +01:00
2004-10-23 02:46:11 +02:00
print '<tr><td>' . $langs -> trans ( " Note " ) . '</td><td colspan="5">' ;
2004-07-17 17:35:08 +02:00
print '<textarea name="note" cols="60" rows="3">' ;
print nl2br ( $contact -> note );
print '</textarea></td></tr>' ;
2004-10-05 16:33:52 +02:00
print '<tr><td>Contact facturation</td><td colspan="5"><select name="facturation"><option value="0">Non<option value="1">Oui</select></td></tr>' ;
2004-08-29 18:11:37 +02:00
print '<tr><td colspan="6" align="center"><input type="submit" value="' . $langs -> trans ( " Save " ) . '"></td></tr>' ;
2004-10-23 02:46:11 +02:00
print " </table><br> " ;
2004-02-13 18:32:22 +01:00
2004-01-23 12:32:02 +01:00
print " </form> " ;
}
else
{
2004-01-31 12:55:37 +01:00
/*
* Visualisation de la fiche
*
*/
2004-10-23 02:46:11 +02:00
print '<table class="noborder" width="100%">' ;
2004-01-31 12:55:37 +01:00
if ( $contact -> socid > 0 )
{
$objsoc = new Societe ( $db );
$objsoc -> fetch ( $contact -> socid );
2004-10-23 02:46:11 +02:00
print '<tr><td>' . $langs -> trans ( " Company " ) . ' : ' . $objsoc -> nom_url . '</td></tr>' ;
2004-01-31 12:55:37 +01:00
}
2004-07-17 17:35:08 +02:00
//TODO Aller chercher le libell<6C> de la civilite a partir de l'id $contact->civilite_id
//print '<tr><td valign="top">Titre : '.$contact->civilite."<br>";
2004-06-16 15:23:35 +02:00
2004-12-16 20:45:40 +01:00
print '<tr><td valign="top">' ;
2005-01-14 16:58:48 +01:00
if ( $contact -> name || $contact -> firstname )
{
print $langs -> trans ( " Name " ) . ' : ' . $contact -> name . ' ' . $contact -> firstname . " <br> " ;
}
2004-01-30 18:24:36 +01:00
if ( $contact -> poste )
print 'Poste : ' . $contact -> poste . " <br> " ;
2005-01-14 16:58:48 +01:00
if ( $contact -> email )
2004-10-07 17:21:51 +02:00
{
2005-01-14 16:58:48 +01:00
print $langs -> trans ( " EMail " ) . ' : ' . $contact -> email . " <br> " ;
if ( ! ValidEmail ( $contact -> email ))
{
print " <b> " . $langs -> trans ( " ErrorBadEMail " , $contact -> email ) . " </b><br> " ;
}
/*
* Pose des probl<EFBFBD> mes en cas de non connexion au R<EFBFBD> seau
* et en cas ou la fonction checkdnsrr n ' est pas disponible dans php
* ( cas fr<EFBFBD> quent sur certains h<EFBFBD> bergeurs )
*/
/*
if ( ! check_mail ( $contact -> email ))
{
print " <b>Email invalide, nom de domaine incorrecte !</b><br> " ;
}
*/
2004-10-07 17:21:51 +02:00
}
2004-10-23 02:46:11 +02:00
2005-01-14 16:58:48 +01:00
if ( $contact -> address || $contact -> ville )
2004-10-07 17:21:51 +02:00
{
2005-01-14 16:58:48 +01:00
print 'Adresse : ' . $contact -> address . " <br> " ;
print 'Adresse : ' . $contact -> cp . " " . $contact -> ville . " <br> " ;
2004-10-07 17:21:51 +02:00
}
2004-01-30 18:24:36 +01:00
if ( $contact -> jabberid )
print 'Jabber : ' . $contact -> jabberid . " <br> " ;
2005-01-14 16:58:48 +01:00
2004-07-29 15:23:02 +02:00
if ( $contact -> user_id )
print 'Utilisateur avec acc<63> s : <a href="' . DOL_URL_ROOT . '/user/fiche.php?id=' . $contact -> user_id . '">Fiche utilisateur</a><br>' ;
2005-01-14 16:58:48 +01:00
2004-01-23 18:06:06 +01:00
print '</td><td valign="top">' ;
2005-01-14 16:58:48 +01:00
2004-01-30 18:24:36 +01:00
if ( $contact -> phone_pro )
2004-01-23 18:06:06 +01:00
print 'Tel Pro : ' . $contact -> phone_pro . " <br> " ;
2005-01-14 16:58:48 +01:00
2004-01-23 12:32:02 +01:00
if ( $contact -> phone_perso )
2004-01-23 18:06:06 +01:00
print 'Tel Perso : ' . $contact -> phone_perso . " <br> " ;
2004-01-23 12:32:02 +01:00
if ( $contact -> phone_mobile )
2004-01-23 18:06:06 +01:00
print 'Portable : ' . $contact -> phone_mobile . " <br> " ;
if ( $contact -> fax )
2004-10-23 02:46:11 +02:00
print $langs -> trans ( " Fax " ) . ' : ' . $contact -> fax . " <br> " ;
2004-01-23 18:06:06 +01:00
2004-01-30 18:24:36 +01:00
print '</td></tr>' ;
2004-07-17 17:35:08 +02:00
if ( $contact -> note ) {
print '<tr><td>' ;
print nl2br ( $contact -> note );
print '</td></tr>' ;
}
2004-04-13 16:10:56 +02:00
2004-07-17 17:35:08 +02:00
print " </table><br> " ;
2004-01-31 12:55:37 +01:00
print " </div> " ;
2004-10-23 02:46:11 +02:00
2004-07-31 14:16:28 +02:00
// Barre d'actions
2004-01-23 12:32:02 +01:00
if ( $user -> societe_id == 0 )
{
2004-01-31 12:55:37 +01:00
print '<div class="tabsAction">' ;
2004-01-23 12:32:02 +01:00
2004-07-31 14:16:28 +02:00
print '<a class="tabAction" href="fiche.php?id=' . $contact -> id . '&action=edit">' . $langs -> trans ( 'Edit' ) . '</a>' ;
2004-07-29 15:23:02 +02:00
if ( $contact -> user_id == 0 && $user -> admin )
{
print '<a class="tabAction" href="fiche.php?id=' . $contact -> id . '&action=create_user">Cr<43> er un compte</a>' ;
}
2004-12-25 19:16:10 +01:00
print '<a class="butDelete" href="fiche.php?id=' . $contact -> id . '&action=delete">' . $langs -> trans ( 'Delete' ) . '</a>' ;
print " </div><br> " ;
}
2005-01-14 16:58:48 +01:00
// Historique des actions vers ce contact
print_titre ( " Historique des actions pour ce contact " );
2004-12-25 19:37:40 +01:00
2005-01-14 16:58:48 +01:00
print '<table width="100%" class="noborder">' ;
2004-12-25 19:37:40 +01:00
2005-01-14 16:58:48 +01:00
print " <tr class= \" liste_titre \" > " ;
print " <td> " . $langs -> trans ( " Date " ) . " </td><td> " . $langs -> trans ( " Actions " ) . " </td> " ;
print " <td> " . $langs -> trans ( " CreatedBy " ) . " </td></tr> " ;
2004-12-25 19:37:40 +01:00
2005-01-14 16:58:48 +01:00
$sql = " SELECT a.id, " . $db -> pdate ( " a.datea " ) . " as da, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid " ;
$sql .= " FROM " . MAIN_DB_PREFIX . " actioncomm as a, " . MAIN_DB_PREFIX . " c_actioncomm as c, " . MAIN_DB_PREFIX . " user as u " ;
$sql .= " WHERE fk_contact = " . $contact -> id ;
$sql .= " AND u.rowid = a.fk_user_author " ;
$sql .= " AND c.id=a.fk_action " ;
2004-12-25 19:37:40 +01:00
2005-01-14 16:58:48 +01:00
if ( $contactid )
2004-12-25 19:16:10 +01:00
{
2004-12-25 19:37:40 +01:00
$sql .= " AND fk_contact = $contactid " ;
}
2005-01-14 16:58:48 +01:00
$sql .= " ORDER BY a.datea DESC, a.id DESC " ;
2004-12-25 19:37:40 +01:00
2005-01-14 16:58:48 +01:00
if ( $db -> query ( $sql ) )
2004-12-25 19:37:40 +01:00
{
$i = 0 ; $num = $db -> num_rows (); $tag = True ;
while ( $i < $num )
2004-12-25 19:16:10 +01:00
{
2004-12-25 19:37:40 +01:00
$obj = $db -> fetch_object ();
$var =! $var ;
print " <tr $bc[$var] > " ;
print " <td> " . strftime ( " %d %b %Y %H:%M " , $obj -> da ) . " </td> " ;
if ( $obj -> propalrowid )
{
print " <td><a href= \" propal.php?propalid= $obj->propalrowid\ " > $obj -> libelle </ a ></ td > " ;
}
else
{
print " <td> $obj->libelle </td> " ;
}
print " <td> $obj->code </td> " ;
print " </tr> \n " ;
$i ++ ;
$tag = ! $tag ;
2004-12-25 19:16:10 +01:00
}
2004-01-23 12:32:02 +01:00
}
2005-01-14 16:58:48 +01:00
else
2004-12-25 19:37:40 +01:00
{
dolibarr_print_error ( $db );
}
2005-01-14 16:58:48 +01:00
print " </table> " ;
2004-12-25 19:16:10 +01:00
2004-12-25 19:37:40 +01:00
}
2004-10-23 02:46:11 +02:00
$db -> close ();
2004-01-23 12:32:02 +01:00
llxFooter ( " <em>Dernière modification $Date $ révision $Revision $ </em> " );
?>