Mise à jour des noms de tables

This commit is contained in:
Rodolphe Quiedeville 2003-05-25 16:23:14 +00:00
parent 87f0958e60
commit 23dc6502ef
6 changed files with 55 additions and 45 deletions

View File

@ -125,7 +125,7 @@ if ($socid) {
print_barre_liste("Liste des actions commerciales effectuées sur " . $societe->nom,$page, $PHP_SELF); print_barre_liste("Liste des actions commerciales effectuées sur " . $societe->nom,$page, $PHP_SELF);
$sql = "SELECT a.id,".$db->pdate("a.datea")." as da, c.libelle, u.code, a.note, u.name, u.firstname "; $sql = "SELECT a.id,".$db->pdate("a.datea")." as da, c.libelle, u.code, a.note, u.name, u.firstname ";
$sql .= " FROM actioncomm as a, c_actioncomm as c, llx_user as u"; $sql .= " FROM llx_actioncomm as a, c_actioncomm as c, llx_user as u";
$sql .= " WHERE a.fk_soc = $socid AND c.id=a.fk_action AND a.fk_user_author = u.rowid"; $sql .= " WHERE a.fk_soc = $socid AND c.id=a.fk_action AND a.fk_user_author = u.rowid";
if ($type) { if ($type) {
@ -167,8 +167,8 @@ else
print_barre_liste("Liste des actions commerciales effectuées",$page, $PHP_SELF); print_barre_liste("Liste des actions commerciales effectuées",$page, $PHP_SELF);
$sql = "SELECT s.nom as societe, s.idp as socidp,a.id,".$db->pdate("a.datea")." as da, a.datea, c.libelle, u.code, a.fk_contact "; $sql = "SELECT s.nom as llx_societe, s.idp as socidp,a.id,".$db->pdate("a.datea")." as da, a.datea, c.libelle, u.code, a.fk_contact ";
$sql .= " FROM actioncomm as a, c_actioncomm as c, societe as s, llx_user as u"; $sql .= " FROM llx_actioncomm as a, c_actioncomm as c, llx_societe as s, llx_user as u";
$sql .= " WHERE a.fk_soc = s.idp AND c.id=a.fk_action AND a.fk_user_author = u.rowid"; $sql .= " WHERE a.fk_soc = s.idp AND c.id=a.fk_action AND a.fk_user_author = u.rowid";
if ($type) { if ($type) {

View File

@ -58,7 +58,7 @@ print_barre_liste("Liste des contacts",$page, $PHP_SELF,"",$sortfield,$sortorder
$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 llx_societe as s, llx_socpeople as p, c_stcomm as st WHERE s.fk_stcomm = st.id AND s.idp = p.fk_soc";
if (strlen($stcomm)) // statut commercial if (strlen($stcomm)) // statut commercial
{ {

View File

@ -50,7 +50,7 @@ if ($action == 'recontact') {
} }
if ($action == 'note') { if ($action == 'note') {
$sql = "UPDATE societe SET note='$note' WHERE idp=$socid"; $sql = "UPDATE llx_societe SET note='$note' WHERE idp=$socid";
$result = $db->query($sql); $result = $db->query($sql);
} }
@ -61,7 +61,7 @@ if ($action == 'stcomm') {
$result = @$db->query($sql); $result = @$db->query($sql);
if ($result) { if ($result) {
$sql = "UPDATE societe SET fk_stcomm=$stcommid WHERE idp=$socid"; $sql = "UPDATE llx_societe SET fk_stcomm=$stcommid WHERE idp=$socid";
$result = $db->query($sql); $result = $db->query($sql);
} else { } else {
$errmesg = "ERREUR DE DATE !"; $errmesg = "ERREUR DE DATE !";
@ -69,7 +69,7 @@ if ($action == 'stcomm') {
} }
if ($actioncommid) { if ($actioncommid) {
$sql = "INSERT INTO actioncomm (datea, fk_action, fk_soc, fk_user_author) VALUES ('$dateaction',$actioncommid,$socid,'" . $user->id . "')"; $sql = "INSERT INTO llx_actioncomm (datea, fk_action, fk_soc, fk_user_author) VALUES ('$dateaction',$actioncommid,$socid,'" . $user->id . "')";
$result = @$db->query($sql); $result = @$db->query($sql);
if (!$result) { if (!$result) {
@ -85,7 +85,7 @@ if ($action == 'stcomm') {
*/ */
if ($mode == 'search') { if ($mode == 'search') {
if ($mode-search == 'soc') { if ($mode-search == 'soc') {
$sql = "SELECT s.idp FROM societe as s "; $sql = "SELECT s.idp FROM llx_societe as s ";
$sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'"; $sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'";
} }
@ -114,7 +114,7 @@ if ($socid > 0) {
$societe = new Societe($db, $socid); $societe = new Societe($db, $socid);
$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.address,s.cp,s.ville, s.note, t.libelle as typent, e.libelle as effectif, s.siren, s.prefix_comm, s.services,s.parent, s.description FROM societe as s, c_stcomm as st, c_typent as t, c_effectif as e "; $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.address,s.cp,s.ville, s.note, t.libelle as typent, e.libelle as effectif, s.siren, s.prefix_comm, s.services,s.parent, s.description FROM llx_societe as s, c_stcomm as st, c_typent as t, c_effectif as e ";
$sql .= " WHERE s.fk_stcomm=st.id AND s.fk_typent = t.id AND s.fk_effectif = e.id"; $sql .= " WHERE s.fk_stcomm=st.id AND s.fk_typent = t.id AND s.fk_effectif = e.id";
if ($to == 'next') { if ($to == 'next') {
@ -201,7 +201,7 @@ if ($socid > 0) {
print '<TABLE border="0" width="100%" cellspacing="0" cellpadding="1">'; print '<TABLE border="0" width="100%" cellspacing="0" cellpadding="1">';
$sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price, p.ref, p.remise, ".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid"; $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price, p.ref, p.remise, ".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid";
$sql .= " FROM societe as s, llx_propal as p, c_propalst as c WHERE p.fk_soc = s.idp AND p.fk_statut = c.id"; $sql .= " FROM llx_societe as s, llx_propal as p, c_propalst as c WHERE p.fk_soc = s.idp AND p.fk_statut = c.id";
$sql .= " AND s.idp = $objsoc->idp ORDER BY p.datep DESC"; $sql .= " AND s.idp = $objsoc->idp ORDER BY p.datep DESC";
if ( $db->query($sql) ) { if ( $db->query($sql) ) {
@ -292,7 +292,7 @@ if ($socid > 0) {
print "<td>Fax</td><td>Email</td>"; print "<td>Fax</td><td>Email</td>";
print "<td align=\"center\"><a href=\"people.php3?socid=$objsoc->idp&action=addcontact\">Ajouter</a></td></tr>"; print "<td align=\"center\"><a href=\"people.php3?socid=$objsoc->idp&action=addcontact\">Ajouter</a></td></tr>";
$sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note FROM socpeople as p WHERE p.fk_soc = $objsoc->idp ORDER by p.datec"; $sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note FROM llx_socpeople as p WHERE p.fk_soc = $objsoc->idp 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)
@ -334,7 +334,7 @@ if ($socid > 0) {
print '<td valign="top">'; print '<td valign="top">';
$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 = "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 .= " FROM llx_actioncomm as a, c_actioncomm as c, llx_user as u ";
$sql .= " WHERE a.fk_soc = $objsoc->idp "; $sql .= " WHERE a.fk_soc = $objsoc->idp ";
$sql .= " AND u.rowid = a.fk_user_author"; $sql .= " AND u.rowid = a.fk_user_author";
$sql .= " AND c.id=a.fk_action AND a.percent < 100"; $sql .= " AND c.id=a.fk_action AND a.percent < 100";
@ -410,7 +410,7 @@ if ($socid > 0) {
print '<td valign="top">'; print '<td valign="top">';
$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 = "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 .= " FROM llx_actioncomm as a, c_actioncomm as c, llx_user as u ";
$sql .= " WHERE a.fk_soc = $objsoc->idp "; $sql .= " WHERE a.fk_soc = $objsoc->idp ";
$sql .= " AND u.rowid = a.fk_user_author"; $sql .= " AND u.rowid = a.fk_user_author";
$sql .= " AND c.id=a.fk_action AND a.percent = 100"; $sql .= " AND c.id=a.fk_action AND a.percent = 100";

View File

@ -1,5 +1,5 @@
<?PHP <?PHP
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* *
* 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
@ -44,14 +44,16 @@ function valeur($sql)
$db = new Db(); $db = new Db();
if ($action == 'add_bookmark') { if ($action == 'add_bookmark')
{
$sql = "INSERT INTO llx_bookmark (fk_soc, dateb, fk_user) VALUES ($socidp, now(),".$user->id.");"; $sql = "INSERT INTO llx_bookmark (fk_soc, dateb, fk_user) VALUES ($socidp, now(),".$user->id.");";
if (! $db->query($sql) ) { if (! $db->query($sql) ) {
print $db->error(); print $db->error();
} }
} }
if ($action == 'del_bookmark') { if ($action == 'del_bookmark')
{
$sql = "DELETE FROM llx_bookmark WHERE rowid=$bid"; $sql = "DELETE FROM llx_bookmark WHERE rowid=$bid";
$result = $db->query($sql); $result = $db->query($sql);
} }
@ -69,13 +71,15 @@ print "<td colspan=\"2\">Propositions commerciales</td>";
print "</TR>\n"; print "</TR>\n";
$sql = "SELECT count(*) FROM llx_propal WHERE fk_statut = 0"; $sql = "SELECT count(*) FROM llx_propal WHERE fk_statut = 0";
if (valeur($sql)) { if (valeur($sql))
{
$var=!$var; $var=!$var;
print "<tr $bc[$var]><td><a href=\"propal.php3?viewstatut=0\">Brouillons</a></td><td align=\"right\">".valeur($sql)."</td></tr>"; print "<tr $bc[$var]><td><a href=\"propal.php3?viewstatut=0\">Brouillons</a></td><td align=\"right\">".valeur($sql)."</td></tr>";
} }
$sql = "SELECT count(*) FROM llx_propal WHERE fk_statut = 1"; $sql = "SELECT count(*) FROM llx_propal WHERE fk_statut = 1";
if (valeur($sql)) { if (valeur($sql))
{
$var=!$var; $var=!$var;
print "<tr $bc[$var]><td><a href=\"propal.php3?viewstatut=1\">Ouvertes</a></td><td align=\"right\">".valeur($sql)."</td></tr>"; print "<tr $bc[$var]><td><a href=\"propal.php3?viewstatut=1\">Ouvertes</a></td><td align=\"right\">".valeur($sql)."</td></tr>";
} }
@ -88,11 +92,12 @@ print "</table><br>";
*/ */
$sql = "SELECT s.idp, s.nom,b.rowid as bid"; $sql = "SELECT s.idp, s.nom,b.rowid as bid";
$sql .= " FROM societe as s, llx_bookmark as b"; $sql .= " FROM llx_societe as s, llx_bookmark as b";
$sql .= " WHERE b.fk_soc = s.idp AND b.fk_user = ".$user->id; $sql .= " WHERE b.fk_soc = s.idp AND b.fk_user = ".$user->id;
$sql .= " ORDER BY lower(s.nom) ASC"; $sql .= " ORDER BY lower(s.nom) ASC";
if ( $db->query($sql) ) { if ( $db->query($sql) )
{
$num = $db->num_rows(); $num = $db->num_rows();
$i = 0; $i = 0;
@ -101,16 +106,17 @@ if ( $db->query($sql) ) {
print "<TD colspan=\"2\">Bookmark</td>"; print "<TD colspan=\"2\">Bookmark</td>";
print "</TR>\n"; print "</TR>\n";
while ($i < $num) { while ($i < $num)
$obj = $db->fetch_object( $i); {
$var = !$var; $obj = $db->fetch_object( $i);
print "<tr $bc[$var]>"; $var = !$var;
print '<td><a href="fiche.php3?socid='.$obj->idp.'">'.$obj->nom.'</a></td>'; print "<tr $bc[$var]>";
print '<td align="right"><a href="index.php3?action=del_bookmark&bid='.$obj->bid.'">'; print '<td><a href="fiche.php3?socid='.$obj->idp.'">'.$obj->nom.'</a></td>';
print '<img src="/theme/'.$conf->theme.'/img/editdelete.png" border="0"></a></td>'; print '<td align="right"><a href="index.php3?action=del_bookmark&bid='.$obj->bid.'">';
print '</tr>'; print '<img src="/theme/'.$conf->theme.'/img/editdelete.png" border="0"></a></td>';
$i++; print '</tr>';
} $i++;
}
print '</table>'; print '</table>';
} }
/* /*
@ -121,7 +127,7 @@ if ( $db->query($sql) ) {
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, p.name, s.nom as sname"; $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 .= " FROM llx_actioncomm as a, c_actioncomm as c, llx_socpeople as p, llx_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 .= " 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";

View File

@ -1,5 +1,5 @@
<?PHP <?PHP
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* *
* 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
@ -36,7 +36,7 @@ if ($action == 'add')
if (strlen(trim($name)) + strlen(trim($firstname)) > 0) if (strlen(trim($name)) + strlen(trim($firstname)) > 0)
{ {
$sql = "INSERT INTO socpeople (datec, fk_soc,name, firstname, poste, phone,fax,email) "; $sql = "INSERT INTO llx_socpeople (datec, fk_soc,name, firstname, poste, phone,fax,email) ";
$sql .= " VALUES (now(),$socid,'$name','$firstname','$poste','$phone','$fax','$email')"; $sql .= " VALUES (now(),$socid,'$name','$firstname','$poste','$phone','$fax','$email')";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
@ -69,18 +69,17 @@ if ($action == 'update')
} }
} }
llxHeader(); /*
*
*
*/
if ($page == -1) { $page = 0 ; } llxHeader();
$limit = 26;
$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 = "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 llx_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')
@ -134,7 +133,7 @@ if ($socid > 0)
print "<td><b>Fax</b></td><td><b>Email</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 = "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 llx_socpeople as p WHERE p.fk_soc = $objsoc->idp";
if ($contactid) if ($contactid)
{ {
@ -190,7 +189,7 @@ if ($socid > 0)
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 llx_socpeople as p WHERE p.idp = $contactid";
$result = $db->query($sql); $result = $db->query($sql);
$num = $db->num_rows(); $num = $db->num_rows();
@ -226,7 +225,7 @@ if ($socid > 0)
print "<td>Fax</td><td>Email</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 = "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 .= " FROM llx_actioncomm as a, c_actioncomm as c, llx_user as u ";
$sql .= " WHERE a.fk_soc = $objsoc->idp "; $sql .= " WHERE a.fk_soc = $objsoc->idp ";
$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 ";

View File

@ -51,7 +51,7 @@ class Contact
{ {
$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 llx_socpeople as c";
$sql .= " WHERE c.idp = $id"; $sql .= " WHERE c.idp = $id";
$result = $this->db->query($sql); $result = $this->db->query($sql);
@ -81,12 +81,17 @@ class Contact
} }
} }
/*
*
*
*/
Function update($id) Function update($id)
{ {
$this->email = trim($this->email); $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 = "UPDATE llx_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"; $sql .= " WHERE idp=$id";
$result = $this->db->query($sql); $result = $this->db->query($sql);