Gestion du CP et de la ville
This commit is contained in:
parent
4906fa01e8
commit
41b87ad357
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
*
|
*
|
||||||
@ -23,10 +23,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/contact/fiche.php
|
\file htdocs/contact/fiche.php
|
||||||
\ingroup societe
|
\ingroup societe
|
||||||
\brief Onglet général d'un contact
|
\brief Onglet général d'un contact
|
||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
@ -35,30 +35,31 @@ require (DOL_DOCUMENT_ROOT."/lib/vcard/vcard.class.php");
|
|||||||
|
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
|
|
||||||
|
|
||||||
$error = array();
|
$error = array();
|
||||||
|
|
||||||
|
|
||||||
if ($_GET["action"] == 'create_user' && $user->admin)
|
if ($_GET["action"] == 'create_user' && $user->admin)
|
||||||
{
|
{
|
||||||
// Recuperation contact actuel
|
// Recuperation contact actuel
|
||||||
$contact = new Contact($db);
|
$contact = new Contact($db);
|
||||||
$result = $contact->fetch($_GET["id"]);
|
$result = $contact->fetch($_GET["id"]);
|
||||||
|
|
||||||
// Creation user
|
// Creation user
|
||||||
$nuser = new User($db);
|
$nuser = new User($db);
|
||||||
$nuser->nom = $contact->nom;
|
$nuser->nom = $contact->nom;
|
||||||
$nuser->prenom = $contact->prenom;
|
$nuser->prenom = $contact->prenom;
|
||||||
$nuser->create_from_contact($contact);
|
$nuser->create_from_contact($contact);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST["action"] == 'add')
|
if ($_POST["action"] == 'add')
|
||||||
{
|
{
|
||||||
if (! $_POST["name"] && ! $_POST["firstname"]) {
|
if (! $_POST["name"] && ! $_POST["firstname"])
|
||||||
array_push($error,'Le champ nom ou prénom est obligatoire.');
|
{
|
||||||
$_GET["action"]="create";
|
array_push($error,'Le champ nom ou prénom est obligatoire.');
|
||||||
}
|
$_GET["action"]="create";
|
||||||
else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$contact = new Contact($db);
|
$contact = new Contact($db);
|
||||||
|
|
||||||
$contact->socid = $_POST["socid"];
|
$contact->socid = $_POST["socid"];
|
||||||
@ -80,7 +81,7 @@ if ($_POST["action"] == 'add')
|
|||||||
$contact->note = $_POST["note"];
|
$contact->note = $_POST["note"];
|
||||||
|
|
||||||
$_GET["id"] = $contact->create($user);
|
$_GET["id"] = $contact->create($user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST["action"] == 'confirm_delete' AND $_POST["confirm"] == 'yes')
|
if ($_POST["action"] == 'confirm_delete' AND $_POST["confirm"] == 'yes')
|
||||||
@ -186,8 +187,8 @@ if ($_GET["id"] > 0)
|
|||||||
*/
|
*/
|
||||||
if ($_GET["action"] == 'delete')
|
if ($_GET["action"] == 'delete')
|
||||||
{
|
{
|
||||||
$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],"Supprimer le contact","Êtes-vous sûr de vouloir supprimer ce contact ?","confirm_delete");
|
$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],"Supprimer le contact","Êtes-vous sûr de vouloir supprimer ce contact ?","confirm_delete");
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET["socid"] > 0)
|
if ($_GET["socid"] > 0)
|
||||||
@ -224,9 +225,9 @@ if ($_GET["action"] == 'create')
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="5">';
|
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="5">';
|
||||||
print $form->select_societes('','socid');
|
print $form->select_societes('','socid');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td colspan="5">';
|
print '<tr><td>'.$langs->trans("UserTitle").'</td><td colspan="5">';
|
||||||
@ -246,7 +247,9 @@ if ($_GET["action"] == 'create')
|
|||||||
|
|
||||||
print '<td>Portable</td><td><input name="phone_mobile" type="text" size="18" maxlength="80" value="'.$contact->phone_mobile.'"></td></tr>';
|
print '<td>Portable</td><td><input name="phone_mobile" type="text" size="18" maxlength="80" value="'.$contact->phone_mobile.'"></td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td colspan="3"><input name="cp" type="text" size="6" maxlength="80"> <input name="cp" type="text" size="20" maxlength="80"></td>';
|
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>';
|
||||||
|
|
||||||
print '<td>'.$langs->trans("Fax").'</td><td><input name="fax" type="text" size="18" maxlength="80"></td></tr>';
|
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>';
|
print '<tr><td>'.$langs->trans("Email").'</td><td colspan="5"><input name="email" type="text" size="50" maxlength="80" value="'.$contact->email.'"></td></tr>';
|
||||||
@ -264,10 +267,10 @@ if ($_GET["action"] == 'create')
|
|||||||
}
|
}
|
||||||
elseif ($_GET["action"] == 'edit')
|
elseif ($_GET["action"] == 'edit')
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Fiche en mode edition
|
* Fiche en mode edition
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print '<form method="post" action="fiche.php?id='.$_GET["id"].'">';
|
print '<form method="post" action="fiche.php?id='.$_GET["id"].'">';
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
@ -299,7 +302,10 @@ elseif ($_GET["action"] == 'edit')
|
|||||||
|
|
||||||
print '<td>Portable</td><td><input name="phone_mobile" type="text" size="18" maxlength="80" value="'.$contact->phone_mobile.'"></td></tr>';
|
print '<td>Portable</td><td><input name="phone_mobile" type="text" size="18" maxlength="80" value="'.$contact->phone_mobile.'"></td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td colspan="3"><input name="cp" type="text" size="6" maxlength="80"> <input name="cp" type="text" size="20" maxlength="80"></td>';
|
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>';
|
||||||
|
|
||||||
|
|
||||||
print '<td>'.$langs->trans("Fax").'</td><td><input name="fax" type="text" size="18" maxlength="80" value="'.$contact->fax.'"></td></tr>';
|
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>';
|
print '<tr><td>'.$langs->trans("EMail").'</td><td colspan="5"><input name="email" type="text" size="50" maxlength="80" value="'.$contact->email.'"></td></tr>';
|
||||||
@ -340,34 +346,42 @@ else
|
|||||||
|
|
||||||
print '<tr><td valign="top">';
|
print '<tr><td valign="top">';
|
||||||
|
|
||||||
if ($contact->name || $contact->firstname) {
|
if ($contact->name || $contact->firstname)
|
||||||
print $langs->trans("Name").' : '.$contact->name.' '.$contact->firstname ."<br>";
|
{
|
||||||
}
|
print $langs->trans("Name").' : '.$contact->name.' '.$contact->firstname ."<br>";
|
||||||
|
}
|
||||||
|
|
||||||
if ($contact->poste)
|
if ($contact->poste)
|
||||||
print 'Poste : '.$contact->poste ."<br>";
|
print 'Poste : '.$contact->poste ."<br>";
|
||||||
|
|
||||||
if ($contact->email) {
|
if ($contact->email)
|
||||||
print $langs->trans("EMail").' : '.$contact->email ."<br>";
|
|
||||||
|
|
||||||
if (!ValidEmail($contact->email))
|
|
||||||
{
|
{
|
||||||
print "<b>".$langs->trans("ErrorBadEMail",$contact->email)."</b><br>";
|
print $langs->trans("EMail").' : '.$contact->email ."<br>";
|
||||||
|
|
||||||
|
if (!ValidEmail($contact->email))
|
||||||
|
{
|
||||||
|
print "<b>".$langs->trans("ErrorBadEMail",$contact->email)."</b><br>";
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Pose des problèmes en cas de non connexion au Réseau
|
||||||
|
* et en cas ou la fonction checkdnsrr n'est pas disponible dans php
|
||||||
|
* (cas fréquent sur certains hébergeurs)
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
if (!check_mail($contact->email))
|
||||||
|
{
|
||||||
|
print "<b>Email invalide, nom de domaine incorrecte !</b><br>";
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
if ($contact->address || $contact->ville)
|
||||||
* Pose des problèmes en cas de non connexion au Réseau
|
|
||||||
* et en cas ou la fonction checkdnsrr n'est pas disponible dans php
|
|
||||||
* (cas fréquent sur certains hébergeurs)
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
if (!check_mail($contact->email))
|
|
||||||
{
|
{
|
||||||
print "<b>Email invalide, nom de domaine incorrecte !</b><br>";
|
print 'Adresse : '.$contact->address ."<br>";
|
||||||
|
print 'Adresse : '.$contact->cp . " ".$contact->ville ."<br>";
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($contact->jabberid)
|
if ($contact->jabberid)
|
||||||
print 'Jabber : '.$contact->jabberid ."<br>";
|
print 'Jabber : '.$contact->jabberid ."<br>";
|
||||||
@ -420,28 +434,28 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Historique des actions vers ce contact
|
// Historique des actions vers ce contact
|
||||||
print_titre ("Historique des actions pour ce contact");
|
print_titre ("Historique des actions pour ce contact");
|
||||||
|
|
||||||
print '<table width="100%" class="noborder">';
|
print '<table width="100%" class="noborder">';
|
||||||
|
|
||||||
print "<tr class=\"liste_titre\">";
|
print "<tr class=\"liste_titre\">";
|
||||||
print "<td>".$langs->trans("Date")."</td><td>".$langs->trans("Actions")."</td>";
|
print "<td>".$langs->trans("Date")."</td><td>".$langs->trans("Actions")."</td>";
|
||||||
print "<td>".$langs->trans("CreatedBy")."</td></tr>";
|
print "<td>".$langs->trans("CreatedBy")."</td></tr>";
|
||||||
|
|
||||||
$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 = "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 .= " 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 .= " WHERE fk_contact = ".$contact->id;
|
||||||
$sql .= " AND u.rowid = a.fk_user_author";
|
$sql .= " AND u.rowid = a.fk_user_author";
|
||||||
$sql .= " AND c.id=a.fk_action ";
|
$sql .= " AND c.id=a.fk_action ";
|
||||||
|
|
||||||
if ($contactid)
|
if ($contactid)
|
||||||
{
|
{
|
||||||
$sql .= " AND fk_contact = $contactid";
|
$sql .= " AND fk_contact = $contactid";
|
||||||
}
|
}
|
||||||
$sql .= " ORDER BY a.datea DESC, a.id DESC";
|
$sql .= " ORDER BY a.datea DESC, a.id DESC";
|
||||||
|
|
||||||
if ( $db->query($sql) )
|
if ( $db->query($sql) )
|
||||||
{
|
{
|
||||||
$i = 0 ; $num = $db->num_rows(); $tag = True;
|
$i = 0 ; $num = $db->num_rows(); $tag = True;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
@ -466,11 +480,11 @@ else
|
|||||||
$tag = !$tag;
|
$tag = !$tag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_print_error($db);
|
dolibarr_print_error($db);
|
||||||
}
|
}
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user