From 42988dbece8dc2bad757acab794b295608ca9a1f Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Thu, 12 Dec 2002 16:11:54 +0000 Subject: [PATCH] *** empty log message *** --- htdocs/comm/contact.php3 | 7 +- htdocs/comm/index.php3 | 58 +++---- htdocs/comm/people.php3 | 261 +++++++++++++++++-------------- htdocs/comm/propal.php3 | 319 +++++++++++++++++++------------------- htdocs/compta/propal.php3 | 15 +- htdocs/contact.class.php3 | 87 +++++++---- 6 files changed, 406 insertions(+), 341 deletions(-) diff --git a/htdocs/comm/contact.php3 b/htdocs/comm/contact.php3 index 2e624fb1754..ae33808e36a 100644 --- a/htdocs/comm/contact.php3 +++ b/htdocs/comm/contact.php3 @@ -1,8 +1,5 @@ - * - * $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"; diff --git a/htdocs/comm/index.php3 b/htdocs/comm/index.php3 index 6fedbb4c202..ac27e7475f2 100644 --- a/htdocs/comm/index.php3 +++ b/htdocs/comm/index.php3 @@ -1,8 +1,5 @@ - * - * $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 ''; } /* - * + * Actions commerciales a faire * * */ print ''; -$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 ''; - print ""; - print ""; + print ''; + print ''; print "\n"; $i = 0; - while ($i < $db->num_rows() ) { - $obj = $db->fetch_object($i); - $var=!$var; - - print ""; - $i++; - } + while ($i < $db->num_rows() ) + { + $obj = $db->fetch_object($i); + $var=!$var; + + print ""; + print ""; + $i++; + } $db->free(); print "
Actions à faire
Actions à faire
".strftime("%d %b %Y",$obj->da)."$obj->libelle $obj->label
".strftime("%d %b %Y",$obj->da)."id\">$obj->libelle $obj->label$obj->name$obj->sname

"; -} else { +} +else +{ print $db->error(); } diff --git a/htdocs/comm/people.php3 b/htdocs/comm/people.php3 index de3b058fa66..7958c8df3a8 100644 --- a/htdocs/comm/people.php3 +++ b/htdocs/comm/people.php3 @@ -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 "\n"; - print ""; - print ""; - - print ""; - print '
idp\">$objsoc->nomNotes[Ajouter un contact]
'; - - - - /* - * - */ + if ($result) + { + $objsoc = $db->fetch_object( 0); + /* + * + * + */ + print "\n"; + print ""; + print ""; + + print ""; + print '
idp\">$objsoc->nomNotes[Ajouter un contact]
'; + - print ""; - print ""; - print "
".nl2br($objsoc->note)."
"; + /* + * + */ - $bc1="bgcolor=\"#c0f0c0\""; - $bc3="bgcolor=\"#90c090\""; - $bc2="bgcolor=\"#b0e0b0\""; - } else { - print $db->error(); - } + 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"; + } - 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 ""; + while ($i < $num) + { + $obj = $db->fetch_object( $i); + if ($tag) + { + print ""; + } + else + { + print ""; + } + print ""; + print ""; + print ""; + print ""; + print ""; + print "\n"; + $i++; + $tag = !$tag; } - 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 
$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 "
"; - } + + + 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); + 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 ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ''; - print "
Numéro$obj->idp
Nomname\">Prenomfirstname\">
Posteposte\">
Telphone\">Faxfax\">
Emailemail\">
Note
"; - print ""; - print "
"; - } - /* * * @@ -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 ""; - - 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; + 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() . ''; } - } else { - print '' . $db->error() . ''; - } print ""; -} else { +} +else +{ print "Error"; } $db->free(); diff --git a/htdocs/comm/propal.php3 b/htdocs/comm/propal.php3 index 2efc346a968..e674bd5bfc2 100644 --- a/htdocs/comm/propal.php3 +++ b/htdocs/comm/propal.php3 @@ -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 ""; + $color1 = "#e0e0e0"; - print ''; - print ""; + print "
Société'.$obj->nom.'Note :
". nl2br($obj->note)."
"; - print ''; + print ''; + print ""; + + print ''; - if ($obj->fk_projet) { - $projet = new Project(); - $projet->fetch($db,$obj->fk_projet); - print ''; - } - print ""; - /* - * - */ + if ($obj->fk_projet) + { + $projet = new Project($db); + $projet->fetch($obj->fk_projet); + print ''; + } + print ""; + /* + * + */ - print ""; - /* - * - */ - - print ""; - - /* - * - */ - - $totalht = $propal->price - $propal->remise ; - - print ""; - /* - * - */ - print ''; - - /* - * - */ - print ""; - - print ''; + print ""; + /* + * + */ + + print ""; + + /* + * + */ + + $totalht = $propal->price - $propal->remise ; + + print ""; + /* + * + */ + print ''; + + /* + * + */ + print ""; + + print ''; - print "
Date'.strftime("%A %d %B %Y",$obj->dp).'
Société'.$obj->nom.'Note :
". nl2br($obj->note)."
Date'.strftime("%A %d %B %Y",$obj->dp).'
Projet'; - print ''; - print $projet->title.'
Destinataire$obj->firstname $obj->name <$obj->email>
Projet'; + print ''; + print $projet->title.'
Destinataire$obj->firstname $obj->name <$obj->email>
Montant HT".price($obj->price)." euros
Remise".price($obj->remise)." euros
Total HT".price($totalht)." euros
Auteur'; - $author = new User($db, $obj->fk_user_author); - $author->fetch(''); - print $author->fullname.'
Statut :$obj->lst
Montant HT".price($obj->price)." euros
Remise".price($obj->remise)." euros
Total HT".price($totalht)." euros
Auteur'; + $author = new User($db, $obj->fk_user_author); + $author->fetch(''); + print $author->fullname.'
Statut :$obj->lst
"; + print ""; - if ($action == 'statut') { - print "
"; - print ""; - print "'; - print '

