*
* 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$
*
*/
require("./pre.inc.php");
require("../contact.class.php");
$user->getrights('propale');
$user->getrights('fichinter');
$user->getrights('commande');
$user->getrights('projet');
if ($sortorder == "")
{
$sortfield="lower(s.nom)";
$sortorder="ASC";
}
if ($action == 'create_user')
{
$nuser = new User($db);
$contact = new Contact($db);
$nuser->nom = $contact->nom;
$nuser->prenom = $contact->prenom;
$result = $contact->fetch($contactid);
$nuser->create_from_contact($contact);
}
/*
*
*
*/
llxHeader();
if ($socid > 0)
{
$sql = "SELECT s.idp, s.nom, ".$db->pdate("s.datec")." as dc, s.tel, s.fax, st.libelle as stcomm, s.fk_stcomm, s.url,s.cp,s.ville, s.note";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st ";
$sql .= " WHERE s.fk_stcomm=st.id";
$sql .= " AND s.idp = $socid";
$result = $db->query($sql);
if ($result)
{
$objsoc = $db->fetch_object( 0);
/*
*
*
*/
print_fiche_titre ("Contact société : idp\">$objsoc->nom");
/*
*
*/
if ($objsoc->note)
{
print '
';
print "| ".nl2br($objsoc->note)." |
";
print "
";
}
}
else
{
print $db->error();
}
print '';
print "| Prénom Nom | ";
print "Poste | Tel | ";
print "Fax | Email | ";
$sql = "SELECT p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.fk_user ";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p WHERE p.fk_soc = $objsoc->idp";
if ($contactid)
{
$sql .= " AND p.idp = $contactid";
}
$sql .= " ORDER by p.datec";
$result = $db->query($sql);
$i = 0 ; $num = $db->num_rows(); $tag = True;
while ($i < $num)
{
$obj = $db->fetch_object( $i);
print "
";
print "| $obj->firstname $obj->name | ";
print "$obj->poste | ";
print "$obj->phone | ";
print "$obj->fax | ";
print "email\">$obj->email | ";
print "
\n";
$i++;
$tag = !$tag;
}
if ($contactid)
{
if ($obj->fk_user)
{
print '| Login | Fiche |
';
}
else
{
print '| Login | Pas de compte | ';
print 'Créer un compte |
';
}
}
print "
";
/*
*
* Edition du contact
*
*/
if ($action == 'editcontact')
{
$sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p WHERE p.idp = $contactid";
$result = $db->query($sql);
$num = $db->num_rows();
if ( $num >0 )
{
$obj = $db->fetch_object( 0);
}
print "";
}
/*
*
*
*
*if (defined("MAIN_MODULE_FICHEINTER") && MAIN_MODULE_FICHEINTER)
* {
* print "";
* print_titre("Fiche d'intervention");
* }
*
*
*
*/
print '
';
print "| Action | ";
print "Fax | Email | ";
$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 a.fk_soc = $objsoc->idp ";
$sql .= " AND u.rowid = a.fk_user_author";
$sql .= " AND c.id=a.fk_action ";
if ($contactid)
{
$sql .= " AND fk_contact = $contactid";
}
$sql .= " ORDER BY a.datea DESC, a.id DESC";
if ( $db->query($sql) )
{
$i = 0 ; $num = $db->num_rows(); $tag = True;
while ($i < $num)
{
$obj = $db->fetch_object( $i);
$var=!$var;
print "
";
print "| ". strftime("%d %b %Y %H:%M", $obj->da) ." | ";
if ($obj->propalrowid)
{
print "propalrowid\">$obj->libelle | ";
}
else
{
print "$obj->libelle | ";
}
print "$obj->code | ";
print "
\n";
$i++;
$tag = !$tag;
}
}
else
{
print '| ' . $db->error() . ' |
';
}
print "
";
}
else
{
print "Error";
}
$db->close();
llxFooter("Dernière modification $Date$ révision $Revision$");
?>