*** 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
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* $Id$
* $Source$
*
* 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
@ -18,6 +15,9 @@
* 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");
@ -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 .= "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
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* $Id$
* $Source$
*
* 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
@ -18,6 +15,9 @@
* 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");
@ -25,16 +25,17 @@ llxHeader();
$db = new Db();
function valeur($sql) {
function valeur($sql)
{
global $db;
if ( $db->query($sql) ) {
if ( $db->num_rows() ) {
$valeur = $db->result(0,0);
if ( $db->query($sql) )
{
if ( $db->num_rows() )
{
$valeur = $db->result(0,0);
}
$db->free();
}
$db->free();
}
return $valeur;
}
/*
@ -113,35 +114,40 @@ if ( $db->query($sql) ) {
print '</table>';
}
/*
*
* Actions commerciales a faire
*
*
*/
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 .= " FROM actioncomm as a, c_actioncomm as c";
$sql .= " WHERE c.id=a.fk_action AND a.percent < 100 AND a.fk_user_action = $user->id";
$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, socpeople as p, societe as s";
$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";
if ( $db->query($sql) ) {
if ( $db->query($sql) )
{
print '<TABLE border="0" cellspacing="0" cellpadding="3" width="100%">';
print "<TR class=\"liste_titre\">";
print "<td colspan=\"2\">Actions à faire</td>";
print '<TR class="liste_titre">';
print '<td colspan="4">Actions à faire</td>';
print "</TR>\n";
$i = 0;
while ($i < $db->num_rows() ) {
$obj = $db->fetch_object($i);
$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>";
$i++;
}
while ($i < $db->num_rows() )
{
$obj = $db->fetch_object($i);
$var=!$var;
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++;
}
$db->free();
print "</table><br>";
} else {
}
else
{
print $db->error();
}

View File

@ -77,130 +77,145 @@ $offset = $limit * $page ;
$pageprev = $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 .= " 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";
}
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 "<table width=\"100%\" border=\"0\" cellspacing=\"1\">\n";
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 bgcolor=\"#e0E0E0\" align=\"center\">[<a href=\"people.php3?socid=$socid&action=addcontact\">Ajouter un contact</a>]</td>";
print '</td></tr></table>';
/*
*
*/
if ($result)
{
$objsoc = $db->fetch_object( 0);
/*
*
*
*/
print "<table width=\"100%\" border=\"0\" cellspacing=\"1\">\n";
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=\"people.php3?socid=$socid&action=addcontact\">Ajouter un contact</a>]</td>";
print '</td></tr></table>';
print "<table border=0 width=\"100%\" cellspacing=0 bgcolor=#e0e0e0>";
print "<tr><td>".nl2br($objsoc->note)."</td></tr>";
print "</table>";
/*
*
*/
$bc1="bgcolor=\"#c0f0c0\"";
$bc3="bgcolor=\"#90c090\"";
$bc2="bgcolor=\"#b0e0b0\"";
} else {
print $db->error();
}
if ($objsoc->note)
{
print "<table border=0 width=\"100%\" cellspacing=0 bgcolor=#e0e0e0>";
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 socpeople as p WHERE p.fk_soc = $objsoc->idp";
if ($contactid)
{
$sql .= " AND p.idp = $contactid";
}
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 "<tr bgcolor=\"e0e0e0\">";
} else {
print "<tr>";
while ($i < $num)
{
$obj = $db->fetch_object( $i);
if ($tag)
{
print "<tr bgcolor=\"e0e0e0\">";
}
else
{
print "<tr>";
}
print "<td>$obj->firstname $obj->name</td>";
print "<td>$obj->poste&nbsp;</td>";
print "<td>$obj->phone&nbsp;</td>";
print "<td>$obj->fax&nbsp;</td>";
print "<td><a href=\"mailto:$obj->email\">$obj->email</a>&nbsp;</td>";
print "</tr>\n";
$i++;
$tag = !$tag;
}
print "<td>$obj->firstname $obj->name</td>";
print "<td>$obj->poste&nbsp;</td>";
print "<td>$obj->phone&nbsp;</td>";
print "<td>$obj->fax&nbsp;</td>";
print "<td><a href=\"mailto:$obj->email\">$obj->email</a>&nbsp;</td>";
print "</tr>\n";
$i++;
$tag = !$tag;
}
print "</table>";
if ($action == 'addcontact') {
print "<form method=\"post\" action=\"people.php3?socid=$socid\">";
print "<input type=\"hidden\" name=\"action\" value=\"add\">";
print "<table border=0>";
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=\"Ajouter\">";
print "</form>";
}
if ($action == 'addcontact')
{
print "<form method=\"post\" action=\"people.php3?socid=$socid\">";
print "<input type=\"hidden\" name=\"action\" value=\"add\">";
print "<table border=0>";
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=\"Ajouter\">";
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 socpeople as p WHERE p.idp = $contactid";
$result = $db->query($sql);
$num = $db->num_rows();
if ( $num >0 ) {
$obj = $db->fetch_object( 0);
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 "<form method=\"post\" action=\"people.php3?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 "<form method=\"post\" action=\"people.php3?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>";
}
/*
*
*
@ -216,39 +231,49 @@ if ($socid > 0) {
$sql .= " AND u.rowid = a.fk_user_author";
$sql .= " AND c.id=a.fk_action ";
if ($contactid) {
$sql .= " AND fk_contact = $contactid";
}
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 "<tr $bc[$var]>";
print "<td>". strftime("%d %b %Y %H:%M", $obj->da) ."</td>";
if ($obj->propalrowid) {
print "<td><a href=\"propal.php3?propalid=$obj->propalrowid\">$obj->libelle</a></td>";
} else {
print "<td>$obj->libelle</td>";
}
print "<td>$obj->code&nbsp;</td>";
print "</tr>\n";
$i++;
$tag = !$tag;
if ( $db->query($sql) )
{
$i = 0 ; $num = $db->num_rows(); $tag = True;
while ($i < $num)
{
$obj = $db->fetch_object( $i);
$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.php3?propalid=$obj->propalrowid\">$obj->libelle</a></td>";
}
else
{
print "<td>$obj->libelle</td>";
}
print "<td>$obj->code&nbsp;</td>";
print "</tr>\n";
$i++;
$tag = !$tag;
}
}
else
{
print '<tr><td>' . $db->error() . '</td></tr>';
}
} else {
print '<tr><td>' . $db->error() . '</td></tr>';
}
print "</table>";
} else {
}
else
{
print "Error";
}
$db->free();

View File

@ -92,175 +92,182 @@ if ($propalid) {
$result = $db->query($sql);
if ( $result ) {
$obj = $db->fetch_object( 0 );
if ( $result )
{
$obj = $db->fetch_object( 0 );
if ($db->num_rows()) {
$color1 = "#e0e0e0";
if ($db->num_rows())
{
print "<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\" width=\"100%\">";
$color1 = "#e0e0e0";
print '<tr><td>Société</td><td colspan="2"><a href="fiche.php3?socid='.$obj->idp.'">'.$obj->nom.'</a></td>';
print "<td valign=\"top\" width=\"50%\" rowspan=\"9\">Note :<br>". nl2br($obj->note)."</td></tr>";
print "<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\" width=\"100%\">";
print '<tr><td>Date</td><td colspan="2">'.strftime("%A %d %B %Y",$obj->dp).'</td></tr>';
print '<tr><td>Société</td><td colspan="2"><a href="fiche.php3?socid='.$obj->idp.'">'.$obj->nom.'</a></td>';
print "<td valign=\"top\" width=\"50%\" rowspan=\"9\">Note :<br>". nl2br($obj->note)."</td></tr>";
print '<tr><td>Date</td><td colspan="2">'.strftime("%A %d %B %Y",$obj->dp).'</td></tr>';
if ($obj->fk_projet) {
$projet = new Project();
$projet->fetch($db,$obj->fk_projet);
print '<tr><td>Projet</td><td colspan="1">';
print '<a href="projet/fiche.php3?id='.$projet->id.'">';
print $projet->title.'</a></td></tr>';
}
print "<tr><td>Destinataire</td><td colspan=\"2\">$obj->firstname $obj->name &lt;$obj->email&gt;</td></tr>";
/*
*
*/
if ($obj->fk_projet)
{
$projet = new Project($db);
$projet->fetch($obj->fk_projet);
print '<tr><td>Projet</td><td colspan="1">';
print '<a href="projet/fiche.php3?id='.$projet->id.'">';
print $projet->title.'</a></td></tr>';
}
print "<tr><td>Destinataire</td><td colspan=\"2\">$obj->firstname $obj->name &lt;$obj->email&gt;</td></tr>";
/*
*
*/
print "<tr><td bgcolor=\"$color1\">Montant HT</td><td colspan=\"2\" bgcolor=\"$color1\" align=\"right\">".price($obj->price)." euros</td></tr>";
/*
*
*/
print "<tr><td bgcolor=\"$color1\">Remise</td><td colspan=\"2\" bgcolor=\"$color1\" align=\"right\">".price($obj->remise)." euros</td></tr>";
/*
*
*/
$totalht = $propal->price - $propal->remise ;
print "<tr><td bgcolor=\"$color1\">Total HT</td><td colspan=\"2\" bgcolor=\"$color1\" align=\"right\"><b>".price($totalht)."</b> euros</td></tr>";
/*
*
*/
print '<tr><td>Auteur</td><td colspan="2">';
$author = new User($db, $obj->fk_user_author);
$author->fetch('');
print $author->fullname.'</td></tr>';
/*
*
*/
print "<tr bgcolor=\"#f0f0f0\"><td>Statut :</td><td colspan=2 align=center><b>$obj->lst</b></td>";
print '</tr>';
print "<tr><td bgcolor=\"$color1\">Montant HT</td><td colspan=\"2\" bgcolor=\"$color1\" align=\"right\">".price($obj->price)." euros</td></tr>";
/*
*
*/
print "<tr><td bgcolor=\"$color1\">Remise</td><td colspan=\"2\" bgcolor=\"$color1\" align=\"right\">".price($obj->remise)." euros</td></tr>";
/*
*
*/
$totalht = $propal->price - $propal->remise ;
print "<tr><td bgcolor=\"$color1\">Total HT</td><td colspan=\"2\" bgcolor=\"$color1\" align=\"right\"><b>".price($totalht)."</b> euros</td></tr>";
/*
*
*/
print '<tr><td>Auteur</td><td colspan="2">';
$author = new User($db, $obj->fk_user_author);
$author->fetch('');
print $author->fullname.'</td></tr>';
/*
*
*/
print "<tr bgcolor=\"#f0f0f0\"><td>Statut :</td><td colspan=2 align=center><b>$obj->lst</b></td>";
print '</tr>';
print "</table>";
print "</table>";
if ($action == 'statut') {
print "<form action=\"$PHP_SELF?propalid=$propalid\" method=\"post\">";
print "<input type=\"hidden\" name=\"action\" value=\"setstatut\">";
print "<select name=\"statut\">";
print "<option value=\"2\">Signée";
print "<option value=\"3\">Non Signée";
print '</select>';
print '<br><textarea cols="60" rows="6" wrap="soft" name="note">';
print $obj->note . "\n----------\n";
print '</textarea><br><input type="submit" value="Valider">';
print "</form>";
}
if ($action == 'statut')
{
print "<form action=\"$PHP_SELF?propalid=$propalid\" method=\"post\">";
print "<input type=\"hidden\" name=\"action\" value=\"setstatut\">";
print "<select name=\"statut\">";
print "<option value=\"2\">Signée";
print "<option value=\"3\">Non Signée";
print '</select>';
print '<br><textarea cols="60" rows="6" wrap="soft" name="note">';
print $obj->note . "\n----------\n";
print '</textarea><br><input type="submit" value="Valider">';
print "</form>";
}
print "<table width=\"100%\" cellspacing=2><tr><td valign=\"top\">";
/*
* Produits
*/
$sql = "SELECT p.label as product, p.ref, pt.price, pt.qty";
$sql .= " FROM llx_propaldet as pt, llx_product as p WHERE pt.fk_product = p.rowid AND pt.fk_propal = $propalid";
print "<table width=\"100%\" cellspacing=2><tr><td valign=\"top\">";
/*
* Produits
*/
$sql = "SELECT p.label as product, p.ref, pt.price, pt.qty";
$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);
if ($result)
{
$num = $db->num_rows();
$i = 0; $total = 0;
print "<p><b>Produits</b><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">";
print "<TR class=\"liste_titre\">";
print "<td>Réf</td><td>Produit</td>";
print "<td align=\"right\">Prix</TD><td align=\"center\">Qté.</td>";
print "</TR>\n";
$var=True;
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows();
$i = 0; $total = 0;
print "<p><b>Produits</b><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">";
print "<TR class=\"liste_titre\">";
print "<td>Réf</td><td>Produit</td>";
print "<td align=\"right\">Prix</TD><td align=\"center\">Qté.</td>";
print "</TR>\n";
$var=True;
while ($i < $num) {
$objp = $db->fetch_object( $i);
$var=!$var;
print "<TR $bc[$var]>";
print "<TD>[$objp->ref]</TD>\n";
print "<TD>$objp->product</TD>\n";
print "<TD align=\"right\">".price($objp->price)."</TD><td align=\"center\">".$objp->qty."</td>\n";
print "</tr>";
$total = $total + $objp->price;
$i++;
}
//print "<tr><td align=\"right\" colspan=\"3\">Total : <b>".price($total)."</b></td><td>Euros HT</td></tr>\n";
print "</table>";
}
/*
*
*/
print "</td></tr>";
print "</table>";
/*
* Actions
*/
print "<p><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\"><tr>";
if ($obj->statut == 0) {
print "<td bgcolor=\"#e0e0e0\" align=\"center\" width=\"25%\">[<a href=\"$PHP_SELF?propalid=$propalid&action=delete\">Supprimer</a>]</td>";
} else {
if ($obj->statut == 1) {
print "<td bgcolor=\"#e0e0e0\" align=center>[<a href=\"$PHP_SELF?propalid=$propalid&action=statut\">Cloturer</a>]</td>";
} else {
while ($i < $num)
{
$objp = $db->fetch_object( $i);
$var=!$var;
print "<TR $bc[$var]>";
print "<TD>[$objp->ref]</TD>\n";
print "<TD>$objp->product</TD>\n";
print "<TD align=\"right\">".price($objp->price)."</TD><td align=\"center\">".$objp->qty."</td>\n";
print "</tr>";
$total = $total + $objp->price;
$i++;
}
//print "<tr><td align=\"right\" colspan=\"3\">Total : <b>".price($total)."</b></td><td>Euros HT</td></tr>\n";
print "</table>";
}
/*
*
*/
print "</td></tr>";
print "</table>";
/*
* Actions
*/
print "<p><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\"><tr>";
if ($obj->statut == 0) {
print "<td bgcolor=\"#e0e0e0\" align=\"center\" width=\"25%\">[<a href=\"$PHP_SELF?propalid=$propalid&action=delete\">Supprimer</a>]</td>";
} else {
if ($obj->statut == 1) {
print "<td bgcolor=\"#e0e0e0\" align=center>[<a href=\"$PHP_SELF?propalid=$propalid&action=statut\">Cloturer</a>]</td>";
} else {
print "<td align=\"center\" width=\"25%\">-</td>";
}
}
print "<td align=\"center\" width=\"25%\">-</td>";
}
}
print "<td align=\"center\" width=\"25%\">-</td>";
if ($obj->statut == 1) {
$file = $conf->propal->outputdir. "/$obj->ref/$obj->ref.pdf";
if (file_exists($file)) {
print "<td bgcolor=\"#e0e0e0\" align=\"center\" width=\"25%\">";
print "[<a href=\"$PHP_SELF?propalid=$propalid&action=presend\">Envoyer la propale par mail</a>]</td>";
} else {
print "<td bgcolor=\"#e0e0e0\" align=\"center\" width=\"25%\">! Propale non generee !</td>";
}
} else {
print "<td align=\"center\" width=\"25%\">-</td>";
}
if ($obj->statut == 0) {
print "<td bgcolor=\"#e0e0e0\" align=\"center\" width=\"25%\">[<a href=\"$PHP_SELF?propalid=$propalid&valid=1\">Valider</a>]</td>";
} else {
print "<td align=\"center\" width=\"25%\">-</td>";
}
print "</tr></table>";
/*
*
*/
/*
* Send
*
*/
if ($action == 'send') {
$file = $GLOBALS["GLJ_ROOT"] . "/www-sys/doc/propal/$obj->ref/$obj->ref.pdf";
if (file_exists($file)) {
$subject = "Notre proposition commerciale $obj->ref";
$message = "Veuillez trouver ci-joint notre proposition commerciale $obj->ref\n\nCordialement\n\n";
$filepath = $file ;
$filename = "$obj->ref.pdf";
$mimetype = "application/pdf";
$replyto = "$replytoname <$replytomail>";
$mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filepath,$mimetype, $filename);
if ( $mailfile->sendfile() ) {
print "<p>envoy&eacute; &agrave; $sendto";
print "<p>envoy&eacute; par ".htmlentities($replyto);
if ($obj->statut == 1) {
$file = $conf->propal->outputdir. "/$obj->ref/$obj->ref.pdf";
if (file_exists($file)) {
print "<td bgcolor=\"#e0e0e0\" align=\"center\" width=\"25%\">";
print "[<a href=\"$PHP_SELF?propalid=$propalid&action=presend\">Envoyer la propale par mail</a>]</td>";
} else {
print "<td bgcolor=\"#e0e0e0\" align=\"center\" width=\"25%\">! Propale non generee !</td>";
}
} else {
print "<td align=\"center\" width=\"25%\">-</td>";
}
if ($obj->statut == 0) {
print "<td bgcolor=\"#e0e0e0\" align=\"center\" width=\"25%\">[<a href=\"$PHP_SELF?propalid=$propalid&valid=1\">Valider</a>]</td>";
} else {
print "<td align=\"center\" width=\"25%\">-</td>";
}
print "</tr></table>";
/*
*
*/
/*
* Send
*
*/
if ($action == 'send') {
$file = $GLOBALS["GLJ_ROOT"] . "/www-sys/doc/propal/$obj->ref/$obj->ref.pdf";
if (file_exists($file)) {
$subject = "Notre proposition commerciale $obj->ref";
$message = "Veuillez trouver ci-joint notre proposition commerciale $obj->ref\n\nCordialement\n\n";
$filepath = $file ;
$filename = "$obj->ref.pdf";
$mimetype = "application/pdf";
$replyto = "$replytoname <$replytomail>";
$mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filepath,$mimetype, $filename);
if ( $mailfile->sendfile() ) {
print "<p>envoy&eacute; &agrave; $sendto";
print "<p>envoy&eacute; par ".htmlentities($replyto);
} else {
print "<b>!! erreur d'envoi";
}

View File

@ -122,13 +122,14 @@ if ($propalid) {
print '<tr><td>'.translate("Date").'</td><td colspan="2">'.strftime("%A %d %B %Y",$obj->dp).'</td></tr>';
if ($obj->fk_projet) {
$projet = new Project();
$projet->fetch($db,$obj->fk_projet);
print '<tr><td>Projet</td><td colspan="1">';
print '<a href="projet/fiche.php3?id='.$projet->id.'">';
print $projet->title.'</a></td></tr>';
}
if ($obj->fk_projet)
{
$projet = new Project($db);
$projet->fetch($obj->fk_projet);
print '<tr><td>Projet</td><td colspan="1">';
print '<a href="projet/fiche.php3?id='.$projet->id.'">';
print $projet->title.'</a></td></tr>';
}
print "<tr><td>Destinataire</td><td colspan=\"2\">$obj->firstname $obj->name &lt;$obj->email&gt;</td></tr>";
/*
*

View File

@ -20,7 +20,9 @@
*
*/
class Contact {
class Contact
{
var $bs;
var $db;
@ -31,46 +33,71 @@ class Contact {
var $code;
var $email;
Function Contact($DB, $id=0) {
Function Contact($DB, $id=0)
{
$this->db = $DB;
$this->id = $id;
return 1;
}
$this->db = $DB;
$this->id = $id;
return 1;
}
/*
*
*
*
*/
Function fetch($id) {
Function fetch($id)
{
$sql = "SELECT c.idp, c.idp, c.name, c.firstname";
$sql .= " FROM socpeople as c";
$sql .= " WHERE c.idp = $id";
$result = $this->db->query($sql);
$sql = "SELECT c.idp, c.idp, c.name, c.firstname";
$sql .= " FROM socpeople as c";
$sql .= " WHERE c.idp = $id";
$result = $this->db->query($sql);
if ($result)
{
if ($this->db->num_rows())
{
$obj = $this->db->fetch_object($result , 0);
if ($result) {
if ($this->db->num_rows()) {
$obj = $this->db->fetch_object($result , 0);
$this->id = $obj->idp;
$this->nom = $obj->name;
$this->prenom = $obj->firstname;
$this->fullname = $this->prenom . ' ' . $this->nom;
$this->code = $obj->code;
$this->email = $obj->email;
}
$this->id = $obj->idp;
$this->nom = $obj->name;
$this->prenom = $obj->firstname;
$this->fullname = $this->prenom . ' ' . $this->nom;
$this->code = $obj->code;
$this->email = $obj->email;
}
$this->db->free();
} else {
print $this->db->error();
$this->db->free();
}
else
{
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;
}
}