'; - print "
"; - } + if ($action == 'statut') + { + print "
"; + print ""; + print "'; + print '

'; + print "
"; + } - print ""; + print "
"; - /* - * 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 ""; - print "
"; + /* + * 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 "

Produits"; + print ""; + print ""; + print ""; + print "\n"; + + $var=True; - $result = $db->query($sql); - if ($result) { - $num = $db->num_rows(); - $i = 0; $total = 0; - print "

Produits

RéfProduitPrixQté.
"; - print ""; - print ""; - print ""; - print "\n"; - - $var=True; - while ($i < $num) { - $objp = $db->fetch_object( $i); - $var=!$var; - print ""; - print "\n"; - print "\n"; - print "\n"; - print ""; - $total = $total + $objp->price; - $i++; - } - //print "\n"; - print "
RéfProduitPrixQté.
[$objp->ref]$objp->product".price($objp->price)."".$objp->qty."
Total : ".price($total)."Euros HT
"; - } - /* - * - */ - print "

"; - /* - * Actions - */ - print "

"; - - if ($obj->statut == 0) { - print ""; - } else { - if ($obj->statut == 1) { - print ""; - } else { + while ($i < $num) + { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + print "\n"; + print "\n"; + print ""; + $total = $total + $objp->price; + $i++; + } + //print "\n"; + print "
[Supprimer][Cloturer]
[$objp->ref]$objp->product".price($objp->price)."".$objp->qty."
Total : ".price($total)."Euros HT
"; + } + /* + * + */ + print "

"; + /* + * Actions + */ + print "

"; + + if ($obj->statut == 0) { + print ""; + } else { + if ($obj->statut == 1) { + print ""; + } else { + print ""; + } + } + print ""; - } - } - - print ""; - - if ($obj->statut == 1) { - $file = $conf->propal->outputdir. "/$obj->ref/$obj->ref.pdf"; - if (file_exists($file)) { - print ""; - } else { - print ""; - } - } else { - print ""; - } - if ($obj->statut == 0) { - print ""; - } else { - print ""; - } - print "
[Supprimer][Cloturer]---"; - print "[Envoyer la propale par mail]! Propale non generee !-[Valider]-
"; - /* - * - */ - - /* - * 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 "

envoyé à $sendto"; - print "

envoyé par ".htmlentities($replyto); + + if ($obj->statut == 1) { + $file = $conf->propal->outputdir. "/$obj->ref/$obj->ref.pdf"; + if (file_exists($file)) { + print ""; + print "[Envoyer la propale par mail]"; + } else { + print "! Propale non generee !"; + } + } else { + print "-"; + } + if ($obj->statut == 0) { + print "[Valider]"; + } else { + print "-"; + } + print ""; + /* + * + */ + + /* + * 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 "

envoyé à $sendto"; + print "

envoyé par ".htmlentities($replyto); } else { print "!! erreur d'envoi"; } diff --git a/htdocs/compta/propal.php3 b/htdocs/compta/propal.php3 index ce3d3658f61..75f33277333 100644 --- a/htdocs/compta/propal.php3 +++ b/htdocs/compta/propal.php3 @@ -122,13 +122,14 @@ if ($propalid) { print ''.translate("Date").''.strftime("%A %d %B %Y",$obj->dp).''; - if ($obj->fk_projet) { - $projet = new Project(); - $projet->fetch($db,$obj->fk_projet); - print 'Projet'; - print ''; - print $projet->title.''; - } + if ($obj->fk_projet) + { + $projet = new Project($db); + $projet->fetch($obj->fk_projet); + print 'Projet'; + print ''; + print $projet->title.''; + } print "Destinataire$obj->firstname $obj->name <$obj->email>"; /* * diff --git a/htdocs/contact.class.php3 b/htdocs/contact.class.php3 index 35d47ad61e4..a9500a69951 100644 --- a/htdocs/contact.class.php3 +++ b/htdocs/contact.class.php3 @@ -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; + } + }