*** empty log message ***

This commit is contained in:
Rodolphe Quiedeville 2002-12-12 16:11:54 +00:00
parent 00b6716cfa
commit 42988dbece
6 changed files with 406 additions and 341 deletions

View File

@ -1,8 +1,5 @@
<?PHP <?PHP
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* $Id$
* $Source$
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -18,6 +15,9 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Id$
* $Source$
*
*/ */
require("./pre.inc.php3"); require("./pre.inc.php3");
@ -45,7 +45,6 @@ print_barre_liste("Liste des contacts",$page, $PHP_SELF);
*/ */
$sql = "SELECT s.idp, s.nom, st.libelle as stcomm, p.idp as cidp, p.name, p.firstname, p.email, p.phone "; $sql = "SELECT s.idp, s.nom, st.libelle as stcomm, p.idp as cidp, p.name, p.firstname, p.email, p.phone ";
$sql .= "FROM societe as s, socpeople as p, c_stcomm as st WHERE s.fk_stcomm = st.id AND s.idp = p.fk_soc"; $sql .= "FROM societe as s, socpeople as p, c_stcomm as st WHERE s.fk_stcomm = st.id AND s.idp = p.fk_soc";

View File

@ -1,8 +1,5 @@
<?PHP <?PHP
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* $Id$
* $Source$
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -18,6 +15,9 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Id$
* $Source$
*
*/ */
require("./pre.inc.php3"); require("./pre.inc.php3");
@ -25,12 +25,13 @@ llxHeader();
$db = new Db(); $db = new Db();
function valeur($sql)
{
function valeur($sql) {
global $db; global $db;
if ( $db->query($sql) ) { if ( $db->query($sql) )
if ( $db->num_rows() ) { {
if ( $db->num_rows() )
{
$valeur = $db->result(0,0); $valeur = $db->result(0,0);
} }
$db->free(); $db->free();
@ -113,35 +114,40 @@ if ( $db->query($sql) ) {
print '</table>'; print '</table>';
} }
/* /*
* * Actions commerciales a faire
* *
* *
*/ */
print '</td><td valign="top" width="70%">'; print '</td><td valign="top" width="70%">';
$sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, a.fk_user_author, a.fk_contact"; $sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, a.fk_user_author, a.fk_contact, p.name, s.nom as sname";
$sql .= " FROM actioncomm as a, c_actioncomm as c"; $sql .= " FROM actioncomm as a, c_actioncomm as c, socpeople as p, societe as s";
$sql .= " WHERE c.id=a.fk_action AND a.percent < 100 AND a.fk_user_action = $user->id"; $sql .= " WHERE c.id=a.fk_action AND a.percent < 100 AND a.fk_user_action = $user->id AND a.fk_contact = p.idp AND p.fk_soc = s.idp";
$sql .= " ORDER BY a.datea DESC"; $sql .= " ORDER BY a.datea DESC";
if ( $db->query($sql) ) { if ( $db->query($sql) )
{
print '<TABLE border="0" cellspacing="0" cellpadding="3" width="100%">'; print '<TABLE border="0" cellspacing="0" cellpadding="3" width="100%">';
print "<TR class=\"liste_titre\">"; print '<TR class="liste_titre">';
print "<td colspan=\"2\">Actions à faire</td>"; print '<td colspan="4">Actions à faire</td>';
print "</TR>\n"; print "</TR>\n";
$i = 0; $i = 0;
while ($i < $db->num_rows() ) { while ($i < $db->num_rows() )
{
$obj = $db->fetch_object($i); $obj = $db->fetch_object($i);
$var=!$var; $var=!$var;
print "<tr $bc[$var]><td>".strftime("%d %b %Y",$obj->da)."</td><td><a href=\"action/fiche.php3\">$obj->libelle $obj->label</a></td></tr>"; print "<tr $bc[$var]><td>".strftime("%d %b %Y",$obj->da)."</td>";
print "<td><a href=\"action/fiche.php3?id=$obj->id\">$obj->libelle $obj->label</a></td><td>$obj->name</td><td>$obj->sname</td></tr>";
$i++; $i++;
} }
$db->free(); $db->free();
print "</table><br>"; print "</table><br>";
} else { }
else
{
print $db->error(); print $db->error();
} }

View File

@ -77,20 +77,25 @@ $offset = $limit * $page ;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if ($socid > 0) { 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 = "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"; $sql .= " WHERE s.fk_stcomm=st.id";
if ($to == 'next') { if ($to == 'next')
{
$sql .= " AND s.idp > $socid ORDER BY idp ASC LIMIT 1"; $sql .= " AND s.idp > $socid ORDER BY idp ASC LIMIT 1";
} else { }
else
{
$sql .= " AND s.idp = $socid"; $sql .= " AND s.idp = $socid";
} }
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result)
{
$objsoc = $db->fetch_object( 0); $objsoc = $db->fetch_object( 0);
/* /*
@ -101,24 +106,24 @@ if ($socid > 0) {
print "<tr><td><a href=\"fiche.php3?socid=$objsoc->idp\">$objsoc->nom</a></td>"; print "<tr><td><a href=\"fiche.php3?socid=$objsoc->idp\">$objsoc->nom</a></td>";
print "<td align=\"center\"><a href=\"socnote.php3?socid=$socid\">Notes</a></big></td>"; print "<td align=\"center\"><a href=\"socnote.php3?socid=$socid\">Notes</a></big></td>";
print "<td bgcolor=\"#e0E0E0\" align=\"center\">[<a href=\"people.php3?socid=$socid&action=addcontact\">Ajouter un contact</a>]</td>"; print "<td align=\"center\">[<a href=\"people.php3?socid=$socid&action=addcontact\">Ajouter un contact</a>]</td>";
print '</td></tr></table>'; print '</td></tr></table>';
/* /*
* *
*/ */
if ($objsoc->note)
{
print "<table border=0 width=\"100%\" cellspacing=0 bgcolor=#e0e0e0>"; print "<table border=0 width=\"100%\" cellspacing=0 bgcolor=#e0e0e0>";
print "<tr><td>".nl2br($objsoc->note)."</td></tr>"; print "<tr><td>".nl2br($objsoc->note)."</td></tr>";
print "</table>"; print "</table>";
}
$bc1="bgcolor=\"#c0f0c0\""; }
$bc3="bgcolor=\"#90c090\""; else
$bc2="bgcolor=\"#b0e0b0\""; {
} else {
print $db->error(); print $db->error();
} }
@ -131,17 +136,23 @@ if ($socid > 0) {
$sql = "SELECT p.name, p.firstname, p.poste, p.phone, p.fax, p.email "; $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"; $sql .= " FROM socpeople as p WHERE p.fk_soc = $objsoc->idp";
if ($contactid) { if ($contactid)
{
$sql .= " AND p.idp = $contactid"; $sql .= " AND p.idp = $contactid";
} }
$sql .= " ORDER by p.datec"; $sql .= " ORDER by p.datec";
$result = $db->query($sql); $result = $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)
{
$obj = $db->fetch_object( $i); $obj = $db->fetch_object( $i);
if ($tag) { if ($tag)
{
print "<tr bgcolor=\"e0e0e0\">"; print "<tr bgcolor=\"e0e0e0\">";
} else { }
else
{
print "<tr>"; print "<tr>";
} }
print "<td>$obj->firstname $obj->name</td>"; print "<td>$obj->firstname $obj->name</td>";
@ -156,7 +167,8 @@ if ($socid > 0) {
print "</table>"; print "</table>";
if ($action == 'addcontact') { if ($action == 'addcontact')
{
print "<form method=\"post\" action=\"people.php3?socid=$socid\">"; print "<form method=\"post\" action=\"people.php3?socid=$socid\">";
print "<input type=\"hidden\" name=\"action\" value=\"add\">"; print "<input type=\"hidden\" name=\"action\" value=\"add\">";
print "<table border=0>"; print "<table border=0>";
@ -175,12 +187,15 @@ if ($socid > 0) {
* Edition du contact * Edition du contact
* *
*/ */
if ($action == 'editcontact') { if ($action == 'editcontact')
{
$sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note"; $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"; $sql .= " FROM socpeople as p WHERE p.idp = $contactid";
$result = $db->query($sql); $result = $db->query($sql);
$num = $db->num_rows(); $num = $db->num_rows();
if ( $num >0 ) {
if ( $num >0 )
{
$obj = $db->fetch_object( 0); $obj = $db->fetch_object( 0);
} }
@ -216,22 +231,28 @@ if ($socid > 0) {
$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)
{
$obj = $db->fetch_object( $i); $obj = $db->fetch_object( $i);
$var=!$var; $var=!$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print "<td>". strftime("%d %b %Y %H:%M", $obj->da) ."</td>"; print "<td>". strftime("%d %b %Y %H:%M", $obj->da) ."</td>";
if ($obj->propalrowid) { if ($obj->propalrowid)
{
print "<td><a href=\"propal.php3?propalid=$obj->propalrowid\">$obj->libelle</a></td>"; print "<td><a href=\"propal.php3?propalid=$obj->propalrowid\">$obj->libelle</a></td>";
} else { }
else
{
print "<td>$obj->libelle</td>"; print "<td>$obj->libelle</td>";
} }
@ -240,7 +261,9 @@ if ($socid > 0) {
$i++; $i++;
$tag = !$tag; $tag = !$tag;
} }
} else { }
else
{
print '<tr><td>' . $db->error() . '</td></tr>'; print '<tr><td>' . $db->error() . '</td></tr>';
} }
print "</table>"; print "</table>";
@ -248,7 +271,9 @@ if ($socid > 0) {
} else { }
else
{
print "Error"; print "Error";
} }
$db->free(); $db->free();

View File

@ -92,10 +92,12 @@ if ($propalid) {
$result = $db->query($sql); $result = $db->query($sql);
if ( $result ) { if ( $result )
{
$obj = $db->fetch_object( 0 ); $obj = $db->fetch_object( 0 );
if ($db->num_rows()) { if ($db->num_rows())
{
$color1 = "#e0e0e0"; $color1 = "#e0e0e0";
@ -106,9 +108,10 @@ if ($propalid) {
print '<tr><td>Date</td><td colspan="2">'.strftime("%A %d %B %Y",$obj->dp).'</td></tr>'; print '<tr><td>Date</td><td colspan="2">'.strftime("%A %d %B %Y",$obj->dp).'</td></tr>';
if ($obj->fk_projet) { if ($obj->fk_projet)
$projet = new Project(); {
$projet->fetch($db,$obj->fk_projet); $projet = new Project($db);
$projet->fetch($obj->fk_projet);
print '<tr><td>Projet</td><td colspan="1">'; print '<tr><td>Projet</td><td colspan="1">';
print '<a href="projet/fiche.php3?id='.$projet->id.'">'; print '<a href="projet/fiche.php3?id='.$projet->id.'">';
print $projet->title.'</a></td></tr>'; print $projet->title.'</a></td></tr>';
@ -150,7 +153,8 @@ if ($propalid) {
print "</table>"; print "</table>";
if ($action == 'statut') { if ($action == 'statut')
{
print "<form action=\"$PHP_SELF?propalid=$propalid\" method=\"post\">"; print "<form action=\"$PHP_SELF?propalid=$propalid\" method=\"post\">";
print "<input type=\"hidden\" name=\"action\" value=\"setstatut\">"; print "<input type=\"hidden\" name=\"action\" value=\"setstatut\">";
print "<select name=\"statut\">"; print "<select name=\"statut\">";
@ -172,7 +176,8 @@ if ($propalid) {
$sql .= " FROM llx_propaldet as pt, llx_product as p WHERE pt.fk_product = p.rowid AND pt.fk_propal = $propalid"; $sql .= " FROM llx_propaldet as pt, llx_product as p WHERE pt.fk_product = p.rowid AND pt.fk_propal = $propalid";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result)
{
$num = $db->num_rows(); $num = $db->num_rows();
$i = 0; $total = 0; $i = 0; $total = 0;
print "<p><b>Produits</b><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">"; print "<p><b>Produits</b><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">";
@ -182,7 +187,9 @@ if ($propalid) {
print "</TR>\n"; print "</TR>\n";
$var=True; $var=True;
while ($i < $num) {
while ($i < $num)
{
$objp = $db->fetch_object( $i); $objp = $db->fetch_object( $i);
$var=!$var; $var=!$var;
print "<TR $bc[$var]>"; print "<TR $bc[$var]>";

View File

@ -122,9 +122,10 @@ if ($propalid) {
print '<tr><td>'.translate("Date").'</td><td colspan="2">'.strftime("%A %d %B %Y",$obj->dp).'</td></tr>'; print '<tr><td>'.translate("Date").'</td><td colspan="2">'.strftime("%A %d %B %Y",$obj->dp).'</td></tr>';
if ($obj->fk_projet) { if ($obj->fk_projet)
$projet = new Project(); {
$projet->fetch($db,$obj->fk_projet); $projet = new Project($db);
$projet->fetch($obj->fk_projet);
print '<tr><td>Projet</td><td colspan="1">'; print '<tr><td>Projet</td><td colspan="1">';
print '<a href="projet/fiche.php3?id='.$projet->id.'">'; print '<a href="projet/fiche.php3?id='.$projet->id.'">';
print $projet->title.'</a></td></tr>'; print $projet->title.'</a></td></tr>';

View File

@ -20,7 +20,9 @@
* *
*/ */
class Contact { class Contact
{
var $bs; var $bs;
var $db; var $db;
@ -31,7 +33,8 @@ class Contact {
var $code; var $code;
var $email; var $email;
Function Contact($DB, $id=0) { Function Contact($DB, $id=0)
{
$this->db = $DB; $this->db = $DB;
$this->id = $id; $this->id = $id;
@ -44,7 +47,8 @@ class Contact {
* *
*/ */
Function fetch($id) { Function fetch($id)
{
$sql = "SELECT c.idp, c.idp, c.name, c.firstname"; $sql = "SELECT c.idp, c.idp, c.name, c.firstname";
$sql .= " FROM socpeople as c"; $sql .= " FROM socpeople as c";
@ -52,8 +56,10 @@ class Contact {
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result)
if ($this->db->num_rows()) { {
if ($this->db->num_rows())
{
$obj = $this->db->fetch_object($result , 0); $obj = $this->db->fetch_object($result , 0);
$this->id = $obj->idp; $this->id = $obj->idp;
@ -65,13 +71,34 @@ class Contact {
$this->code = $obj->code; $this->code = $obj->code;
$this->email = $obj->email; $this->email = $obj->email;
} }
$this->db->free(); $this->db->free();
} else { }
else
{
print $this->db->error(); print $this->db->error();
} }
} }
Function update($id)
{
$this->email = trim($this->email);
$sql = "UPDATE socpeople set name='$this->name', firstname='$this->firstname', poste='$this->poste', phone='$this->phone',fax='$this->fax',email='$this->email', note='$this->note'";
$sql .= " WHERE idp=$id";
$result = $this->db->query($sql);
if (!$result)
{
print $this->db->error();
}
return $result;
}
} }
?> ?>