diff --git a/htdocs/admin/adherent.php b/htdocs/admin/adherent.php index fad6472365e..02f2870afbc 100644 --- a/htdocs/admin/adherent.php +++ b/htdocs/admin/adherent.php @@ -42,9 +42,9 @@ $var=True; if ($HTTP_POST_VARS["action"] == 'update' || $HTTP_POST_VARS["action"] == 'add') { if (isset($HTTP_POST_VARS["consttype"]) && $HTTP_POST_VARS["consttype"] != ''){ - $sql = "REPLACE INTO llx_const SET name='".$_POST["constname"]."', value = '".$HTTP_POST_VARS["constvalue"]."',note='".$HTTP_POST_VARS["constnote"]."', type='".$typeconst[$HTTP_POST_VARS["consttype"]]."',visible=0"; + $sql = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name='".$_POST["constname"]."', value = '".$HTTP_POST_VARS["constvalue"]."',note='".$HTTP_POST_VARS["constnote"]."', type='".$typeconst[$HTTP_POST_VARS["consttype"]]."',visible=0"; }else{ - $sql = "REPLACE INTO llx_const SET name='".$_POST["constname"]."', value = '".$HTTP_POST_VARS["constvalue"]."',note='".$HTTP_POST_VARS["constnote"]."',visible=0"; + $sql = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name='".$_POST["constname"]."', value = '".$HTTP_POST_VARS["constvalue"]."',note='".$HTTP_POST_VARS["constnote"]."',visible=0"; } if ($db->query($sql)) @@ -63,7 +63,7 @@ if ($HTTP_POST_VARS["action"] == 'update' || $HTTP_POST_VARS["action"] == 'add') if ($action == 'set') { - $sql = "REPLACE INTO llx_const SET name = '$name', value='".$value."', visible=0"; + $sql = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = '$name', value='".$value."', visible=0"; if ($db->query($sql)) { @@ -73,7 +73,7 @@ if ($action == 'set') if ($action == 'unset') { - $sql = "DELETE FROM llx_const WHERE name = '$name'"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = '$name'"; if ($db->query($sql)) { @@ -267,7 +267,7 @@ function form_constantes($tableau){ $var=True; foreach($tableau as $const){ - $sql = "SELECT rowid, name, value, type, note FROM llx_const WHERE name='$const'"; + $sql = "SELECT rowid, name, value, type, note FROM ".MAIN_DB_PREFIX."const WHERE name='$const'"; $result = $db->query($sql); if ($result && ($db->num_rows() == 1)) { $obj = $db->fetch_object(0); diff --git a/htdocs/admin/boutique-special-all.php b/htdocs/admin/boutique-special-all.php index 8d7becb13dc..5a5beee92f1 100644 --- a/htdocs/admin/boutique-special-all.php +++ b/htdocs/admin/boutique-special-all.php @@ -30,7 +30,7 @@ llxHeader(); print_barre_liste("Mise a jour de tous les livres", $page, $PHP_SELF); -$sql = "SELECT l.rowid FROM llx_livre as l"; +$sql = "SELECT l.rowid FROM ".MAIN_DB_PREFIX."livre as l"; if ( $db->query($sql) ) { diff --git a/htdocs/admin/boutique-update-all.php b/htdocs/admin/boutique-update-all.php index cc4edad91b6..94dc7aeac9c 100644 --- a/htdocs/admin/boutique-update-all.php +++ b/htdocs/admin/boutique-update-all.php @@ -29,7 +29,7 @@ llxHeader(); print_barre_liste("Mise a jour de tous les livres", $page, $PHP_SELF); -$sql = "SELECT l.rowid FROM llx_livre as l"; +$sql = "SELECT l.rowid FROM ".MAIN_DB_PREFIX."livre as l"; if ( $db->query($sql) ) { diff --git a/htdocs/admin/boutique.php b/htdocs/admin/boutique.php index cd1a486ba2b..95555e843a5 100644 --- a/htdocs/admin/boutique.php +++ b/htdocs/admin/boutique.php @@ -48,7 +48,7 @@ $modules["BOUTIQUE_ALBUM"][3] = "Module de gestion des albums"; if ($action == 'set') { - $sql = "REPLACE INTO llx_const SET name = '".$value."', value='1', visible = 0"; + $sql = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = '".$value."', value='1', visible = 0"; if ($db->query($sql)) { @@ -58,7 +58,7 @@ if ($action == 'set') if ($action == 'reset') { - $sql = "REPLACE INTO llx_const SET name = '".$value."', value='0', visible = 0"; + $sql = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = '".$value."', value='0', visible = 0"; if ($db->query($sql)) { diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index 132638a9bba..2cc3267493c 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -27,14 +27,14 @@ print_titre("Boites affich if ($HTTP_POST_VARS["action"] == 'add') { - $sql = "INSERT INTO llx_boxes (box_id, position) values (".$HTTP_POST_VARS["rowid"].",".$HTTP_POST_VARS["constvalue"].");"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (box_id, position) values (".$HTTP_POST_VARS["rowid"].",".$HTTP_POST_VARS["constvalue"].");"; $result = $db->query($sql); } if ($action == 'delete') { - $sql = "DELETE FROM llx_boxes WHERE rowid=$rowid"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes WHERE rowid=$rowid"; $result = $db->query($sql); } @@ -51,7 +51,7 @@ $pos[0] = "Homepage"; print ''; -$sql = "SELECT b.rowid, b.box_id, b.position, d.name FROM llx_boxes as b, llx_boxes_def as d where b.box_id = d.rowid"; +$sql = "SELECT b.rowid, b.box_id, b.position, d.name FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as d where b.box_id = d.rowid"; $result = $db->query($sql); if ($result) { @@ -85,7 +85,7 @@ print "

"; print_titre("Boites disponibles"); print '

'; -$sql = "SELECT rowid, name, file FROM llx_boxes_def"; +$sql = "SELECT rowid, name, file FROM ".MAIN_DB_PREFIX."boxes_def"; $result = $db->query($sql); if ($result) { diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index efbdc8ca4e6..ae1c05a8213 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -39,7 +39,7 @@ $commande_addon_var = COMMANDE_ADDON; if ($action == 'setmod') { - $sql = "REPLACE INTO llx_const SET name = 'COMMANDE_ADDON', value='".$value."', visible=0"; + $sql = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = 'COMMANDE_ADDON', value='".$value."', visible=0"; if ($db->query($sql)) { diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index c76a8ec5b11..3dac16c33bf 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -22,7 +22,7 @@ require("./pre.inc.php"); if ($action == 'nbprod' && $user->admin) { - $sql = "REPLACE INTO llx_const SET name = 'EXPEDITION_NEW_FORM_NB_PRODUCT', value='".$value."', visible=0"; + $sql = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = 'EXPEDITION_NEW_FORM_NB_PRODUCT', value='".$value."', visible=0"; if ($db->query($sql)) { @@ -41,7 +41,7 @@ if (!$user->admin) if ($action == 'set') { - $sql = "INSERT INTO llx_propal_model_pdf (nom) VALUES ('".$value."')"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."propal_model_pdf (nom) VALUES ('".$value."')"; if ($db->query($sql)) { @@ -50,7 +50,7 @@ if ($action == 'set') } if ($action == 'del') { - $sql = "DELETE FROM llx_propal_model_pdf WHERE nom='".$value."'"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."propal_model_pdf WHERE nom='".$value."'"; if ($db->query($sql)) { @@ -64,7 +64,7 @@ $expedition_addon_var_pdf = EXPEDITION_ADDON_PDF; if ($action == 'setpdf') { - $sql = "REPLACE INTO llx_const SET name = 'EXPEDITION_ADDON_PDF', value='".$value."', visible=0"; + $sql = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = 'EXPEDITION_ADDON_PDF', value='".$value."', visible=0"; if ($db->query($sql)) { @@ -75,7 +75,7 @@ if ($action == 'setpdf') /* * On la set active */ - $sql = "INSERT INTO llx_propal_model_pdf (nom) VALUES ('".$value."')"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."propal_model_pdf (nom) VALUES ('".$value."')"; if ($db->query($sql)) { @@ -87,7 +87,7 @@ $expedition_addon_var = EXPEDITION_ADDON; if ($action == 'setmod') { - $sql = "REPLACE INTO llx_const SET name = 'EXPEDITION_ADDON', value='".$value."', visible=0"; + $sql = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = 'EXPEDITION_ADDON', value='".$value."', visible=0"; if ($db->query($sql)) { @@ -161,7 +161,7 @@ print '
'; $def = array(); -$sql = "SELECT nom FROM llx_propal_model_pdf"; +$sql = "SELECT nom FROM ".MAIN_DB_PREFIX."propal_model_pdf"; if ($db->query($sql)) { $i = 0; diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index 82b6d10934b..3c5767d95db 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -42,9 +42,9 @@ if ($action == 'save') if(isset($$external_rss_url)) { $external_rss_title = "external_rss_title_" . $i; $external_rss_urlrss = "external_rss_urlrss_" . $i; - $sql = "REPLACE INTO llx_const SET name = '" . "EXTERNAL_RSS_URL_" . $i . "', value='".$$external_rss_url."', visible=0"; - $sql1 = "REPLACE INTO llx_const SET name = '" . "EXTERNAL_RSS_TITLE_" . $i . "', value='".$$external_rss_title."', visible=0"; - $sql2 = "REPLACE INTO llx_const SET name = '" . "EXTERNAL_RSS_URLRSS_" . $i . "', value='".$$external_rss_urlrss."', visible=0"; + $sql = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = '" . "EXTERNAL_RSS_URL_" . $i . "', value='".$$external_rss_url."', visible=0"; + $sql1 = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = '" . "EXTERNAL_RSS_TITLE_" . $i . "', value='".$$external_rss_title."', visible=0"; + $sql2 = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = '" . "EXTERNAL_RSS_URLRSS_" . $i . "', value='".$$external_rss_urlrss."', visible=0"; if ($db->query($sql) && $db->query($sql1) && $db->query($sql2)) { diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index db072d0179c..c77579af54c 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -37,7 +37,7 @@ $facture_rib_number_var = FACTURE_RIB_NUMBER; if ($action == 'set') { - $sql = "REPLACE INTO llx_const SET name = 'FACTURE_ADDON', value='".$value."', visible=0, type='chaine'"; + $sql = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = 'FACTURE_ADDON', value='".$value."', visible=0, type='chaine'"; if ($db->query($sql)) { @@ -49,7 +49,7 @@ if ($action == 'set') if ($action == 'setrib') { - $sql = "REPLACE INTO llx_const SET name = 'FACTURE_RIB_NUMBER', value='".$value."', visible=0"; + $sql = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = 'FACTURE_RIB_NUMBER', value='".$value."', visible=0"; if ($db->query($sql)) { @@ -61,7 +61,7 @@ if ($action == 'setrib') if ($action == 'setpdf') { - $sql = "REPLACE INTO llx_const SET name = 'FACTURE_ADDON_PDF', value='".$value."', visible=0"; + $sql = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = 'FACTURE_ADDON_PDF', value='".$value."', visible=0"; if ($db->query($sql)) { @@ -192,7 +192,7 @@ print ' '; print "\n"; print '\n"; - $sql = "SELECT rowid, libelle FROM llx_don_projet ORDER BY rowid"; + $sql = "SELECT rowid, libelle FROM ".MAIN_DB_PREFIX."don_projet ORDER BY rowid"; if ($db->query($sql)) { diff --git a/htdocs/compta/dons/index.php b/htdocs/compta/dons/index.php index 3a357470a11..f9aa4e3f50d 100644 --- a/htdocs/compta/dons/index.php +++ b/htdocs/compta/dons/index.php @@ -23,7 +23,7 @@ require("./pre.inc.php"); llxHeader(); -$sql = "SELECT sum(d.amount) as somme , d.fk_statut FROM llx_don as d GROUP BY d.fk_statut"; +$sql = "SELECT sum(d.amount) as somme , d.fk_statut FROM ".MAIN_DB_PREFIX."don as d GROUP BY d.fk_statut"; $result = $db->query($sql); diff --git a/htdocs/compta/dons/liste.php b/htdocs/compta/dons/liste.php index 99bff4cb06f..ebc507859bf 100644 --- a/htdocs/compta/dons/liste.php +++ b/htdocs/compta/dons/liste.php @@ -34,7 +34,7 @@ $pagenext = $page + 1; $sql = "SELECT d.rowid, ".$db->pdate("d.datedon")." as datedon, d.prenom, d.nom, d.societe, d.amount, p.libelle as projet"; -$sql .= " FROM llx_don as d, llx_don_projet as p"; +$sql .= " FROM ".MAIN_DB_PREFIX."don as d, ".MAIN_DB_PREFIX."don_projet as p"; $sql .= " WHERE p.rowid = d.fk_don_projet"; if (strlen($statut)) { diff --git a/htdocs/compta/dons/stats.php b/htdocs/compta/dons/stats.php index 7a7b90b2bb0..f4bc1e35c0f 100644 --- a/htdocs/compta/dons/stats.php +++ b/htdocs/compta/dons/stats.php @@ -26,7 +26,7 @@ llxHeader(); print_titre("Statistiques"); $sql = "SELECT d.amount"; -$sql .= " FROM llx_don as d, llx_don_projet as p"; +$sql .= " FROM ".MAIN_DB_PREFIX."don as d, ".MAIN_DB_PREFIX."don_projet as p"; $sql .= " WHERE p.rowid = d.fk_don_projet"; $result = $db->query($sql); diff --git a/htdocs/compta/facture/facture-rec.class.php b/htdocs/compta/facture/facture-rec.class.php index ba99f786276..40cb7e0f654 100644 --- a/htdocs/compta/facture/facture-rec.class.php +++ b/htdocs/compta/facture/facture-rec.class.php @@ -74,7 +74,7 @@ class FactureRec * */ - $sql = "INSERT INTO llx_facture_rec (titre, fk_soc, datec, amount, remise, remise_percent, note, fk_user_author,fk_projet, fk_cond_reglement) "; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."facture_rec (titre, fk_soc, datec, amount, remise, remise_percent, note, fk_user_author,fk_projet, fk_cond_reglement) "; $sql .= " VALUES ('$this->titre', '$facsrc->socidp', now(), '$facsrc->amount', '$facsrc->remise', '$facsrc->remise_percent', '$this->note','$user->id', '$facsrc->projetid', '$facsrc->cond_reglement_id')"; if ( $this->db->query($sql) ) { @@ -131,7 +131,7 @@ class FactureRec { $sql = "SELECT f.fk_soc,f.titre,f.amount,f.tva,f.total,f.total_ttc,f.remise,f.remise_percent,f.fk_projet, c.rowid as crid, c.libelle, c.libelle_facture, f.note, f.fk_user_author"; - $sql .= " FROM llx_facture_rec as f, llx_cond_reglement as c"; + $sql .= " FROM ".MAIN_DB_PREFIX."facture_rec as f, ".MAIN_DB_PREFIX."cond_reglement as c"; $sql .= " WHERE f.rowid=$rowid AND c.rowid = f.fk_cond_reglement"; if ($societe_id > 0) @@ -178,7 +178,7 @@ class FactureRec */ $sql = "SELECT l.fk_product,l.description, l.subprice, l.price, l.qty, l.rowid, l.tva_taux, l.remise_percent"; - $sql .= " FROM llx_facturedet_rec as l WHERE l.fk_facture = ".$this->id." ORDER BY l.rowid ASC"; + $sql .= " FROM ".MAIN_DB_PREFIX."facturedet_rec as l WHERE l.fk_facture = ".$this->id." ORDER BY l.rowid ASC"; $result = $this->db->query($sql); if ($result) @@ -241,7 +241,7 @@ class FactureRec */ Function valid($userid, $dir) { - $sql = "UPDATE llx_facture SET fk_statut = 1, date_valid=now(), fk_user_valid=$userid"; + $sql = "UPDATE ".MAIN_DB_PREFIX."facture SET fk_statut = 1, date_valid=now(), fk_user_valid=$userid"; $sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;"; if ($this->db->query($sql) ) @@ -260,11 +260,11 @@ class FactureRec */ Function delete($rowid) { - $sql = "DELETE FROM llx_facturedet_rec WHERE fk_facture = $rowid;"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet_rec WHERE fk_facture = $rowid;"; if ($this->db->query( $sql) ) { - $sql = "DELETE FROM llx_facture_rec WHERE rowid = $rowid"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_rec WHERE rowid = $rowid"; if ($this->db->query( $sql) ) { @@ -294,7 +294,7 @@ class FactureRec $numfa = facture_get_num($soc); // définit dans includes/modules/facture - $sql = "UPDATE llx_facture set facnumber='$numfa', fk_statut = 1, fk_user_valid = $user->id WHERE rowid = $rowid ;"; + $sql = "UPDATE ".MAIN_DB_PREFIX."facture set facnumber='$numfa', fk_statut = 1, fk_user_valid = $user->id WHERE rowid = $rowid ;"; $result = $this->db->query( $sql); /* @@ -311,7 +311,7 @@ class FactureRec * Update Stats * */ - $sql = "SELECT fk_product FROM llx_facturedet WHERE fk_facture = ".$this->id; + $sql = "SELECT fk_product FROM ".MAIN_DB_PREFIX."facturedet WHERE fk_facture = ".$this->id; $sql .= " AND fk_product IS NOT NULL"; $result = $this->db->query($sql); @@ -324,7 +324,7 @@ class FactureRec { $obj = $this->db->fetch_object($i); - $sql = "UPDATE llx_product SET nbvente=nbvente+1 WHERE rowid = ".$obj->fk_product; + $sql = "UPDATE ".MAIN_DB_PREFIX."product SET nbvente=nbvente+1 WHERE rowid = ".$obj->fk_product; $db2 = $this->db->clone(); $result = $db2->query($sql); $i++; @@ -378,7 +378,7 @@ class FactureRec $price = $pu - $remise; } - $sql = "INSERT INTO llx_facturedet_rec (fk_facture,description,price,qty,tva_taux, fk_product, remise_percent, subprice, remise)"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."facturedet_rec (fk_facture,description,price,qty,tva_taux, fk_product, remise_percent, subprice, remise)"; $sql .= " VALUES ('$facid', '$desc', '$price', '$qty', '$txtva', '$fk_product', '$remise_percent', '$subprice', '$remise') ;"; if ( $this->db->query( $sql) ) @@ -418,7 +418,7 @@ class FactureRec $remise_percent=0; } - $sql = "UPDATE llx_facturedet set description='$desc',price=$price,subprice=$subprice,remise=$remise,remise_percent=$remise_percent,qty=$qty WHERE rowid = $rowid ;"; + $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set description='$desc',price=$price,subprice=$subprice,remise=$remise,remise_percent=$remise_percent,qty=$qty WHERE rowid = $rowid ;"; $result = $this->db->query( $sql); $this->updateprice($this->id); @@ -432,7 +432,7 @@ class FactureRec { if ($this->brouillon) { - $sql = "DELETE FROM llx_facturedet WHERE rowid = $rowid;"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = $rowid;"; $result = $this->db->query( $sql); $this->updateprice($this->id); @@ -446,7 +446,7 @@ class FactureRec { include_once DOL_DOCUMENT_ROOT . "/lib/price.lib.php"; $err=0; - $sql = "SELECT price, qty, tva_taux FROM llx_facturedet_rec WHERE fk_facture = $facid;"; + $sql = "SELECT price, qty, tva_taux FROM ".MAIN_DB_PREFIX."facturedet_rec WHERE fk_facture = $facid;"; $result = $this->db->query($sql); @@ -481,7 +481,7 @@ class FactureRec * */ - $sql = "UPDATE llx_facture_rec SET amount = $this->amount_ht, remise=$this->total_remise, total=$this->total_ht, tva=$this->total_tva, total_ttc=$this->total_ttc"; + $sql = "UPDATE ".MAIN_DB_PREFIX."facture_rec SET amount = $this->amount_ht, remise=$this->total_remise, total=$this->total_ht, tva=$this->total_tva, total_ttc=$this->total_ttc"; $sql .= " WHERE rowid = $facid ;"; if ( $this->db->query($sql) ) @@ -518,7 +518,7 @@ class FactureRec $this->remise_percent = $remise ; - $sql = "UPDATE llx_facture SET remise_percent = ".ereg_replace(",",".",$remise); + $sql = "UPDATE ".MAIN_DB_PREFIX."facture SET remise_percent = ".ereg_replace(",",".",$remise); $sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;"; if ($this->db->query($sql) ) diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 8541faec2a6..8e612818eab 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -133,7 +133,7 @@ if ($action == 'create') print ''; $sql = "SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_taux, l.remise_percent, l.subprice"; - $sql .= " FROM llx_facturedet as l WHERE l.fk_facture = $facid ORDER BY l.rowid"; + $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as l WHERE l.fk_facture = $facid ORDER BY l.rowid"; $result = $db->query($sql); if ($result) @@ -396,7 +396,7 @@ else $sortfield="f.datef"; $sql = "SELECT s.nom,s.idp,f.titre,f.total,f.rowid as facid"; - $sql .= " FROM llx_societe as s,llx_facture_rec as f WHERE f.fk_soc = s.idp"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f WHERE f.fk_soc = s.idp"; if ($socidp) $sql .= " AND s.idp = $socidp"; diff --git a/htdocs/compta/facture/stats/facturestats.class.php b/htdocs/compta/facture/stats/facturestats.class.php index 6cb4bb14c79..41c5bf333cd 100644 --- a/htdocs/compta/facture/stats/facturestats.class.php +++ b/htdocs/compta/facture/stats/facturestats.class.php @@ -39,7 +39,7 @@ class FactureStats extends Stats */ Function getNbByMonth($year) { - $sql = "SELECT date_format(datef,'%m') as dm, count(*) FROM llx_facture"; + $sql = "SELECT date_format(datef,'%m') as dm, count(*) FROM ".MAIN_DB_PREFIX."facture"; $sql .= " WHERE date_format(datef,'%Y') = $year AND fk_statut > 0"; if ($this->socidp) { @@ -57,7 +57,7 @@ class FactureStats extends Stats */ Function getNbByYear() { - $sql = "SELECT date_format(datef,'%Y') as dm, count(*) FROM llx_facture GROUP BY dm DESC WHERE fk_statut > 0"; + $sql = "SELECT date_format(datef,'%Y') as dm, count(*) FROM ".MAIN_DB_PREFIX."facture GROUP BY dm DESC WHERE fk_statut > 0"; return $this->_getNbByYear($sql); } @@ -67,7 +67,7 @@ class FactureStats extends Stats */ Function getAmountByMonth($year) { - $sql = "SELECT date_format(datef,'%m') as dm, sum(total) FROM llx_facture"; + $sql = "SELECT date_format(datef,'%m') as dm, sum(total) FROM ".MAIN_DB_PREFIX."facture"; $sql .= " WHERE date_format(datef,'%Y') = $year AND fk_statut > 0"; if ($this->socidp) { @@ -83,7 +83,7 @@ class FactureStats extends Stats */ Function getAverageByMonth($year) { - $sql = "SELECT date_format(datef,'%m') as dm, avg(total) FROM llx_facture"; + $sql = "SELECT date_format(datef,'%m') as dm, avg(total) FROM ".MAIN_DB_PREFIX."facture"; $sql .= " WHERE date_format(datef,'%Y') = $year AND fk_statut > 0"; if ($this->socidp) { diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 1d943657c4b..3295c84be69 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -50,7 +50,7 @@ $px->SetHeight(280); $px->draw(DOL_DOCUMENT_ROOT.$filev, $data, $year); -$sql = "SELECT count(*), date_format(datef,'%Y') as dm, sum(total) FROM llx_facture WHERE fk_statut > 0 "; +$sql = "SELECT count(*), date_format(datef,'%Y') as dm, sum(total) FROM ".MAIN_DB_PREFIX."facture WHERE fk_statut > 0 "; if ($socidp) { $sql .= " AND fk_soc = $socidp"; diff --git a/htdocs/compta/propal.php b/htdocs/compta/propal.php index 748e3b2231f..24884f56334 100644 --- a/htdocs/compta/propal.php +++ b/htdocs/compta/propal.php @@ -108,7 +108,7 @@ if ($_GET["propalid"]) * */ $sql = "SELECT s.nom, s.idp, p.price, p.fk_projet,p.remise, p.tva, p.total, p.ref,".$db->pdate("p.datep")." as dp, c.id as statut, c.label as lst, p.note, x.firstname, x.name, x.fax, x.phone, x.email, p.fk_user_author, p.fk_user_valid, p.fk_user_cloture, p.datec, p.date_valid, p.date_cloture"; - $sql .= " FROM llx_societe as s, llx_propal as p, c_propalst as c, llx_socpeople as x"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c, ".MAIN_DB_PREFIX."socpeople as x"; $sql .= " WHERE p.fk_soc = s.idp AND p.fk_statut = c.id AND x.idp = p.fk_soc_contact AND p.rowid = ".$propal->id; $result = $db->query($sql); @@ -429,7 +429,7 @@ if ($_GET["propalid"]) $offset = $limit * $page ; $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price, p.ref,".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid"; - $sql .= " FROM llx_societe as s, llx_propal as p, c_propalst as c "; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c "; $sql .= " WHERE p.fk_soc = s.idp AND p.fk_statut = c.id AND p.fk_statut in(2,4)"; if ($socidp) diff --git a/htdocs/compta/resultat/caisse.php b/htdocs/compta/resultat/caisse.php index 22df6199c10..c4cdb785181 100644 --- a/htdocs/compta/resultat/caisse.php +++ b/htdocs/compta/resultat/caisse.php @@ -42,7 +42,7 @@ if ($user->societe_id > 0) print_titre("Caisse"); $sql = "SELECT sum(f.amount) as amount , date_format(f.datep,'%Y-%m') as dm"; -$sql .= " FROM llx_paiement as f"; +$sql .= " FROM ".MAIN_DB_PREFIX."paiement as f"; if ($socidp) { @@ -63,7 +63,7 @@ if ($db->query($sql)) } $sql = "SELECT sum(f.amount) as amount , date_format(f.datep,'%Y-%m') as dm"; -$sql .= " FROM llx_paiementfourn as f"; +$sql .= " FROM ".MAIN_DB_PREFIX."paiementfourn as f"; if ($socidp) { diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index d58d283f712..d0cd508be9b 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -118,7 +118,7 @@ print ''; print '