diff --git a/htdocs/domain/index.php b/htdocs/domain/index.php
index a019bdb0508..b8f5056c49c 100644
--- a/htdocs/domain/index.php
+++ b/htdocs/domain/index.php
@@ -27,7 +27,7 @@ llxHeader();
if ($action == 'add') {
$author = $GLOBALS["REMOTE_USER"];
- $sql = "INSERT INTO llx_voyage (date_depart, date_arrivee, amount, depart, arrivee, fk_reduc, reduction) ";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."voyage (date_depart, date_arrivee, amount, depart, arrivee, fk_reduc, reduction) ";
$sql .= " VALUES ('$date_depart','$date_arrivee',$amount,'$depart','$arrivee',$reducid, $reduc);";
$result = $db->query($sql);
@@ -41,7 +41,7 @@ if ($action == 'add') {
}
if ($action == 'del') {
- /* $sql = "DELETE FROM llx_voyage WHERE rowid = $rowid";
+ /* $sql = "DELETE FROM ".MAIN_DB_PREFIX."voyage WHERE rowid = $rowid";
*$result = $db->query($sql);
*/
}
@@ -57,7 +57,7 @@ print_titre("Noms de domaines internet");
$sql = "SELECT label ";
-$sql .= " FROM llx_domain ORDER BY label ASC";
+$sql .= " FROM ".MAIN_DB_PREFIX."domain ORDER BY label ASC";
$result = $db->query($sql);
if ($result) {
diff --git a/htdocs/expedition/commande.php b/htdocs/expedition/commande.php
index b61b0a31446..e7662403b87 100644
--- a/htdocs/expedition/commande.php
+++ b/htdocs/expedition/commande.php
@@ -125,7 +125,7 @@ if ($_GET["id"] > 0)
echo '
';
$sql = "SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice";
- $sql .= " FROM llx_commandedet as l LEFT JOIN llx_product as p ON (p.rowid = l.fk_product) WHERE l.fk_commande = ".$commande->id." AND p.fk_product_type <> 1 ORDER BY l.rowid";
+ $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as l LEFT JOIN ".MAIN_DB_PREFIX."product as p ON (p.rowid = l.fk_product) WHERE l.fk_commande = ".$commande->id." AND p.fk_product_type <> 1 ORDER BY l.rowid";
$result = $db->query($sql);
if ($result)
@@ -239,7 +239,7 @@ if ($_GET["id"] > 0)
if ($value > 0)
{
$sql = "SELECT e.label as entrepot, ps.reel, p.label ";
- $sql .= " FROM llx_entrepot as e, llx_product_stock as ps, llx_product as p";
+ $sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e, ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product as p";
$sql .= " WHERE e.rowid = ps.fk_entrepot AND ps.fk_product = p.rowid AND ps.fk_product = $key";
$sql .= " AND e.statut = 1 AND reel < $value";
@@ -294,7 +294,7 @@ if ($_GET["id"] > 0)
*
*/
$sql = "SELECT cd.fk_product, cd.description, cd.rowid, cd.qty as qty_commande, ed.qty as qty_livre, e.ref, e.rowid as expedition_id";
- $sql .= " FROM llx_commandedet as cd , llx_expeditiondet as ed, llx_expedition as e";
+ $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd , ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."expedition as e";
$sql .= " WHERE cd.fk_commande = ".$commande->id." AND cd.rowid = ed.fk_commande_ligne AND ed.fk_expedition = e.rowid";
$sql .= " ORDER BY cd.fk_product";
$result = $db->query($sql);
diff --git a/htdocs/expedition/expedition.class.php b/htdocs/expedition/expedition.class.php
index 4d8df17e629..e304d2c5cb5 100644
--- a/htdocs/expedition/expedition.class.php
+++ b/htdocs/expedition/expedition.class.php
@@ -63,7 +63,7 @@ class Expedition
$this->user = $user;
$this->db->begin();
- $sql = "INSERT INTO llx_expedition (date_creation, fk_user_author, date_expedition, fk_commande, fk_entrepot) ";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."expedition (date_creation, fk_user_author, date_expedition, fk_commande, fk_entrepot) ";
$sql .= " VALUES (now(), $user->id, ".$this->db->idate($this->date_expedition).",$this->commande_id, $this->entrepot_id)";
if ( $this->db->query($sql) )
@@ -75,7 +75,7 @@ class Expedition
*
*/
- $sql = "UPDATE llx_expedition SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id;
+ $sql = "UPDATE ".MAIN_DB_PREFIX."expedition SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id;
if ($this->db->query($sql))
{
@@ -98,7 +98,7 @@ class Expedition
*
*
*/
- $sql = "UPDATE llx_commande SET fk_statut = 2 WHERE rowid=".$this->commande_id;
+ $sql = "UPDATE ".MAIN_DB_PREFIX."commande SET fk_statut = 2 WHERE rowid=".$this->commande_id;
if (! $this->db->query($sql))
{
$error++;
@@ -154,7 +154,7 @@ class Expedition
$error++;
}
- $sql = "INSERT INTO llx_expeditiondet (fk_expedition, fk_commande_ligne, qty)";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."expeditiondet (fk_expedition, fk_commande_ligne, qty)";
$sql .= " VALUES ($this->id,".$commande_ligne_id.",".$qty.")";
if (! $this->db->query($sql) )
@@ -176,7 +176,7 @@ class Expedition
{
$sql = "SELECT e.rowid, e.date_creation, e.ref, e.fk_user_author, e.fk_statut, e.fk_commande, e.fk_entrepot";
$sql .= ", ".$this->db->pdate("e.date_expedition")." as date_expedition ";
- $sql .= " FROM llx_expedition as e";
+ $sql .= " FROM ".MAIN_DB_PREFIX."expedition as e";
$sql .= " WHERE e.rowid = $id";
$result = $this->db->query($sql) ;
@@ -217,7 +217,7 @@ class Expedition
if ($user->rights->expedition->valider)
{
- $sql = "UPDATE llx_expedition SET ref='EXP".$this->id."', fk_statut = 1, date_valid=now(), fk_user_valid=$user->id";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."expedition SET ref='EXP".$this->id."', fk_statut = 1, date_valid=now(), fk_user_valid=$user->id";
$sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;";
if ($this->db->query($sql) )
@@ -256,7 +256,7 @@ class Expedition
$price = $p_price - $remise;
}
- $sql = "INSERT INTO llx_commandedet (fk_commande, fk_product, qty, price, tva_tx, description, remise_percent, subprice) VALUES ";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."commandedet (fk_commande, fk_product, qty, price, tva_tx, description, remise_percent, subprice) VALUES ";
$sql .= " (".$this->id.", $p_product_id,". $p_qty.",". $price.",".$p_tva_tx.",'". addslashes($p_desc) ."',$remise_percent, $subprice) ; ";
if ($this->db->query($sql) )
@@ -302,7 +302,7 @@ class Expedition
{
if ($this->statut == 0)
{
- $sql = "DELETE FROM llx_commandedet WHERE rowid = $idligne";
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."commandedet WHERE rowid = $idligne";
if ($this->db->query($sql) )
{
@@ -324,10 +324,10 @@ class Expedition
{
$this->db->begin();
- $sql = "DELETE FROM llx_expeditiondet WHERE fk_expedition = $this->id ;";
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition = $this->id ;";
if ( $this->db->query($sql) )
{
- $sql = "DELETE FROM llx_expedition WHERE rowid = $this->id;";
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."expedition WHERE rowid = $this->id;";
if ( $this->db->query($sql) )
{
$this->db->commit();
@@ -352,7 +352,7 @@ class Expedition
*/
Function classin($cat_id)
{
- $sql = "UPDATE llx_commande SET fk_projet = $cat_id";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."commande SET fk_projet = $cat_id";
$sql .= " WHERE rowid = $this->id;";
if ($this->db->query($sql) )
diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php
index 12c5419456c..cad52fa1fde 100644
--- a/htdocs/expedition/fiche.php
+++ b/htdocs/expedition/fiche.php
@@ -345,7 +345,7 @@ else
echo '
';
$sql = "SELECT cd.fk_product, cd.description, cd.rowid, cd.qty as qty_commande, ed.qty as qty_livre";
- $sql .= " FROM llx_commandedet as cd , llx_expeditiondet as ed";
+ $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd , ".MAIN_DB_PREFIX."expeditiondet as ed";
$sql .= " WHERE ed.fk_expedition = $id AND cd.rowid = ed.fk_commande_ligne ";
$result = $db->query($sql);
@@ -456,7 +456,7 @@ else
*
*/
$sql = "SELECT cd.fk_product, cd.description, cd.rowid, cd.qty as qty_commande, ed.qty as qty_livre, e.ref";
- $sql .= " FROM llx_commandedet as cd , llx_expeditiondet as ed, llx_expedition as e";
+ $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd , ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."expedition as e";
$sql .= " WHERE cd.fk_commande = $expedition->commande_id AND e.rowid <> $expedition->id AND cd.rowid = ed.fk_commande_ligne AND ed.fk_expedition = e.rowid";
$sql .= " ORDER BY cd.fk_product";
$result = $db->query($sql);
@@ -525,7 +525,7 @@ else
*
*/
$sql = "SELECT ".$db->pdate("a.datea")." as da, a.note";
- $sql .= " FROM llx_actioncomm as a WHERE a.fk_soc = $commande->socidp AND a.fk_action in (9,10) AND a.fk_commande = $id";
+ $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a WHERE a.fk_soc = $commande->socidp AND a.fk_action in (9,10) AND a.fk_commande = $id";
$result = $db->query($sql);
if ($result)
diff --git a/htdocs/expedition/index.php b/htdocs/expedition/index.php
index f29bb62f246..97b315a4bb4 100644
--- a/htdocs/expedition/index.php
+++ b/htdocs/expedition/index.php
@@ -40,7 +40,7 @@ print "
\n";
/*
* Expeditions à valider
*/
-$sql = "SELECT e.rowid, e.ref, s.nom, s.idp, c.ref as commande_ref, c.rowid as commande_id FROM llx_expedition as e, llx_societe as s, llx_commande as c";
+$sql = "SELECT e.rowid, e.ref, s.nom, s.idp, c.ref as commande_ref, c.rowid as commande_id FROM ".MAIN_DB_PREFIX."expedition as e, ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
$sql .= " WHERE e.fk_commande = c.rowid AND c.fk_soc = s.idp AND e.fk_statut = 0";
if ($socidp)
{
@@ -74,7 +74,7 @@ if ( $db->query($sql) )
/*
* Commandes à traiter
*/
-$sql = "SELECT c.rowid, c.ref, s.nom, s.idp FROM llx_commande as c, llx_societe as s";
+$sql = "SELECT c.rowid, c.ref, s.nom, s.idp FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE c.fk_soc = s.idp AND c.fk_statut = 1";
if ($socidp)
{
@@ -113,7 +113,7 @@ print '
';
/*
* Commandes en traitement
*/
-$sql = "SELECT c.rowid, c.ref, s.nom, s.idp FROM llx_commande as c, llx_societe as s";
+$sql = "SELECT c.rowid, c.ref, s.nom, s.idp FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE c.fk_soc = s.idp AND c.fk_statut = 2";
if ($socidp)
{
@@ -147,7 +147,7 @@ if ( $db->query($sql) )
/*
* Expeditions à valider
*/
-$sql = "SELECT e.rowid, e.ref, s.nom, s.idp, c.ref as commande_ref, c.rowid as commande_id FROM llx_expedition as e, llx_societe as s, llx_commande as c";
+$sql = "SELECT e.rowid, e.ref, s.nom, s.idp, c.ref as commande_ref, c.rowid as commande_id FROM ".MAIN_DB_PREFIX."expedition as e, ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
$sql .= " WHERE e.fk_commande = c.rowid AND c.fk_soc = s.idp AND e.fk_statut = 1";
if ($socidp)
{
diff --git a/htdocs/expedition/liste.php b/htdocs/expedition/liste.php
index 4da9a6f12fb..49bcec4f6c5 100644
--- a/htdocs/expedition/liste.php
+++ b/htdocs/expedition/liste.php
@@ -61,7 +61,7 @@ $pageprev = $_GET["page"] - 1;
$pagenext = $_GET["page"] + 1;
$sql = "SELECT e.rowid, e.ref,".$db->pdate("e.date_expedition")." as date_expedition, e.fk_statut" ;
-$sql .= " FROM llx_expedition as e ";
+$sql .= " FROM ".MAIN_DB_PREFIX."expedition as e ";
$sql_add = " WHERE ";
if ($socidp)
{
diff --git a/htdocs/expedition/stats/expeditionstats.class.php b/htdocs/expedition/stats/expeditionstats.class.php
index 48d3a82557b..d5d248f6f1f 100644
--- a/htdocs/expedition/stats/expeditionstats.class.php
+++ b/htdocs/expedition/stats/expeditionstats.class.php
@@ -35,7 +35,7 @@ class ExpeditionStats
Function getNbExpeditionByYear()
{
$result = array();
- $sql = "SELECT date_format(date_expedition,'%Y') as dm, count(*) FROM llx_expedition GROUP BY dm DESC WHERE fk_statut > 0";
+ $sql = "SELECT date_format(date_expedition,'%Y') as dm, count(*) FROM ".MAIN_DB_PREFIX."expedition GROUP BY dm DESC WHERE fk_statut > 0";
if ($this->db->query($sql))
{
$num = $this->db->num_rows();
@@ -58,7 +58,7 @@ class ExpeditionStats
Function getNbExpeditionByMonth($year)
{
$result = array();
- $sql = "SELECT date_format(date_expedition,'%m') as dm, count(*) FROM llx_expedition";
+ $sql = "SELECT date_format(date_expedition,'%m') as dm, count(*) FROM ".MAIN_DB_PREFIX."expedition";
$sql .= " WHERE date_format(date_expedition,'%Y') = $year AND fk_statut > 0";
$sql .= " GROUP BY dm DESC";
diff --git a/htdocs/expedition/stats/index.php b/htdocs/expedition/stats/index.php
index ef11458a264..3d27a56b846 100644
--- a/htdocs/expedition/stats/index.php
+++ b/htdocs/expedition/stats/index.php
@@ -33,7 +33,7 @@ print_fiche_titre('Statistiques exp
print '
';
print '
Année
Nb d\'expédition
';
-$sql = "SELECT count(*), date_format(date_expedition,'%Y') as dm FROM llx_expedition WHERE fk_statut > 0 GROUP BY dm DESC ";
+$sql = "SELECT count(*), date_format(date_expedition,'%Y') as dm FROM ".MAIN_DB_PREFIX."expedition WHERE fk_statut > 0 GROUP BY dm DESC ";
if ($db->query($sql))
{
$num = $db->num_rows();
diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php
index 92f6e4aeaa7..92f650663b2 100644
--- a/htdocs/fichinter/fiche.php
+++ b/htdocs/fichinter/fiche.php
@@ -34,7 +34,7 @@ if ($user->societe_id > 0)
if ($socidp)
{
- $sql = "SELECT s.nom, s.idp, s.prefix_comm FROM llx_societe as s WHERE s.idp = $socidp;";
+ $sql = "SELECT s.nom, s.idp, s.prefix_comm FROM ".MAIN_DB_PREFIX."societe as s WHERE s.idp = $socidp;";
$result = $db->query($sql);
if ($result)
@@ -115,7 +115,7 @@ if ($action == 'create')
{
$numpr = "FI-" . $objsoc->prefix_comm . "-" . strftime("%y%m%d", time());
- $sql = "SELECT count(*) FROM llx_propal WHERE ref like '$numpr%'";
+ $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."propal WHERE ref like '$numpr%'";
if ( $db->query($sql) )
{
@@ -201,7 +201,7 @@ if ($action == 'create')
print '