From 5937f7d222e3905650f3dd52362c861af47c50b7 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Fri, 30 Jan 2004 11:00:57 +0000 Subject: [PATCH] Ajout prefix des tables --- htdocs/fourn/contact.php | 4 ++-- htdocs/fourn/fiche.php | 20 ++++++++++---------- htdocs/fourn/index.php | 10 +++++----- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/fourn/contact.php b/htdocs/fourn/contact.php index aee8b6acb98..9515031de80 100644 --- a/htdocs/fourn/contact.php +++ b/htdocs/fourn/contact.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2001-2004 Rodolphe Quiedeville * * 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 @@ -54,7 +54,7 @@ $offset = $limit * $page ; */ $sql = "SELECT s.idp, s.nom, st.libelle as stcomm, p.idp as cidp, p.name, p.firstname, p.email, p.phone "; -$sql .= " FROM llx_societe as s, llx_socpeople as p, c_stcomm as st"; +$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."socpeople as p, ".MAIN_DB_PREFIX."c_stcomm as st"; $sql .= " WHERE s.fk_stcomm = st.id AND s.fournisseur = 1 AND s.idp = p.fk_soc"; if (strlen($stcomm)) { diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/fiche.php index fe0ed0bfd0f..deef7f1f975 100644 --- a/htdocs/fourn/fiche.php +++ b/htdocs/fourn/fiche.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2001-2004 Rodolphe Quiedeville * Copyright (C) 2003 Éric Seigne * * This program is free software; you can redistribute it and/or modify @@ -52,12 +52,12 @@ if ($action == 'attribute_prefix') if ($action == 'recontact') { $dr = mktime(0, 0, 0, $remonth, $reday, $reyear); - $sql = "INSERT INTO llx_soc_recontact (fk_soc, datere, author) VALUES ($socid, $dr,'". $GLOBALS["REMOTE_USER"]."')"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."soc_recontact (fk_soc, datere, author) VALUES ($socid, $dr,'". $GLOBALS["REMOTE_USER"]."')"; $result = $db->query($sql); } if ($action == 'note') { - $sql = "UPDATE llx_societe SET note='$note' WHERE idp=$socid"; + $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET note='$note' WHERE idp=$socid"; $result = $db->query($sql); } @@ -68,7 +68,7 @@ if ($action == 'stcomm') { $result = @$db->query($sql); if ($result) { - $sql = "UPDATE llx_societe SET fk_stcomm=$stcommid WHERE idp=$socid"; + $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=$stcommid WHERE idp=$socid"; $result = $db->query($sql); } else { $errmesg = "ERREUR DE DATE !"; @@ -77,7 +77,7 @@ if ($action == 'stcomm') { if ($actioncommid) { - $sql = "INSERT INTO llx_actioncomm (datea, fk_action, fk_soc, fk_user_author) VALUES ('$dateaction',$actioncommid,$socid,'" . $user->id . "')"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm (datea, fk_action, fk_soc, fk_user_author) VALUES ('$dateaction',$actioncommid,$socid,'" . $user->id . "')"; $result = @$db->query($sql); if (!$result) @@ -94,7 +94,7 @@ if ($action == 'stcomm') { */ if ($mode == 'search') { if ($mode-search == 'soc') { - $sql = "SELECT s.idp FROM llx_societe as s "; + $sql = "SELECT s.idp FROM ".MAIN_DB_PREFIX."societe as s "; $sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'"; } @@ -117,7 +117,7 @@ if ($socid > 0) $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"; - $sql .= " FROM llx_societe as s, c_stcomm as st, c_typent as t, c_effectif as e "; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st, ".MAIN_DB_PREFIX."c_typent as t, ".MAIN_DB_PREFIX."c_effectif as e "; $sql .= " WHERE s.fk_stcomm=st.id AND s.fk_typent = t.id AND s.fk_effectif = e.id"; if ($to == 'next') @@ -181,7 +181,7 @@ if ($socid > 0) * */ $sql = "SELECT p.rowid,p.libelle,p.facnumber,".$db->pdate("p.datef")." as df"; - $sql .= " FROM llx_facture_fourn as p WHERE p.fk_soc = $objsoc->idp"; + $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as p WHERE p.fk_soc = $objsoc->idp"; $sql .= " ORDER BY p.datef DESC LIMIT 0,4"; if ( $db->query($sql) ) { @@ -234,7 +234,7 @@ if ($socid > 0) print "idp&action=addcontact\">Ajouter"; $sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note"; - $sql .= " FROM llx_socpeople as p WHERE p.fk_soc = $objsoc->idp ORDER by p.datec"; + $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p WHERE p.fk_soc = $objsoc->idp ORDER by p.datec"; $result = $db->query($sql); $i = 0 ; $num = $db->num_rows(); $tag = True; while ($i < $num) @@ -278,7 +278,7 @@ if ($socid > 0) * */ $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 llx_actioncomm as a, c_actioncomm as c, llx_user as u "; + $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."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 "; diff --git a/htdocs/fourn/index.php b/htdocs/fourn/index.php index 497d393572b..64892e9e5b9 100644 --- a/htdocs/fourn/index.php +++ b/htdocs/fourn/index.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2001-2004 Rodolphe Quiedeville * * 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 @@ -36,7 +36,7 @@ llxHeader(); if ($action == 'note') { - $sql = "UPDATE llx_societe SET note='$note' WHERE idp=$socid"; + $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET note='$note' WHERE idp=$socid"; $result = $db->query($sql); } @@ -47,7 +47,7 @@ if ($action == 'stcomm') { $result = @$db->query($sql); if ($result) { - $sql = "UPDATE llx_societe SET fk_stcomm=$stcommid WHERE idp=$socid"; + $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=$stcommid WHERE idp=$socid"; $result = $db->query($sql); } else { $errmesg = "ERREUR DE DATE !"; @@ -77,7 +77,7 @@ $pagenext = $page + 1; */ if ($mode == 'search') { if ($mode-search == 'soc') { - $sql = "SELECT s.idp FROM llx_societe as s "; + $sql = "SELECT s.idp FROM ".MAIN_DB_PREFIX."societe as s "; $sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'"; } @@ -108,7 +108,7 @@ if ($sortfield == "") print_barre_liste("Liste des fournisseurs",$page, $PHP_SELF); -$sql = "SELECT s.idp, s.nom, s.ville,".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, st.libelle as stcomm, s.prefix_comm FROM llx_societe as s, c_stcomm as st WHERE s.fk_stcomm = st.id AND s.fournisseur=1"; +$sql = "SELECT s.idp, s.nom, s.ville,".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, st.libelle as stcomm, s.prefix_comm FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st WHERE s.fk_stcomm = st.id AND s.fournisseur=1"; if (strlen($stcomm)) { $sql .= " AND s.fk_stcomm=$stcomm";