diff --git a/htdocs/comm/people.php b/htdocs/comm/people.php deleted file mode 100644 index 862332c27be3341575ed8f6d7b1d44bd660429b4..0000000000000000000000000000000000000000 --- a/htdocs/comm/people.php +++ /dev/null @@ -1,265 +0,0 @@ -<?php -/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net> - * - * 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') -{ - // Recuperation contact actuel - $contact = new Contact($db); - $result = $contact->fetch($_GET["contactid"]); - - // Creation user - $nuser = new User($db); - $nuser->nom = $contact->nom; - $nuser->prenom = $contact->prenom; - $nuser->create_from_contact($contact); -} - -if ($action == 'update') -{ - // Recuperation contact actuel - $contact = new Contact($db); - $contact->fetch($_POST["contactid"]); - - // Modification contact - $contact->nom = $_POST["name"]; - $contact->prenom = $_POST["firstname"]; - $contact->poste = $_POST["poste"]; - $contact->phone = $_POST["phone"]; - $contact->fax = $_POST["fax"]; - $contact->email = $_POST["email"]; - $contact->note = $_POST["note"]; - - $contact->update($_POST["contactid"]); -} - -/* - * - * - */ - -llxHeader(); - -if ($_GET["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 = ".$_GET["socid"]; - - - $result = $db->query($sql); - - if ($result) - { - $objsoc = $db->fetch_object($result); - - /* - * - * - */ - print_fiche_titre ("Contact soci�t� : <a href=\"fiche.php?socid=$objsoc->idp\">$objsoc->nom</a>"); - /* - * - */ - - if ($objsoc->note) - { - print '<table border="0" width="100%" cellspacing="0">'; - print "<tr><td>".nl2br($objsoc->note)."</td></tr>"; - print "</table>"; - } - - } - else - { - print $db->error(); - } - - print '<p><table class="border" width="100%" cellspacing="0" border="1" cellpadding="2">'; - - print "<tr><td><b>Pr�nom Nom</b></td>"; - print "<td><b>Poste</b></td><td><b>Tel</b></td>"; - print "<td><b>Fax</b></td><td><b>Email</b></td>"; - - $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(); - print "<tr>"; - print "<td>$obj->firstname $obj->name</td>"; - print "<td>$obj->poste </td>"; - print "<td>$obj->phone </td>"; - print "<td>$obj->fax </td>"; - print "<td><a href=\"mailto:$obj->email\">$obj->email</a> </td>"; - print "</tr>\n"; - $i++; - $tag = !$tag; - } - if ($contactid) - { - if ($obj->fk_user) - { - print '<tr><td>Login</td><td colspan="4"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->fk_user.'">Fiche</a></td></tr>'; - } - else - { - print '<tr><td>Login</td><td colspan="3">Pas de compte</td>'; - print '<td align="center"><a href="people.php?contactid='.$contactid.'&socid='.$socid.'&action=create_user">Cr�er un compte</td></tr>'; - } - } - - print "</table>"; - - - /* - * - * 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(); - } - - print "<form method=\"post\" action=\"people.php?socid=$socid\">"; - print '<input type="hidden" name="action" value="update">'; - print "<input type=\"hidden\" name=\"contactid\" value=\"$contactid\">"; - print '<br><table class="border" border="1" cellpadding="4" cellspacing="0">'; - print "<tr><td>Nom</td><td><input name=\"name\" type=\"text\" size=\"20\" maxlength=\"80\" value=\"$obj->name\"></td>"; - print "<td>Prenom</td><td><input name=\"firstname\" type=\"text\" size=\"15\" maxlength=\"80\" value=\"$obj->firstname\"></td></tr>"; - print "<tr><td>Poste</td><td colspan=\"3\"><input name=\"poste\" type=\"text\" size=\"50\" maxlength=\"80\" value=\"$obj->poste\"></td></tr>"; - print "<tr><td>Tel</td><td><input name=\"phone\" type=\"text\" size=\"18\" maxlength=\"80\" value=\"$obj->phone\"></td>"; - print "<td>Fax</td><td><input name=\"fax\" type=\"text\" size=\"18\" maxlength=\"80\" value=\"$obj->fax\"></td></tr>"; - print "<tr><td>Email</td><td colspan=\"3\"><input name=\"email\" type=\"text\" size=\"50\" maxlength=\"80\" value=\"$obj->email\"></td></tr>"; - print '<tr><td valign="top">Note</td><td colspan="3"><textarea wrap="soft" cols="40" rows="6" name="note">'.$obj->note.'</textarea></td></tr>'; - print '<tr><td align="center" colspan="5"><input type="submit" value="Modifier"></td></tr>'; - - print "</table>"; - print "</form>"; - } - - /* - * - * - * - *if (defined("MAIN_MODULE_FICHEINTER") && MAIN_MODULE_FICHEINTER) - * { - * print "<p>"; - * print_titre("Fiche d'intervention"); - * } - * - * - * - */ - - print '<P><table width="100%" cellspacing="0" border="0" cellpadding="2">'; - - print "<tr class=\"liste_titre\"><td>Action</td>"; - print "<td>Fax</td><td>Email</td>"; - - $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(); - $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; - } - } - else - { - print '<tr><td>' . $db->error() . '</td></tr>'; - } - print "</table>"; - -} -else -{ - print "Error"; -} - -$db->close(); - -llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>"); -?> diff --git a/htdocs/fourn/people.php b/htdocs/fourn/people.php deleted file mode 100644 index daa667e3049aa75dc91b2e8ab5256ca45010686f..0000000000000000000000000000000000000000 --- a/htdocs/fourn/people.php +++ /dev/null @@ -1,272 +0,0 @@ -<?php -/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2003 �ric Seigne <erics@rycks.com> - * Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net> - * - * 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"); - -if ($sortorder == "") -{ - $sortfield="lower(s.nom)"; - $sortorder="ASC"; -} - -$active["1"] = "Offres en ligne"; -$active["-1"] = "Moderation"; -$active["-2"] = "Refus�es"; -$active["0"] = "R�daction"; -$active["-3"] = "D�sactiv�es"; -$active["-4"] = "Supprim�es"; - -$yn["t"] = "oui"; -$yn["f"] = "non"; -$deacmeth["b"] = "robots"; - -if ($action == 'add') { - - $email = trim($email); - - if (strlen(trim($name)) + strlen(trim($firstname)) > 0) { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople (datec, fk_soc,name, firstname, poste, phone,fax,email) "; - $sql .= " VALUES (now(),$socid,'$name','$firstname','$poste','$phone','$fax','$email')"; - $result = $db->query($sql); - if ($result) { - Header("Location: fiche.php?socid=$socid"); - } - } -} -if ($action == 'update') { - if (strlen(trim($name)) + strlen(trim($firstname)) > 0) { - - $email = trim($email); - - $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople set name='$name', firstname='$firstname', poste='$poste', phone='$phone',fax='$fax',email='$email', note='$note'"; - $sql .= " WHERE idp=$contactid"; - $result = $db->query($sql); - if ($result) { - Header("Location: fiche.php?socid=$socid"); - } - } -} - -llxHeader(); - -if ($page == -1) { $page = 0 ; } -$limit = 26; -$offset = $limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -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"; - - if ($to == 'next') { - $sql .= " AND s.idp > $socid ORDER BY idp ASC LIMIT 1"; - } else { - $sql .= " AND s.idp = $socid"; - } - - $result = $db->query($sql); - - if ($result) { - $objsoc = $db->fetch_object($result); - - /* - * - * - */ - print "<table width=\"100%\" border=\"0\">\n"; - print "<tr><td><div class=\"titre\">Contacts pour la soci�t� : <a href=\"fiche.php?socid=$objsoc->idp\">$objsoc->nom</a></div></td>"; - print "<td align=\"center\">[<a href=\"people.php?socid=$socid&action=addcontact\">Ajouter un contact</a>]</td>"; - print '</td></tr></table>'; - - print "<hr>"; - print "<table width=\"100%\" border=0><tr>\n"; - print "<td valign=\"top\">"; - print "tel : $objsoc->tel<br>"; - print "fax : $objsoc->fax<br>"; - print "$objsoc->cp $objsoc->ville<br>"; - if ($objsoc->url) { - print "<a href=\"http://$objsoc->url\">$objsoc->url</a><br>"; - } - - print "</td>\n"; - print "<td valign=\"top\"><table border=0 width=\"100%\" cellspacing=0>"; - - print "</table></td></tr>\n"; - print "</table>"; - - /* - * - */ - - - print "<table border=0 width=\"100%\" cellspacing=0>"; - print "<tr><td>".nl2br($objsoc->note)."</td></tr>"; - print "</table>"; - - } else { - print $db->error(); - } - - print "<P><table width=\"100%\" cellspacing=0 border=1 cellpadding=2>"; - - print "<tr><td><b>Pr�nom Nom</b></td>"; - print "<td><b>Poste</b></td><td><b>Tel</b></td>"; - print "<td><b>Fax</b></td><td><b>Email</b></td>"; - - $sql = "SELECT p.name, p.firstname, p.poste, p.phone, p.fax, p.email "; - $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(); $var = True; - - while ($i < $num) - { - $obj = $db->fetch_object(); - $var != $var; - print "<tr $bc[$var]>"; - - print "<td>$obj->firstname $obj->name</td>"; - print "<td>$obj->poste </td>"; - print "<td>$obj->phone </td>"; - print "<td>$obj->fax </td>"; - print "<td><a href=\"mailto:$obj->email\">$obj->email</a> </td>"; - print "</tr>\n"; - $i++; - $tag = !$tag; - } - print "</table>"; - - - if ($action == 'addcontact') { - $langs->load("companies"); - - print "<br><form method=\"post\" action=\"people.php?socid=$socid\">"; - print "<input type=\"hidden\" name=\"action\" value=\"add\">"; - print "<table border=0>"; - print "<tr><td colspan=\"2\"><div class=\"titre\">".$langs->trans("AddContact")."</div></td>"; - print "<tr><td>Nom</td><td><input name=\"name\" type=\"text\" size=\"20\" maxlength=\"80\"></td>"; - print "<td>Prenom</td><td><input name=\"firstname\" type=\"text\" size=\"15\" maxlength=\"80\"></td></tr>"; - print "<tr><td>Poste</td><td colspan=\"3\"><input name=\"poste\" type=\"text\" size=\"50\" maxlength=\"80\"></td></tr>"; - print "<tr><td>Tel</td><td><input name=\"phone\" type=\"text\" size=\"18\" maxlength=\"80\"></td>"; - print "<td>Fax</td><td><input name=\"fax\" type=\"text\" size=\"18\" maxlength=\"80\"></td></tr>"; - print "<tr><td>Email</td><td colspan=\"3\"><input name=\"email\" type=\"text\" size=\"50\" maxlength=\"80\"></td></tr>"; - print "</table>"; - print "<input type=\"submit\" value=\"".$langs->trans("Add")."\">"; - print "</form>"; - } - /* - * - * 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(); - } - - print "<form method=\"post\" action=\"people.php?socid=$socid\">"; - print "<input type=\"hidden\" name=\"action\" value=\"update\">"; - print "<input type=\"hidden\" name=\"contactid\" value=\"$contactid\">"; - print "<table border=0>"; - print "<tr><td>Num�ro</td><td>$obj->idp</td>"; - print "<tr><td>Nom</td><td><input name=\"name\" type=\"text\" size=\"20\" maxlength=\"80\" value=\"$obj->name\"></td>"; - print "<td>Prenom</td><td><input name=\"firstname\" type=\"text\" size=\"15\" maxlength=\"80\" value=\"$obj->firstname\"></td></tr>"; - print "<tr><td>Poste</td><td colspan=\"3\"><input name=\"poste\" type=\"text\" size=\"50\" maxlength=\"80\" value=\"$obj->poste\"></td></tr>"; - print "<tr><td>Tel</td><td><input name=\"phone\" type=\"text\" size=\"18\" maxlength=\"80\" value=\"$obj->phone\"></td>"; - print "<td>Fax</td><td><input name=\"fax\" type=\"text\" size=\"18\" maxlength=\"80\" value=\"$obj->fax\"></td></tr>"; - print "<tr><td>Email</td><td colspan=\"3\"><input name=\"email\" type=\"text\" size=\"50\" maxlength=\"80\" value=\"$obj->email\"></td></tr>"; - print '<tr><td valign="top">Note</td><td colspan="3"><textarea wrap="soft" cols="40" rows="10" name="note">'.$obj->note.'</textarea></td></tr>'; - print "</table>"; - print "<input type=\"submit\" value=\"Modifier\">"; - print "</form>"; - } - - /* - * - * - */ - print "<P><table width=\"100%\" cellspacing=0 border=1 cellpadding=2>"; - - print "<tr><td><b>Action</b></td>"; - print "<td><b>Fax</b></td><td><b>Email</b></td>"; - - - $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(); - if ($tag) { - print "<tr bgcolor=\"e0e0e0\">"; - } else { - print "<tr>"; - } - 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; - } - } else { - print '<tr><td>' . $db->error() . '</td></tr>'; - } - print "</table>"; - - - - -} else { - print "Error"; -} -$db->free(); -$db->close(); - -llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>"); -?>