New: Ajout du pays dans les proprits du contact
This commit is contained in:
parent
ad8c4b9777
commit
b39f5668b8
@ -23,7 +23,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/** \file htdocs/contact.class.php
|
||||
/**
|
||||
\file htdocs/contact.class.php
|
||||
\ingroup societe
|
||||
\brief Fichier de la classe des contacts
|
||||
\version $Revision$
|
||||
@ -33,127 +34,139 @@ require_once (DOL_DOCUMENT_ROOT."/lib/ldap.lib.php");
|
||||
|
||||
|
||||
|
||||
/** \class Contact
|
||||
/**
|
||||
\class Contact
|
||||
\brief Classe permettant la gestion des contacts
|
||||
*/
|
||||
|
||||
class Contact
|
||||
{
|
||||
var $db;
|
||||
var $error;
|
||||
|
||||
var $id;
|
||||
var $fullname;
|
||||
var $nom;
|
||||
var $prenom;
|
||||
var $code;
|
||||
var $email;
|
||||
var $birthday;
|
||||
var $db;
|
||||
var $error;
|
||||
|
||||
var $id;
|
||||
var $fullname;
|
||||
var $nom;
|
||||
var $prenom;
|
||||
var $name;
|
||||
var $firstname;
|
||||
var $address;
|
||||
var $cp;
|
||||
var $ville;
|
||||
var $fk_pays;
|
||||
|
||||
var $code;
|
||||
var $email;
|
||||
var $birthday;
|
||||
|
||||
/**
|
||||
* \brief Constructeur de l'objet contact
|
||||
*
|
||||
*/
|
||||
function Contact($DB, $id=0)
|
||||
/**
|
||||
* \brief Constructeur de l'objet contact
|
||||
* \param DB Habler d'accès base
|
||||
* \param id Id contact
|
||||
*/
|
||||
function Contact($DB, $id=0)
|
||||
{
|
||||
$this->db = $DB;
|
||||
$this->id = $id;
|
||||
|
||||
return 1;
|
||||
$this->db = $DB;
|
||||
$this->id = $id;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Ajout d'un contact en base
|
||||
* \param user Utilisateur qui effectue l'ajout
|
||||
*/
|
||||
function create($user)
|
||||
{
|
||||
if (!$this->socid)
|
||||
{
|
||||
$this->socid = 0;
|
||||
}
|
||||
/**
|
||||
* \brief Ajout d'un contact en base
|
||||
* \param user Utilisateur qui effectue l'ajout
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function create($user)
|
||||
{
|
||||
$this->name=trim($this->name);
|
||||
if (! $this->socid)
|
||||
{
|
||||
$this->socid = 0;
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople (datec, fk_soc, name, fk_user) ";
|
||||
$sql .= " VALUES (now(),$this->socid,'$this->name',$user->id)";
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
$id = $this->db->last_insert_id(MAIN_DB_PREFIX."socpeople");
|
||||
|
||||
$this->update($id, $user);
|
||||
|
||||
return $id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error='Echec sql='.$sql;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Mise à jour des infos
|
||||
* \param id id du contact à mettre à jour
|
||||
* \param user Utilisateur qui effectue la mise à jour
|
||||
*
|
||||
*/
|
||||
function update($id, $user=0)
|
||||
{
|
||||
dolibarr_syslog("Contact::Update id=".$id,LOG_DEBUG);
|
||||
$this->id = $id;
|
||||
$this->error = array();
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople (datec, fk_soc, name, fk_user)";
|
||||
$sql.= " VALUES (now(),$this->socid,'$this->name',$user->id)";
|
||||
|
||||
$this->email = trim($this->email);
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
$id = $this->db->last_insert_id(MAIN_DB_PREFIX."socpeople");
|
||||
|
||||
//commenté suite a la nouvell fonction dolibarr_print_phone
|
||||
//$this->phone_pro = ereg_replace(" ","",$this->phone_pro);
|
||||
//$this->phone_perso = ereg_replace(" ","",$this->phone_perso);
|
||||
|
||||
if (strlen($this->phone_pro) == 0 && $this->socid > 0)
|
||||
{
|
||||
$soc = new Societe($this->db);
|
||||
$soc->fetch($this->socid);
|
||||
$this->phone_pro = $soc->tel;
|
||||
}
|
||||
$ret=$this->update($id, $user);
|
||||
if ($ret < 0)
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
return -2;
|
||||
}
|
||||
return $id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET ";
|
||||
$sql .= " civilite='$this->civilite_id'";
|
||||
$sql .= ", name='".trim($this->name)."'";
|
||||
$sql .= ", firstname='".trim($this->firstname)."'";
|
||||
$sql .= ", address='$this->address'";
|
||||
$sql .= ", cp='$this->cp'";
|
||||
$sql .= ", ville='$this->ville'";
|
||||
$sql .= ", poste='$this->poste'";
|
||||
$sql .= ", fax='$this->fax'";
|
||||
$sql .= ", email='$this->email'";
|
||||
$sql .= ", note='$this->note'";
|
||||
$sql .= ", phone = '$this->phone_pro'";
|
||||
$sql .= ", phone_perso = '$this->phone_perso'";
|
||||
$sql .= ", phone_mobile = '$this->phone_mobile'";
|
||||
$sql .= ", jabberid = '$this->jabberid'";
|
||||
/*
|
||||
* \brief Mise à jour des infos
|
||||
* \param id id du contact à mettre à jour
|
||||
* \param user Utilisateur qui effectue la mise à jour
|
||||
* \return int <0 si erreur, >0 si ok
|
||||
*/
|
||||
function update($id, $user=0)
|
||||
{
|
||||
dolibarr_syslog("Contact::Update id=".$id,LOG_DEBUG);
|
||||
|
||||
if ($user)
|
||||
{
|
||||
$sql .= ", fk_user_modif='".$user->id."'";
|
||||
}
|
||||
$sql .= " WHERE idp=$id";
|
||||
$this->id = $id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
$this->name=trim($this->name);
|
||||
$this->firstname=trim($this->firstname);
|
||||
$this->email=trim($this->email);
|
||||
$this->phone_pro=trim($this->phone_pro);
|
||||
|
||||
if (!$result)
|
||||
{
|
||||
$this->error='Echec sql='.$sql;
|
||||
}
|
||||
if ($this->phone_pro && $this->socid > 0)
|
||||
{
|
||||
$soc = new Societe($this->db);
|
||||
$soc->fetch($this->socid);
|
||||
$this->phone_pro = $soc->tel;
|
||||
}
|
||||
|
||||
if (defined('MAIN_MODULE_LDAP') && MAIN_MODULE_LDAP)
|
||||
{
|
||||
if (defined('LDAP_CONTACT_ACTIVE') && LDAP_CONTACT_ACTIVE == 1)
|
||||
{
|
||||
$this->update_ldap($user);
|
||||
}
|
||||
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET ";
|
||||
$sql .= " civilite='$this->civilite_id'";
|
||||
$sql .= ", name='$this->name'";
|
||||
$sql .= ", firstname='$this->firstname'";
|
||||
$sql .= ", address='$this->address'";
|
||||
$sql .= ", cp='$this->cp'";
|
||||
$sql .= ", ville='$this->ville'";
|
||||
$sql .= ", fk_pays='$this->fk_pays'";
|
||||
$sql .= ", poste='$this->poste'";
|
||||
$sql .= ", fax='$this->fax'";
|
||||
$sql .= ", email='$this->email'";
|
||||
$sql .= ", note='$this->note'";
|
||||
$sql .= ", phone = '$this->phone_pro'";
|
||||
$sql .= ", phone_perso = '$this->phone_perso'";
|
||||
$sql .= ", phone_mobile = '$this->phone_mobile'";
|
||||
$sql .= ", jabberid = '$this->jabberid'";
|
||||
if ($user) $sql .= ", fk_user_modif='".$user->id."'";
|
||||
$sql .= " WHERE idp=".$id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if (! $result)
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ($conf->ldap->enabled)
|
||||
{
|
||||
if ($conf->global->LDAP_CONTACT_ACTIVE)
|
||||
{
|
||||
$this->update_ldap($user);
|
||||
}
|
||||
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Mise à jour de l'arbre ldap
|
||||
@ -421,13 +434,14 @@ class Contact
|
||||
*/
|
||||
function fetch($id, $user=0)
|
||||
{
|
||||
$sql = "SELECT c.idp, c.fk_soc, c.civilite civilite_id, c.name, c.firstname";
|
||||
$sql .= ", c.address, c.cp, c.ville";
|
||||
$sql .= ", c.birthday as birthday, poste";
|
||||
$sql .= ", phone, phone_perso, phone_mobile, fax, c.email, jabberid, c.note";
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c";
|
||||
$sql .= " WHERE c.idp = ". $id;
|
||||
$sql = "SELECT c.idp, c.fk_soc, c.civilite civilite_id, c.name, c.firstname,";
|
||||
$sql.= " c.address, c.cp, c.ville,";
|
||||
$sql.= " c.fk_pays, p.libelle as pays, p.code as pays_code,";
|
||||
$sql.= " c.birthday as birthday, c.poste,";
|
||||
$sql.= " c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid, c.note";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p ON c.fk_pays = p.rowid";
|
||||
$sql.= " WHERE c.idp = ". $id;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -446,6 +460,9 @@ class Contact
|
||||
$this->address = $obj->address;
|
||||
$this->cp = $obj->cp;
|
||||
$this->ville = $obj->ville;
|
||||
$this->fk_pays = $obj->fk_pays;
|
||||
$this->pays_code = $obj->fk_pays?$obj->pays_code:'';
|
||||
$this->pays = $obj->fk_pays?$obj->pays:'';
|
||||
|
||||
$this->societeid = $obj->fk_soc;
|
||||
$this->socid = $obj->fk_soc;
|
||||
@ -489,7 +506,7 @@ class Contact
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("Error in Contact::fetch() selectuser sql=$sql");
|
||||
$this->error="Error in Contact::fetch() selectuser sql=$sql";
|
||||
$this->error="Error in Contact::fetch() selectuser - ".$this->db->error()." - ".$sql;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -514,7 +531,7 @@ class Contact
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("Error in Contact::fetch() selectcontactfacture sql=$sql");
|
||||
$this->error="Error in Contact::fetch() selectcontactfacture sql=$sql";
|
||||
$this->error="Error in Contact::fetch() selectcontactfacture - ".$this->db->error()." - ".$sql;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -538,7 +555,7 @@ class Contact
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("Error in Contact::fetch() selectuseralert sql=$sql");
|
||||
$this->error="Error in Contact::fetch() selectuseralert sql=$sql";
|
||||
$this->error="Error in Contact::fetch() selectuseralert - ".$this->db->error()." - ".$sql;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -548,7 +565,7 @@ class Contact
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("Error in Contact::fetch() selectsocpeople sql=$sql");
|
||||
$this->error="Error in Contact::fetch() selectsocpeople sql=$sql";
|
||||
$this->error="Error in Contact::fetch() selectsocpeople - ".$this->db->error()." - ".$sql;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,55 +53,62 @@ if ($_GET["action"] == 'create_user' && $user->admin)
|
||||
$nuser->create_from_contact($contact);
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'add')
|
||||
if ($_POST["action"] == 'add')
|
||||
{
|
||||
if (! $_POST["name"])
|
||||
if (! $_POST["name"])
|
||||
{
|
||||
array_push($error,$langs->trans("ErrorFieldRequired",$langs->trans("Lastname")));
|
||||
$_GET["action"]="create";
|
||||
array_push($error,$langs->trans("ErrorFieldRequired",$langs->trans("Lastname")));
|
||||
$_GET["action"]="create";
|
||||
}
|
||||
if (! $_POST["firstname"])
|
||||
if (! $_POST["firstname"])
|
||||
{
|
||||
array_push($error,$langs->trans("ErrorFieldRequired",$langs->trans("Firstname")));
|
||||
$_GET["action"]="create";
|
||||
array_push($error,$langs->trans("ErrorFieldRequired",$langs->trans("Firstname")));
|
||||
$_GET["action"]="create";
|
||||
}
|
||||
|
||||
if ($_POST["name"] && $_POST["firstname"])
|
||||
if ($_POST["name"] && $_POST["firstname"])
|
||||
{
|
||||
$contact = new Contact($db);
|
||||
|
||||
$contact->socid = $_POST["socid"];
|
||||
|
||||
$contact->name = $_POST["name"];
|
||||
$contact->firstname = $_POST["firstname"];
|
||||
$contact->civilite_id = $_POST["civilite_id"];
|
||||
$contact->poste = $_POST["poste"];
|
||||
$contact->address = $_POST["address"];
|
||||
$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);
|
||||
$contact = new Contact($db);
|
||||
|
||||
$contact->socid = $_POST["socid"];
|
||||
|
||||
$contact->name = $_POST["name"];
|
||||
$contact->firstname = $_POST["firstname"];
|
||||
$contact->civilite_id = $_POST["civilite_id"];
|
||||
$contact->poste = $_POST["poste"];
|
||||
$contact->address = $_POST["address"];
|
||||
$contact->cp = $_POST["cp"];
|
||||
$contact->ville = $_POST["ville"];
|
||||
$contact->fk_pays = $_POST["pays_id"];
|
||||
$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"];
|
||||
|
||||
$id = $contact->create($user);
|
||||
if ($id > 0)
|
||||
{
|
||||
Header("Location: fiche.php?id=".$id);
|
||||
}
|
||||
|
||||
$error=array($contact->error);
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'confirm_delete' AND $_POST["confirm"] == 'yes')
|
||||
{
|
||||
$contact = new Contact($db);
|
||||
|
||||
$contact->old_name = $_POST["old_name"];
|
||||
$contact->old_firstname = $_POST["old_firstname"];
|
||||
|
||||
$result = $contact->delete($_GET["id"]);
|
||||
|
||||
Header("Location: index.php");
|
||||
$contact = new Contact($db);
|
||||
|
||||
$contact->old_name = $_POST["old_name"];
|
||||
$contact->old_firstname = $_POST["old_firstname"];
|
||||
|
||||
$result = $contact->delete($_GET["id"]);
|
||||
|
||||
Header("Location: index.php");
|
||||
}
|
||||
|
||||
|
||||
@ -121,6 +128,7 @@ if ($_POST["action"] == 'update')
|
||||
$contact->address = $_POST["address"];
|
||||
$contact->cp = $_POST["cp"];
|
||||
$contact->ville = $_POST["ville"];
|
||||
$contact->fk_pays = $_POST["pays_id"];
|
||||
|
||||
$contact->email = $_POST["email"];
|
||||
$contact->phone_pro = $_POST["phone_pro"];
|
||||
@ -157,9 +165,9 @@ if ($socid)
|
||||
// Affiche les erreurs
|
||||
if (sizeof($error))
|
||||
{
|
||||
print "<div class='error'>";
|
||||
print join("<br>",$error);
|
||||
print "</div>\n";
|
||||
print "<div class='error'>";
|
||||
print join("<br>",$error);
|
||||
print "</div>\n";
|
||||
}
|
||||
|
||||
|
||||
@ -210,136 +218,139 @@ if ($_GET["action"] == 'delete')
|
||||
|
||||
if ($_GET["action"] == 'create')
|
||||
{
|
||||
/*
|
||||
* Fiche en mode creation
|
||||
*
|
||||
*/
|
||||
print_fiche_titre($langs->trans("AddContact"));
|
||||
|
||||
print '<br>';
|
||||
/*
|
||||
* Fiche en mode creation
|
||||
*
|
||||
*/
|
||||
print_fiche_titre($langs->trans("AddContact"));
|
||||
print '<br>';
|
||||
|
||||
print '<form method="post" action="fiche.php">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<form method="post" action="fiche.php">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
if ($socid)
|
||||
if ($socid)
|
||||
{
|
||||
// On remplit avec le numéro de la société par défaut
|
||||
if (strlen(trim($contact->phone_pro)) == 0)
|
||||
{
|
||||
$contact->phone_pro = $objsoc->tel;
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans("Company").'</td>';
|
||||
print '<td colspan="5"><a href="'.DOL_URL_ROOT.'/soc.php?socid='.$socid.'">'.$objsoc->nom.'</a></td>';
|
||||
print '<input type="hidden" name="socid" value="'.$objsoc->id.'">';
|
||||
print '</td></tr>';
|
||||
// On remplit avec le numéro de la société par défaut
|
||||
if (strlen(trim($contact->phone_pro)) == 0)
|
||||
{
|
||||
$contact->phone_pro = $objsoc->tel;
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans("Company").'</td>';
|
||||
print '<td colspan="3"><a href="'.DOL_URL_ROOT.'/soc.php?socid='.$socid.'">'.$objsoc->nom.'</a></td>';
|
||||
print '<input type="hidden" name="socid" value="'.$objsoc->id.'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
else {
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="3">';
|
||||
print $form->select_societes('','socid','');
|
||||
else {
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="3">';
|
||||
print $form->select_societes('','socid','');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td colspan="3">';
|
||||
print $form->select_civilite($obj->civilite);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td colspan="3">';
|
||||
print $form->select_civilite($obj->civilite);
|
||||
print '</td></tr>';
|
||||
print '<tr><td width="15%">'.$langs->trans("Lastname").'</td><td width="35%"><input name="name" type="text" size="20" maxlength="80" value="'.$contact->nom.'"></td>';
|
||||
print '<td width="15%">'.$langs->trans("Firstname").'</td><td width="35%"><input name="firstname" type="text" size="15" maxlength="80" value="'.$contact->prenom.'"></td></tr>';
|
||||
|
||||
print '<tr><td width="15%">'.$langs->trans("Lastname").'</td><td width="35%"><input name="name" type="text" size="20" maxlength="80" value="'.$contact->nom.'"></td>';
|
||||
print '<td width="15%">'.$langs->trans("Firstname").'</td><td width="35%"><input name="firstname" type="text" size="15" maxlength="80" value="'.$contact->prenom.'"></td></tr>';
|
||||
print '<tr><td>Poste/Fonction</td><td colspan="3"><input name="poste" type="text" size="50" maxlength="80" value="'.$contact->poste.'"></td>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td colspan="3"><input name="address" type="text" size="50" maxlength="80"></td>';
|
||||
|
||||
print '<tr><td>Poste/Fonction</td><td colspan="3"><input name="poste" type="text" size="50" maxlength="80" value="'.$contact->poste.'"></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></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td colspan="3"><input name="address" type="text" size="50" maxlength="80"></td>';
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
|
||||
$form->select_pays($contact->fk_pays);
|
||||
print '</td></tr>';
|
||||
|
||||
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 '<tr><td>Tel Pro</td><td><input name="phone_pro" type="text" size="18" maxlength="80" value="'.$contact->phone_pro.'"></td>';
|
||||
print '<td>Tel Perso</td><td><input name="phone_perso" type="text" size="18" maxlength="80" value="'.$contact->phone_perso.'"></td></tr>';
|
||||
|
||||
print '<input name="ville" type="text" size="20" value="'.$contact->ville.'" maxlength="80"></td>';
|
||||
print '<tr><td>'.$langs->trans("Fax").'</td><td><input name="fax" type="text" size="18" maxlength="80"></td>';
|
||||
print '<td>Portable</td><td><input name="phone_mobile" type="text" size="18" maxlength="80" value="'.$contact->phone_mobile.'"></td></tr>';
|
||||
|
||||
print '<tr><td>Tel Pro</td><td><input name="phone_pro" type="text" size="18" maxlength="80" value="'.$contact->phone_pro.'"></td>';
|
||||
print '<td>Tel Perso</td><td><input name="phone_perso" type="text" size="18" maxlength="80" value="'.$contact->phone_perso.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Email").'</td><td colspan="3"><input name="email" type="text" size="50" maxlength="80" value="'.$contact->email.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Fax").'</td><td><input name="fax" type="text" size="18" maxlength="80"></td>';
|
||||
print '<td>Portable</td><td><input name="phone_mobile" type="text" size="18" maxlength="80" value="'.$contact->phone_mobile.'"></td></tr>';
|
||||
print '<tr><td>Jabberid</td><td colspan="3"><input name="jabberid" type="text" size="50" maxlength="80" value="'.$contact->jabberid.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Email").'</td><td colspan="3"><input name="email" type="text" size="50" maxlength="80" value="'.$contact->email.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Note").'</td><td colspan="3"><textarea name="note" cols="60" rows="3"></textarea></td></tr>';
|
||||
|
||||
print '<tr><td>Jabberid</td><td colspan="3"><input name="jabberid" type="text" size="50" maxlength="80" value="'.$contact->jabberid.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("BillingContact").'</td><td colspan="3">';
|
||||
print $form->selectyesno("facturation",$contact->facturation);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Note").'</td><td colspan="3"><textarea name="note" cols="60" rows="3"></textarea></td></tr>';
|
||||
print '<tr><td align="center" colspan="4"><input type="submit" value="'.$langs->trans("Add").'"></td></tr>';
|
||||
print "</table><br>";
|
||||
|
||||
print '<tr><td>'.$langs->trans("BillingContact").'</td><td colspan="3">';
|
||||
print $form->selectyesno("facturation",$contact->facturation);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td align="center" colspan="4"><input type="submit" value="'.$langs->trans("Add").'"></td></tr>';
|
||||
print "</table><br>";
|
||||
|
||||
print "</form>";
|
||||
print "</form>";
|
||||
}
|
||||
elseif ($_GET["action"] == 'edit')
|
||||
elseif ($_GET["action"] == 'edit')
|
||||
{
|
||||
/*
|
||||
* Fiche en mode edition
|
||||
*
|
||||
*/
|
||||
|
||||
print '<form method="post" action="fiche.php?id='.$_GET["id"].'">';
|
||||
print '<input type="hidden" name="id" value="'.$_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.'">';
|
||||
print '<table class="border" width="100%">';
|
||||
/*
|
||||
* Fiche en mode edition
|
||||
*
|
||||
*/
|
||||
|
||||
if ($contact->socid > 0)
|
||||
print '<form method="post" action="fiche.php?id='.$_GET["id"].'">';
|
||||
print '<input type="hidden" name="id" value="'.$_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.'">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
if ($contact->socid > 0)
|
||||
{
|
||||
$objsoc = new Societe($db);
|
||||
$objsoc->fetch($contact->socid);
|
||||
$objsoc = new Societe($db);
|
||||
$objsoc->fetch($contact->socid);
|
||||
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="3">'.$objsoc->nom_url.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="3">'.$objsoc->nom_url.'</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td colspan="3">';
|
||||
print $form->select_civilite($contact->civilite_id);
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td colspan="3">';
|
||||
print $form->select_civilite($contact->civilite_id);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td width="15%">'.$langs->trans("Lastname").'</td><td width="35%"><input name="name" type="text" size="20" maxlength="80" value="'.$contact->name.'"></td>';
|
||||
print '<td width="15%">'.$langs->trans("Firstname").'</td><td width="35%"><input name="firstname" type="text" size="15" maxlength="80" value="'.$contact->firstname.'"></td></tr>';
|
||||
print '<tr><td width="15%">'.$langs->trans("Lastname").'</td><td width="35%"><input name="name" type="text" size="20" maxlength="80" value="'.$contact->name.'"></td>';
|
||||
print '<td width="15%">'.$langs->trans("Firstname").'</td><td width="35%"><input name="firstname" type="text" size="15" maxlength="80" value="'.$contact->firstname.'"></td></tr>';
|
||||
|
||||
print '<tr><td>Poste/Fonction</td><td colspan="3"><input name="poste" type="text" size="50" maxlength="80" value="'.$contact->poste.'"></td></tr>';
|
||||
|
||||
print '<tr><td>Poste/Fonction</td><td colspan="3"><input name="poste" type="text" size="50" maxlength="80" value="'.$contact->poste.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td colspan="3"><input name="address" type="text" size="50" maxlength="80" value="'.$contact->address.'"></td>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td colspan="3"><input name="address" type="text" size="50" maxlength="80" value="'.$contact->address.'"></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></tr>';
|
||||
|
||||
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 '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
|
||||
$form->select_pays($contact->fk_pays);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<input name="ville" type="text" size="20" value="'.$contact->ville.'" maxlength="80"></td>';
|
||||
print '<tr><td>Tel Pro</td><td><input name="phone_pro" type="text" size="18" maxlength="80" value="'.$contact->phone_pro.'"></td>';
|
||||
print '<td>Tel Perso</td><td><input name="phone_perso" type="text" size="18" maxlength="80" value="'.$contact->phone_perso.'"></td></tr>';
|
||||
|
||||
print '<tr><td>Tel Pro</td><td><input name="phone_pro" type="text" size="18" maxlength="80" value="'.$contact->phone_pro.'"></td>';
|
||||
print '<td>Tel Perso</td><td><input name="phone_perso" type="text" size="18" maxlength="80" value="'.$contact->phone_perso.'"></td></tr>';
|
||||
print '<tr><td>Portable</td><td><input name="phone_mobile" type="text" size="18" maxlength="80" value="'.$contact->phone_mobile.'"></td>';
|
||||
print '<td>'.$langs->trans("Fax").'</td><td><input name="fax" type="text" size="18" maxlength="80" value="'.$contact->fax.'"></td></tr>';
|
||||
|
||||
print '<tr><td>Portable</td><td><input name="phone_mobile" type="text" size="18" maxlength="80" value="'.$contact->phone_mobile.'"></td>';
|
||||
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="3"><input name="email" type="text" size="50" maxlength="80" value="'.$contact->email.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("EMail").'</td><td colspan="3"><input name="email" type="text" size="50" maxlength="80" value="'.$contact->email.'"></td></tr>';
|
||||
print '<tr><td>Jabberid</td><td colspan="3"><input name="jabberid" type="text" size="50" maxlength="80" value="'.$contact->jabberid.'"></td></tr>';
|
||||
|
||||
print '<tr><td>Jabberid</td><td colspan="3"><input name="jabberid" type="text" size="50" maxlength="80" value="'.$contact->jabberid.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Note").'</td><td colspan="3">';
|
||||
print '<textarea name="note" cols="60" rows="3">';
|
||||
print $contact->note;
|
||||
print '</textarea></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Note").'</td><td colspan="3">';
|
||||
print '<textarea name="note" cols="60" rows="3">';
|
||||
print $contact->note;
|
||||
print '</textarea></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("BillingContact").'</td><td colspan="3">';
|
||||
print $form->selectyesno("facturation",$contact->facturation);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("BillingContact").'</td><td colspan="3">';
|
||||
print $form->selectyesno("facturation",$contact->facturation);
|
||||
print '</td></tr>';
|
||||
print '<tr><td colspan="4" align="center"><input type="submit" value="'.$langs->trans("Save").'"></td></tr>';
|
||||
print "</table><br>";
|
||||
|
||||
print '<tr><td colspan="4" align="center"><input type="submit" value="'.$langs->trans("Save").'"></td></tr>';
|
||||
print "</table><br>";
|
||||
|
||||
print "</form>";
|
||||
print "</form>";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -374,6 +385,10 @@ else
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td colspan="3">'.$contact->cp.' ';
|
||||
print $contact->ville.'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
|
||||
print $contact->pays;
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>Tel Pro</td><td>'.$contact->phone_pro.'</td>';
|
||||
print '<td>Tel Perso</td><td>'.$contact->phone_perso.'</td></tr>';
|
||||
|
||||
|
||||
@ -238,6 +238,7 @@ alter table llx_cond_reglement add code varchar(16) after rowid;
|
||||
|
||||
alter table llx_socpeople add cp varchar(25) after address;
|
||||
alter table llx_socpeople add ville varchar(255) after cp;
|
||||
alter table llx_socpeople add fk_pays integer DEFAULT 0 after ville;
|
||||
|
||||
alter table llx_paiement add statut smallint DEFAULT 0 NOT NULL ;
|
||||
alter table llx_facturedet add fk_export_compta integer DEFAULT 0 NOT NULL ;
|
||||
|
||||
@ -32,6 +32,7 @@ create table llx_socpeople
|
||||
address varchar(255),
|
||||
cp varchar(25),
|
||||
ville varchar(255),
|
||||
fk_pays integer DEFAULT 0,
|
||||
birthday date,
|
||||
poste varchar(80),
|
||||
phone varchar(30),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user