* * 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.php3"); require("../contact.class.php3"); $db = new Db(); if ($sortorder == "") { $sortfield="lower(s.nom)"; $sortorder="ASC"; } if ($action == 'add') { $email = trim($email); if (strlen(trim($name)) + strlen(trim($firstname)) > 0) { $sql = "INSERT INTO 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.php3?socid=$socid"); } } } if ($action == 'update') { if (strlen(trim($name)) + strlen(trim($firstname)) > 0) { $contact = new Contact($db); $contact->name = $name; $contact->firstname = $firstname; $contact->poste = $poste; $contact->phone = $phone; $contact->fax = $fax; $contact->note = $note; $contact->email = $email; $result = $contact->update($contactid); if ($result) { Header("Location: fiche.php3?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 FROM societe as s, 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( 0); /* * * */ print "\n"; print ""; print ""; print ""; print '
idp\">$objsoc->nomNotes[Ajouter un contact]
'; /* * */ if ($objsoc->note) { print ""; print ""; print "
".nl2br($objsoc->note)."
"; } } else { print $db->error(); } print "

"; print ""; print ""; print ""; $sql = "SELECT p.name, p.firstname, p.poste, p.phone, p.fax, p.email "; $sql .= " FROM 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); if ($tag) { print ""; } else { print ""; } print ""; print ""; print ""; print ""; print ""; print "\n"; $i++; $tag = !$tag; } print "
Prénom NomPosteTelFaxEmail
$obj->firstname $obj->name$obj->poste $obj->phone $obj->fax email\">$obj->email 
"; if ($action == 'addcontact') { print "

"; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print "
NomPrenom
Poste
TelFax
Email
"; print ""; 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 socpeople as p WHERE p.idp = $contactid"; $result = $db->query($sql); $num = $db->num_rows(); if ( $num >0 ) { $obj = $db->fetch_object( 0); } print "
"; print ''; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ''; print "
Numéro$obj->idp
Nomname\">Prenomfirstname\">
Posteposte\">
Telphone\">Faxfax\">
Emailemail\">
Note
"; print ""; print "
"; } /* * * */ print '

'; print ""; print ""; $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 actioncomm as a, c_actioncomm as c, llx_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 ""; if ($obj->propalrowid) { print ""; } else { print ""; } print ""; print "\n"; $i++; $tag = !$tag; } } else { print ''; } print "
ActionFaxEmail
". strftime("%d %b %Y %H:%M", $obj->da) ."propalrowid\">$obj->libelle$obj->libelle$obj->code 
' . $db->error() . '
"; } else { print "Error"; } $db->free(); $db->close(); llxFooter("Dernière modification $Date$ révision $Revision$"); ?>