";
$sql = "SELECT sum(f.tva) as amount , date_format(f.datef,'%Y-%m') as dm";
- $sql .= " FROM llx_facture as f WHERE f.paye = 1 AND f.datef >= '$y-01-01' AND f.datef <= '$y-12-31' ";
+ $sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE f.paye = 1 AND f.datef >= '$y-01-01' AND f.datef <= '$y-12-31' ";
$sql .= " GROUP BY dm DESC";
pt($db, $sql,"Année $y");
diff --git a/htdocs/contact.class.php b/htdocs/contact.class.php
index 26a72b57b61..4de356ef46e 100644
--- a/htdocs/contact.class.php
+++ b/htdocs/contact.class.php
@@ -52,7 +52,7 @@ class Contact
$this->socid = 0;
}
- $sql = "INSERT INTO llx_socpeople (datec, fk_soc, name, fk_user) ";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople (datec, fk_soc, name, fk_user) ";
$sql .= " VALUES (now(),$this->socid,'$this->name',$user->id)";
if ($this->db->query($sql) )
@@ -76,7 +76,7 @@ class Contact
{
$this->email = trim($this->email);
- $sql = "UPDATE llx_socpeople SET name='$this->name', firstname='$this->firstname'";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET name='$this->name', firstname='$this->firstname'";
$sql .= ", poste='$this->poste'";
$sql .= ", fax='$this->fax'";
$sql .= ", email='$this->email'";
@@ -202,7 +202,7 @@ class Contact
if ($user)
{
$sql = "SELECT fk_user";
- $sql .= " FROM llx_birthday_alert";
+ $sql .= " FROM ".MAIN_DB_PREFIX."birthday_alert";
$sql .= " WHERE fk_user = $user->id AND fk_contact = $id";
if ($this->db->query($sql))
@@ -231,7 +231,7 @@ class Contact
*/
Function delete($id)
{
- $sql = "DELETE FROM llx_socpeople";
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."socpeople";
$sql .= " WHERE idp=$id";
$result = $this->db->query($sql);
diff --git a/htdocs/don.class.php b/htdocs/don.class.php
index d55877fb5d1..70eecd03329 100644
--- a/htdocs/don.class.php
+++ b/htdocs/don.class.php
@@ -171,7 +171,7 @@ class Don
$this->date = $this->db->idate($this->date);
- $sql = "INSERT INTO llx_don (datec, amount, fk_paiement,prenom, nom, societe,adresse, cp, ville, pays, public, fk_don_projet, note, fk_user_author, datedon, email)";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."don (datec, amount, fk_paiement,prenom, nom, societe,adresse, cp, ville, pays, public, fk_don_projet, note, fk_user_author, datedon, email)";
$sql .= " VALUES (now(), $this->amount, $this->modepaiementid,'$this->prenom','$this->nom','$this->societe','$this->adresse', '$this->cp','$this->ville','$this->pays',$this->public, $this->projetid, '$this->commentaire', $userid, '$this->date','$this->email')";
$result = $this->db->query($sql);
@@ -198,7 +198,7 @@ class Don
$this->date = $this->db->idate($this->date);
- $sql = "UPDATE llx_don SET ";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."don SET ";
$sql .= "amount = " . $this->amount;
$sql .= ",fk_paiement = ".$this->modepaiementid;
$sql .= ",prenom = '".$this->prenom ."'";
@@ -239,7 +239,7 @@ class Don
{
- $sql = "DELETE FROM llx_don WHERE rowid = $rowid AND fk_statut = 0;";
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."don WHERE rowid = $rowid AND fk_statut = 0;";
if ( $this->db->query( $sql) )
{
@@ -266,7 +266,7 @@ class Don
Function fetch($rowid)
{
$sql = "SELECT d.rowid, ".$this->db->pdate("d.datedon")." as datedon, d.prenom, d.nom, d.societe, d.amount, p.libelle as projet, d.fk_statut, d.adresse, d.cp, d.ville, d.pays, d.public, d.amount, d.fk_paiement, d.note, cp.libelle, d.email, d.fk_don_projet";
- $sql .= " FROM llx_don as d, llx_don_projet as p, c_paiement as cp";
+ $sql .= " FROM ".MAIN_DB_PREFIX."don as d, ".MAIN_DB_PREFIX."don_projet as p, ".MAIN_DB_PREFIX."c_paiement as cp";
$sql .= " WHERE p.rowid = d.fk_don_projet AND cp.id = d.fk_paiement AND d.rowid = $rowid";
if ( $this->db->query( $sql) )
@@ -309,7 +309,7 @@ class Don
Function valid_promesse($rowid, $userid)
{
- $sql = "UPDATE llx_don SET fk_statut = 1, fk_user_valid = $userid WHERE rowid = $rowid AND fk_statut = 0;";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 1, fk_user_valid = $userid WHERE rowid = $rowid AND fk_statut = 0;";
if ( $this->db->query( $sql) )
{
@@ -334,7 +334,7 @@ class Don
*/
Function set_paye($rowid, $modepaiement='')
{
- $sql = "UPDATE llx_don SET fk_statut = 2";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 2";
if ($modepaiement)
{
@@ -365,7 +365,7 @@ class Don
*/
Function set_commentaire($rowid, $commentaire='')
{
- $sql = "UPDATE llx_don SET note = '$commentaire'";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."don SET note = '$commentaire'";
$sql .= " WHERE rowid = $rowid ;";
@@ -393,7 +393,7 @@ class Don
Function set_encaisse($rowid)
{
- $sql = "UPDATE llx_don SET fk_statut = 3 WHERE rowid = $rowid AND fk_statut = 2;";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 3 WHERE rowid = $rowid AND fk_statut = 2;";
if ( $this->db->query( $sql) )
{
@@ -418,7 +418,7 @@ class Don
Function sum_actual()
{
$sql = "SELECT sum(amount)";
- $sql .= " FROM llx_don";
+ $sql .= " FROM ".MAIN_DB_PREFIX."don";
$sql .= " WHERE fk_statut = 3";
if ( $this->db->query( $sql) )
@@ -436,7 +436,7 @@ class Don
Function sum_pending()
{
$sql = "SELECT sum(amount)";
- $sql .= " FROM llx_don";
+ $sql .= " FROM ".MAIN_DB_PREFIX."don";
$sql .= " WHERE fk_statut = 2";
if ( $this->db->query( $sql) )
@@ -454,7 +454,7 @@ class Don
Function sum_intent()
{
$sql = "SELECT sum(amount)";
- $sql .= " FROM llx_don";
+ $sql .= " FROM ".MAIN_DB_PREFIX."don";
$sql .= " WHERE fk_statut = 1";
if ( $this->db->query( $sql) )
diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php
index 38d84409add..021832c4761 100644
--- a/htdocs/facture.class.php
+++ b/htdocs/facture.class.php
@@ -55,7 +55,7 @@ class Facture
$this->db = $DB ;
$this->socidp = $soc_idp;
$this->products = array();
- $this->db_table = "llx_facture";
+ $this->db_table = MAIN_DB_PREFIX."facture";
$this->amount = 0;
$this->remise = 0;
$this->remise_percent = 0;
@@ -89,7 +89,7 @@ class Facture
$this->remise_percent = $_facrec->remise_percent;
}
- $sql = "SELECT fdm,nbjour FROM llx_cond_reglement WHERE rowid = $this->cond_reglement";
+ $sql = "SELECT fdm,nbjour FROM ".MAIN_DB_PREFIX."cond_reglement WHERE rowid = $this->cond_reglement";
if ($this->db->query($sql) )
{
if ($this->db->num_rows())
@@ -129,18 +129,18 @@ class Facture
{
$this->id = $this->db->last_insert_id();
- $sql = "UPDATE llx_facture SET facnumber='(PROV".$this->id.")' WHERE rowid=".$this->id;
+ $sql = "UPDATE ".MAIN_DB_PREFIX."facture SET facnumber='(PROV".$this->id.")' WHERE rowid=".$this->id;
$this->db->query($sql);
if ($this->id && $this->propalid)
{
- $sql = "INSERT INTO llx_fa_pr (fk_facture, fk_propal) VALUES (".$this->id.",".$this->propalid.")";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."fa_pr (fk_facture, fk_propal) VALUES (".$this->id.",".$this->propalid.")";
$this->db->query($sql);
}
if ($this->id && $this->commandeid)
{
- $sql = "INSERT INTO llx_co_fa (fk_facture, fk_commande) VALUES (".$this->id.",".$this->commandeid.")";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."co_fa (fk_facture, fk_commande) VALUES (".$this->id.",".$this->commandeid.")";
$this->db->query($sql);
}
@@ -219,7 +219,7 @@ class Facture
{
$sql = "SELECT f.fk_soc,f.facnumber,f.amount,f.tva,f.total,f.total_ttc,f.remise,f.remise_percent,".$this->db->pdate("f.datef")."as df,f.fk_projet,".$this->db->pdate("f.date_lim_reglement")." as dlr, c.rowid as cond_regl_id, c.libelle, c.libelle_facture, f.note, f.paye, f.fk_statut, f.fk_user_author";
- $sql .= " FROM llx_facture as f, llx_cond_reglement as c";
+ $sql .= " FROM ".MAIN_DB_PREFIX."facture 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)
@@ -267,7 +267,7 @@ class Facture
*/
$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 = ".$this->id;
+ $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as l WHERE l.fk_facture = ".$this->id;
$result = $this->db->query($sql);
if ($result)
@@ -329,7 +329,7 @@ class Facture
*/
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) )
@@ -348,7 +348,7 @@ class Facture
*/
Function classin($cat_id)
{
- $sql = "UPDATE llx_facture SET fk_projet = $cat_id";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."facture SET fk_projet = $cat_id";
$sql .= " WHERE rowid = $this->id;";
if ($this->db->query($sql) )
@@ -367,24 +367,24 @@ class Facture
*/
Function delete($rowid)
{
- $sql = "DELETE FROM llx_facture_tva_sum WHERE fk_facture = $rowid;";
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_tva_sum WHERE fk_facture = $rowid;";
if ( $this->db->query( $sql) )
{
- $sql = "DELETE FROM llx_fa_pr WHERE fk_facture = $rowid;";
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."fa_pr WHERE fk_facture = $rowid;";
if ($this->db->query( $sql) )
{
- $sql = "DELETE FROM llx_co_fa WHERE fk_facture = $rowid;";
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."co_fa WHERE fk_facture = $rowid;";
if ($this->db->query( $sql) )
{
- $sql = "DELETE FROM llx_facturedet WHERE fk_facture = $rowid;";
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE fk_facture = $rowid;";
if ($this->db->query( $sql) )
{
- $sql = "DELETE FROM llx_facture WHERE rowid = $rowid AND fk_statut = 0;";
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture WHERE rowid = $rowid AND fk_statut = 0;";
if ($this->db->query( $sql) )
{
@@ -428,7 +428,7 @@ class Facture
*/
Function set_payed($rowid)
{
- $sql = "UPDATE llx_facture set paye = 1 WHERE rowid = $rowid ;";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."facture set paye = 1 WHERE rowid = $rowid ;";
$return = $this->db->query( $sql);
}
/**
@@ -443,7 +443,7 @@ class Facture
$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);
if (! $result) { print "Err : ".$this->db->error(); return -1; }
@@ -462,7 +462,7 @@ class Facture
* 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 > 0";
$result = $this->db->query($sql);
@@ -475,7 +475,7 @@ class Facture
{
$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++;
@@ -529,7 +529,7 @@ class Facture
$price = $pu - $remise;
}
- $sql = "INSERT INTO llx_facturedet (fk_facture,description,price,qty,tva_taux, fk_product, remise_percent, subprice, remise)";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."facturedet (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) )
@@ -569,7 +569,7 @@ class Facture
$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);
@@ -583,7 +583,7 @@ class Facture
{
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);
@@ -597,7 +597,7 @@ class Facture
{
include_once DOL_DOCUMENT_ROOT . "/lib/price.lib.php";
$err=0;
- $sql = "SELECT price, qty, tva_taux FROM llx_facturedet WHERE fk_facture = $facid;";
+ $sql = "SELECT price, qty, tva_taux FROM ".MAIN_DB_PREFIX."facturedet WHERE fk_facture = $facid;";
$result = $this->db->query($sql);
@@ -632,19 +632,19 @@ class Facture
*
*/
- $sql = "UPDATE llx_facture 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 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) )
{
- $sql = "DELETE FROM llx_facture_tva_sum WHERE fk_facture=".$this->id;
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_tva_sum WHERE fk_facture=".$this->id;
if ( $this->db->query($sql) )
{
foreach ($tvas as $key => $value)
{
- $sql = "REPLACE INTO llx_facture_tva_sum SET fk_facture=".$this->id;
+ $sql = "REPLACE INTO ".MAIN_DB_PREFIX."facture_tva_sum SET fk_facture=".$this->id;
$sql .= ", amount = ".$tvas[$key];
$sql .= ", tva_tx=".$key;
@@ -692,7 +692,7 @@ class Facture
$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) )
@@ -746,7 +746,7 @@ class Facture
$sendto = htmlentities($sendto);
- $sql = "INSERT INTO llx_actioncomm (datea,fk_action,fk_soc,note,fk_facture, fk_contact,fk_user_author, label, percent) VALUES (now(), 10 ,$this->socidp ,'Relance envoyée à $sendto',$this->id, $sendtoid, $user->id, 'Relance Facture par mail',100);";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm (datea,fk_action,fk_soc,note,fk_facture, fk_contact,fk_user_author, label, percent) VALUES (now(), 10 ,$this->socidp ,'Relance envoyée à $sendto',$this->id, $sendtoid, $user->id, 'Relance Facture par mail',100);";
if (! $this->db->query($sql) )
{
@@ -771,7 +771,7 @@ class Facture
*/
Function getSumTva()
{
- $sql = "SELECT amount, tva_tx FROM llx_facture_tva_sum WHERE fk_facture = ".$this->id;
+ $sql = "SELECT amount, tva_tx FROM ".MAIN_DB_PREFIX."facture_tva_sum WHERE fk_facture = ".$this->id;
if ($this->db->query($sql))
{
$num = $this->db->num_rows();
@@ -796,7 +796,7 @@ class Facture
*/
Function getSommePaiement()
{
- $sql = "SELECT sum(amount) FROM llx_paiement WHERE fk_facture = ".$this->id;
+ $sql = "SELECT sum(amount) FROM ".MAIN_DB_PREFIX."paiement WHERE fk_facture = ".$this->id;
if ($this->db->query($sql))
{
$row = $this->db->fetch_row(0);
diff --git a/htdocs/facturefourn.class.php b/htdocs/facturefourn.class.php
index d15fcbca730..eef29b13dac 100644
--- a/htdocs/facturefourn.class.php
+++ b/htdocs/facturefourn.class.php
@@ -51,7 +51,7 @@ class FactureFourn
$this->db = $DB ;
$this->socidp = $soc_idp;
$this->products = array();
- $this->db_table = "llx_facture";
+ $this->db_table = MAIN_DB_PREFIX."facture";
$this->amount = 0;
$this->remise = 0;
$this->tva = 0;
@@ -81,7 +81,7 @@ class FactureFourn
for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
{
- $sql = "INSERT INTO llx_facture_fourn_det (fk_facture_fourn)";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."facture_fourn_det (fk_facture_fourn)";
$sql .= " VALUES ($this->id);";
if ($this->db->query($sql) )
{
@@ -118,7 +118,7 @@ class FactureFourn
$totalttc = $totalht + $tva;
- $sql = "UPDATE llx_facture_fourn_det ";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det ";
$sql .= "SET description ='".$label."'";
$sql .= ", pu_ht = " . $puht;
$sql .= ", qty =".$qty;
@@ -140,7 +140,7 @@ class FactureFourn
Function delete_ligne($id)
{
- $sql = "DELETE FROM llx_facture_fourn_det ";
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det ";
$sql .= " WHERE rowid = $id";
if (! $this->db->query($sql) )
@@ -174,7 +174,7 @@ class FactureFourn
$tva = tva($totalht);
$total = $totalht + $tva;
- $sql = "INSERT INTO llx_facture_fourn (facnumber, libelle, fk_soc, datec, datef, note, fk_user_author) ";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."facture_fourn (facnumber, libelle, fk_soc, datec, datef, note, fk_user_author) ";
$sql .= " VALUES ('".$this->number."','".$this->libelle."',". $this->socid.", now(),".$this->date.",'".$this->note."', ".$user->id.");";
if ( $this->db->query($sql) )
@@ -184,7 +184,7 @@ class FactureFourn
for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
{
- $sql = "INSERT INTO llx_facture_fourn_det (fk_facture_fourn)";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."facture_fourn_det (fk_facture_fourn)";
$sql .= " VALUES ($this->id);";
if ($this->db->query($sql) )
{
@@ -222,7 +222,7 @@ class FactureFourn
$sql = "SELECT fk_soc,libelle,facnumber,amount,remise,".$this->db->pdate(datef)."as df";
$sql .= ", total_ht, total_tva, total_ttc, fk_user_author";
- $sql .= " FROM llx_facture_fourn as f WHERE f.rowid=$rowid;";
+ $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f WHERE f.rowid=$rowid;";
if ($this->db->query($sql) )
{
@@ -249,7 +249,7 @@ class FactureFourn
/*
* Lignes
*/
- $sql = "SELECT rowid,description, pu_ht, qty, tva_taux, tva, total_ht, total_ttc FROM llx_facture_fourn_det WHERE fk_facture_fourn=".$this->id;
+ $sql = "SELECT rowid,description, pu_ht, qty, tva_taux, tva, total_ht, total_ttc FROM ".MAIN_DB_PREFIX."facture_fourn_det WHERE fk_facture_fourn=".$this->id;
if ($this->db->query($sql) )
{
@@ -290,7 +290,7 @@ class FactureFourn
*/
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) )
@@ -310,13 +310,13 @@ class FactureFourn
Function delete($rowid)
{
- $sql = "DELETE FROM llx_facture_fourn WHERE rowid = $rowid AND fk_statut = 0";
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn WHERE rowid = $rowid AND fk_statut = 0";
if ( $this->db->query( $sql) )
{
if ( $this->db->affected_rows() )
{
- $sql = "DELETE FROM llx_facture_fourn_det WHERE fk_facture_fourn = $rowid;";
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det WHERE fk_facture_fourn = $rowid;";
if ($this->db->query( $sql) )
{
@@ -342,7 +342,7 @@ class FactureFourn
*/
Function set_payed($rowid)
{
- $sql = "UPDATE llx_facture set paye = 1 WHERE rowid = $rowid ;";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."facture set paye = 1 WHERE rowid = $rowid ;";
$return = $this->db->query( $sql);
}
/*
@@ -355,7 +355,7 @@ class FactureFourn
{
global $conf;
- $sql = "UPDATE llx_facture set fk_statut = 1, fk_user_valid = $userid WHERE rowid = $rowid ;";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."facture set fk_statut = 1, fk_user_valid = $userid WHERE rowid = $rowid ;";
$result = $this->db->query( $sql);
$dir = $conf->facture->outputdir . "/" . $rowid;
@@ -376,7 +376,7 @@ class FactureFourn
*/
Function addline($facid, $desc, $pu, $qty)
{
- $sql = "INSERT INTO llx_facturedet (fk_facture,description,price,qty) VALUES ($facid, '$desc', $pu, $qty) ;";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."facturedet (fk_facture,description,price,qty) VALUES ($facid, '$desc', $pu, $qty) ;";
$result = $this->db->query( $sql);
$this->updateprice($facid);
@@ -387,7 +387,7 @@ class FactureFourn
*/
Function updateline($rowid, $desc, $pu, $qty)
{
- $sql = "UPDATE llx_facturedet set description='$desc',price=$pu,qty=$qty WHERE rowid = $rowid ;";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set description='$desc',price=$pu,qty=$qty WHERE rowid = $rowid ;";
$result = $this->db->query( $sql);
$this->updateprice($this->id);
@@ -398,7 +398,7 @@ class FactureFourn
*/
Function deleteline($rowid)
{
- $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);
@@ -410,7 +410,7 @@ class FactureFourn
Function updateprice($facid)
{
- $sql = "SELECT sum(total_ht), sum(tva), sum(total_ttc) FROM llx_facture_fourn_det";
+ $sql = "SELECT sum(total_ht), sum(tva), sum(total_ttc) FROM ".MAIN_DB_PREFIX."facture_fourn_det";
$sql .= " WHERE fk_facture_fourn = $facid;";
$result = $this->db->query($sql);
@@ -425,7 +425,7 @@ class FactureFourn
$total_ttc = $row[2];
}
- $sql = "UPDATE llx_facture_fourn SET total_ht = $total_ht, total_tva = $total_tva, total_ttc = $total_ttc";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn SET total_ht = $total_ht, total_tva = $total_tva, total_ttc = $total_ttc";
$sql .= " WHERE rowid = $facid ;";
$result = $this->db->query($sql);
diff --git a/htdocs/index.php b/htdocs/index.php
index 132947ca353..e4678e02d6a 100644
--- a/htdocs/index.php
+++ b/htdocs/index.php
@@ -33,7 +33,7 @@ print " ";
*/
$user->getrights('');
-$sql = "SELECT b.rowid, b.box_id, d.file FROM llx_boxes as b, llx_boxes_def as d WHERE b.box_id = d.rowid";
+$sql = "SELECT b.rowid, b.box_id, d.file 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)
{
diff --git a/htdocs/install.php b/htdocs/install.php
index 7d633225eb8..b8645a5eb5b 100644
--- a/htdocs/install.php
+++ b/htdocs/install.php
@@ -114,21 +114,21 @@ if ($HTTP_POST_VARS["action"] == "set")
$conf->db->pass = $dolibarr_main_db_pass;
$db = new DoliDb();
- $sql[0] = "REPLACE INTO llx_const SET name = 'FAC_OUTPUTDIR', value='".$dolibarr_main_document_root."/document/facture', visible=0, type='chaine'";
+ $sql[0] = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = 'FAC_OUTPUTDIR', value='".$dolibarr_main_document_root."/document/facture', visible=0, type='chaine'";
- $sql[1] = "REPLACE INTO llx_const SET name = 'FAC_OUTPUT_URL', value='".$dolibarr_main_url_root."/document/facture', visible=0, type='chaine'";
+ $sql[1] = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = 'FAC_OUTPUT_URL', value='".$dolibarr_main_url_root."/document/facture', visible=0, type='chaine'";
- $sql[2] = "REPLACE INTO llx_const SET name = 'PROPALE_OUTPUTDIR', value='".$dolibarr_main_document_root."/document/propale', visible=0, type='chaine'";
+ $sql[2] = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = 'PROPALE_OUTPUTDIR', value='".$dolibarr_main_document_root."/document/propale', visible=0, type='chaine'";
- $sql[3] = "REPLACE INTO llx_const SET name = 'PROPALE_OUTPUT_URL', value='".$dolibarr_main_url_root."/document/propale', visible=0, type='chaine'";
+ $sql[3] = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = 'PROPALE_OUTPUT_URL', value='".$dolibarr_main_url_root."/document/propale', visible=0, type='chaine'";
- $sql[4] = "REPLACE INTO llx_const SET name = 'FICHEINTER_OUTPUTDIR', value='".$dolibarr_main_document_root."/document/ficheinter', visible=0, type='chaine'";
+ $sql[4] = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = 'FICHEINTER_OUTPUTDIR', value='".$dolibarr_main_document_root."/document/ficheinter', visible=0, type='chaine'";
- $sql[5] = "REPLACE INTO llx_const SET name = 'FICHEINTER_OUTPUT_URL', value='".$dolibarr_main_url_root."/document/ficheinter', visible=0, type='chaine'";
+ $sql[5] = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = 'FICHEINTER_OUTPUT_URL', value='".$dolibarr_main_url_root."/document/ficheinter', visible=0, type='chaine'";
- $sql[6] = "REPLACE INTO llx_const SET name = 'SOCIETE_OUTPUTDIR', value='".$dolibarr_main_document_root."/document/societe', visible=0, type='chaine'";
+ $sql[6] = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = 'SOCIETE_OUTPUTDIR', value='".$dolibarr_main_document_root."/document/societe', visible=0, type='chaine'";
- $sql[7] = "REPLACE INTO llx_const SET name = 'SOCIETE_OUTPUT_URL', value='".$dolibarr_main_url_root."/document/societe', visible=0, type='chaine'";
+ $sql[7] = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = 'SOCIETE_OUTPUT_URL', value='".$dolibarr_main_url_root."/document/societe', visible=0, type='chaine'";
$result = 0;
for ($i=0; $i < sizeof($sql);$i++)
{
@@ -152,7 +152,7 @@ if ($HTTP_POST_VARS["action"] == "set")
if ($error == 0)
{
- $db->query("DELETE FROM llx_const WHERE name='MAIN_NOT_INSTALLED'");
+ $db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE name='MAIN_NOT_INSTALLED'");
print '
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index ad378d130c9..58682ab749c 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -52,7 +52,7 @@ require (DOL_DOCUMENT_ROOT."/conf/conf.class.php");
* Doit figurer aprés l'inclusion de conf.class.php pour overider certaines variables, à terme conf.class.php devra etre un fichier qui ne sera pas modifié par l'utilisateur
*/
$conf = new Conf();
-if (!strlen(getenv("LLX_DBNAME")))
+if (!strlen(getenv("".MAIN_DB_PREFIX."DBNAME")))
{
$conf->db->host = $dolibarr_main_db_host;
$conf->db->name = $dolibarr_main_db_name;
@@ -93,7 +93,7 @@ else
$params = array(
"dsn" => $conf->db->getdsn(),
- "table" => "llx_user",
+ "table" => MAIN_DB_PREFIX."user",
"usernamecol" => "login",
"passwordcol" => "pass",
"cryptType" => "none",
@@ -131,7 +131,7 @@ define('FPDF_FONTPATH',DOL_DOCUMENT_ROOT .'/includes/fpdf/font/');
* Definition de toutes les Constantes globales d'environement
*
*/
-$sql = "SELECT name, value FROM llx_const";
+$sql = "SELECT name, value FROM ".MAIN_DB_PREFIX."const";
$result = $db->query($sql);
if ($result)
{
diff --git a/htdocs/notify.class.php b/htdocs/notify.class.php
index 40dc1bbb827..b948b530ed8 100644
--- a/htdocs/notify.class.php
+++ b/htdocs/notify.class.php
@@ -46,7 +46,7 @@ class Notify
Function send($action, $socid, $texte, $objet_type, $objet_id, $file="")
{
$sql = "SELECT s.nom, c.email, c.idp, c.name, c.firstname, a.titre,n.rowid";
- $sql .= " FROM llx_socpeople as c, llx_action_def as a, llx_notify_def as n, llx_societe as s";
+ $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c, ".MAIN_DB_PREFIX."action_def as a, ".MAIN_DB_PREFIX."notify_def as n, ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE n.fk_contact = c.idp AND a.rowid = n.fk_action";
$sql .= " AND n.fk_soc = s.idp AND n.fk_action = ".$action;
$sql .= " AND s.idp = ".$socid;
@@ -79,7 +79,7 @@ class Notify
{
$sendto = htmlentities($sendto);
- $sql = "INSERT INTO llx_notify (daten, fk_action, fk_contact, objet_type, objet_id)";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_contact, objet_type, objet_id)";
$sql .= " VALUES (now(), $action ,$obj->idp , '$objet_type', $objet_id);";
$db2 = $this->db->clone();
if (! $db2->query($sql) )
diff --git a/htdocs/paiement.class.php b/htdocs/paiement.class.php
index 275a3c252b6..0e82bc07812 100644
--- a/htdocs/paiement.class.php
+++ b/htdocs/paiement.class.php
@@ -54,7 +54,7 @@ class Paiement
$this->amount = ereg_replace(",",".",$this->amount);
- $sql = "INSERT INTO llx_paiement (fk_facture, datec, datep, amount, author, fk_paiement, num_paiement, note)";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (fk_facture, datec, datep, amount, author, fk_paiement, num_paiement, note)";
$sql .= " VALUES ($this->facid, now(), $this->datepaye,$this->amount,'$this->author', $this->paiementid, '$this->num_paiement', '$this->note')";
$result = $this->db->query($sql);
@@ -100,8 +100,8 @@ class Paiement
*/
Function delete()
{
- $sql = "SELECT llx_paiement.rowid FROM llx_facture, llx_paiement WHERE llx_paiement.rowid = ".$this->id;
- $sql .= " AND llx_paiement.fk_facture = llx_facture.rowid AND llx_facture.paye = 0";
+ $sql = "SELECT ".MAIN_DB_PREFIX."paiement.rowid FROM ".MAIN_DB_PREFIX."facture, ".MAIN_DB_PREFIX."paiement WHERE ".MAIN_DB_PREFIX."paiement.rowid = ".$this->id;
+ $sql .= " AND ".MAIN_DB_PREFIX."paiement.fk_facture = ".MAIN_DB_PREFIX."facture.rowid AND ".MAIN_DB_PREFIX."facture.paye = 0";
$result = $this->db->query($sql);
@@ -109,7 +109,7 @@ class Paiement
{
if ($this->db->num_rows() == 1)
{
- $sql = "DELETE FROM llx_paiement WHERE llx_paiement.rowid = ".$this->id;
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiement WHERE ".MAIN_DB_PREFIX."paiement.rowid = ".$this->id;
$result = $this->db->query($sql);
diff --git a/htdocs/product.class.php b/htdocs/product.class.php
index e60be36eec1..52ec5192489 100644
--- a/htdocs/product.class.php
+++ b/htdocs/product.class.php
@@ -71,7 +71,7 @@ class Product
Function create($user)
{
$sql = "SELECT count(*)";
- $sql .= " FROM llx_product WHERE ref = '" .trim($this->ref)."'";
+ $sql .= " FROM ".MAIN_DB_PREFIX."product WHERE ref = '" .trim($this->ref)."'";
$result = $this->db->query($sql) ;
@@ -87,7 +87,7 @@ class Product
}
$this->price = round($this->price, 2);
- $sql = "INSERT INTO llx_product (datec, fk_user_author, fk_product_type, price)";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."product (datec, fk_user_author, fk_product_type, price)";
$sql .= " VALUES (now(),".$user->id.",$this->type, " . ereg_replace(",",".",$this->price) . ")";
$result = $this->db->query($sql);
if ( $result )
@@ -129,7 +129,7 @@ class Product
$this->libelle = 'LIBELLE MANQUANT';
}
- $sql = "UPDATE llx_product ";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."product ";
$sql .= " SET label = '" . trim($this->libelle) ."'";
if (strlen(trim($this->ref)))
{
@@ -159,7 +159,7 @@ class Product
Function _log_price($user)
{
- $sql = "REPLACE INTO llx_product_price ";
+ $sql = "REPLACE INTO ".MAIN_DB_PREFIX."product_price ";
$sql .= " SET date_price= now()";
$sql .= " ,fk_product = ".$this->id;
$sql .= " ,fk_user_author = ".$user->id;
@@ -186,7 +186,7 @@ class Product
{
$this->price = round($this->price, 2);
- $sql = "UPDATE llx_product ";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."product ";
$sql .= " SET price = " . ereg_replace(",",".",$this->price);
$sql .= " WHERE rowid = " . $id;
@@ -216,7 +216,7 @@ class Product
Function fetch ($id)
{
$sql = "SELECT rowid, ref, label, description, price, tva_tx, envente, nbvente, fk_product_type, duration, seuil_stock_alerte";
- $sql .= " FROM llx_product WHERE rowid = $id";
+ $sql .= " FROM ".MAIN_DB_PREFIX."product WHERE rowid = $id";
$result = $this->db->query($sql) ;
@@ -244,7 +244,7 @@ class Product
$sql = "SELECT reel, fk_entrepot";
- $sql .= " FROM llx_product_stock WHERE fk_product = $id";
+ $sql .= " FROM ".MAIN_DB_PREFIX."product_stock WHERE fk_product = $id";
$result = $this->db->query($sql) ;
if ( $result )
{
@@ -286,7 +286,7 @@ class Product
Function count_propale()
{
$sql = "SELECT pd.fk_propal";
- $sql .= " FROM llx_propaldet as pd, llx_product as p";
+ $sql .= " FROM ".MAIN_DB_PREFIX."propaldet as pd, ".MAIN_DB_PREFIX."product as p";
$sql .= " WHERE p.rowid = pd.fk_product AND p.rowid = ".$this->id;
$sql .= " GROUP BY pd.fk_propal";
@@ -308,7 +308,7 @@ class Product
Function count_propale_client()
{
$sql = "SELECT pr.fk_soc";
- $sql .= " FROM llx_propaldet as pd, llx_product as p, llx_propal as pr";
+ $sql .= " FROM ".MAIN_DB_PREFIX."propaldet as pd, ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."propal as pr";
$sql .= " WHERE p.rowid = pd.fk_product AND pd.fk_propal = pr.rowid AND p.rowid = ".$this->id;
$sql .= " GROUP BY pr.fk_soc";
@@ -330,7 +330,7 @@ class Product
Function count_facture()
{
$sql = "SELECT pd.fk_facture";
- $sql .= " FROM llx_facturedet as pd, llx_product as p";
+ $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as pd, ".MAIN_DB_PREFIX."product as p";
$sql .= " WHERE p.rowid = pd.fk_product AND p.rowid = ".$this->id;
$sql .= " GROUP BY pd.fk_facture";
@@ -403,7 +403,7 @@ class Product
Function get_nb_vente()
{
$sql = "SELECT sum(d.qty), date_format(f.datef, '%Y%m') ";
- $sql .= " FROM llx_facturedet as d, llx_facture as f";
+ $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as d, ".MAIN_DB_PREFIX."facture as f";
$sql .= " WHERE f.rowid = d.fk_facture and f.paye = 1 and d.fk_product =".$this->id;
$sql .= " GROUP BY date_format(f.datef,'%Y%m') DESC ;";
@@ -416,7 +416,7 @@ class Product
Function get_num_vente()
{
$sql = "SELECT count(*), date_format(f.datef, '%Y%m') ";
- $sql .= " FROM llx_facturedet as d, llx_facture as f";
+ $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as d, ".MAIN_DB_PREFIX."facture as f";
$sql .= " WHERE f.rowid = d.fk_facture and f.paye = 1 and d.fk_product =".$this->id;
$sql .= " GROUP BY date_format(f.datef,'%Y%m') DESC ;";
@@ -428,7 +428,7 @@ class Product
*/
Function add_fournisseur($user, $id_fourn, $ref_fourn)
{
- $sql = "SELECT count(*) FROM llx_product_fournisseur WHERE fk_product = $this->id AND fk_soc = $id_fourn";
+ $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."product_fournisseur WHERE fk_product = $this->id AND fk_soc = $id_fourn";
if ($this->db->query($sql) )
{
@@ -437,7 +437,7 @@ class Product
if ($row[0] == 0)
{
- $sql = "INSERT INTO llx_product_fournisseur ";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur ";
$sql .= " (datec, fk_product, fk_soc, ref_fourn, fk_user_author)";
$sql .= " VALUES (now(), $this->id, $id_fourn, '$ref_fourn', $user->id)";
@@ -469,7 +469,7 @@ class Product
Function create_stock($id_entrepot, $nbpiece)
{
- $sql = "INSERT INTO llx_product_stock ";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_stock ";
$sql .= " (fk_product, fk_entrepot, reel)";
$sql .= " VALUES ($this->id, $id_entrepot, $nbpiece)";
@@ -490,7 +490,7 @@ class Product
Function correct_stock($user, $id_entrepot, $nbpiece, $mouvement)
{
- $sql = "SELECT count(*) FROM llx_product_stock ";
+ $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."product_stock ";
$sql .= " WHERE fk_product = $this->id AND fk_entrepot = $id_entrepot";
if ($this->db->query($sql) )
@@ -527,19 +527,19 @@ class Product
if ($this->db->begin())
{
- $sql = "UPDATE llx_product ";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."product ";
$sql .= " SET stock_commande = stock_commande ".$op[$mouvement].", stock_propale = stock_propale ".$op[$mouvement];
$sql .= " WHERE rowid = $this->id ";
if ($this->db->query($sql) )
{
- $sql = "UPDATE llx_product_stock ";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."product_stock ";
$sql .= " SET reel = reel ".$op[$mouvement];
$sql .= " WHERE fk_product = $this->id AND fk_entrepot = $id_entrepot";
if ($this->db->query($sql) )
{
- $sql = "INSERT INTO llx_stock_mouvement (datem, fk_product, fk_entrepot, value, type_mouvement, fk_user_author)";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."stock_mouvement (datem, fk_product, fk_entrepot, value, type_mouvement, fk_user_author)";
$sql .= " VALUES (now(), $this->id, $id_entrepot, ".$op[$mouvement].", 0, $user->id)";
if ($this->db->query($sql) )
diff --git a/htdocs/project.class.php b/htdocs/project.class.php
index f9acb7d9d96..2d660f2a799 100644
--- a/htdocs/project.class.php
+++ b/htdocs/project.class.php
@@ -39,7 +39,7 @@ class Project {
Function create($creatorid) {
- $sql = "INSERT INTO llx_projet (ref, title, fk_soc, fk_user_creat) ";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet (ref, title, fk_soc, fk_user_creat) ";
$sql .= " VALUES ('$this->ref', '$this->title', $this->socidp, $creatorid) ;";
if (!$this->db->query($sql) )
@@ -57,7 +57,7 @@ class Project {
Function fetch($rowid) {
- $sql = "SELECT title, ref FROM llx_projet WHERE rowid=$rowid;";
+ $sql = "SELECT title, ref FROM ".MAIN_DB_PREFIX."projet WHERE rowid=$rowid;";
if ($this->db->query($sql) ) {
if ($this->db->num_rows()) {
@@ -81,7 +81,7 @@ class Project {
Function get_propal_list()
{
$propales = array();
- $sql = "SELECT rowid FROM llx_propal WHERE fk_projet=$this->id;";
+ $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."propal WHERE fk_projet=$this->id;";
if ($this->db->query($sql) )
{
@@ -118,7 +118,7 @@ class Project {
{
$projets = array();
- $sql = "SELECT rowid, title FROM llx_projet";
+ $sql = "SELECT rowid, title FROM ".MAIN_DB_PREFIX."projet";
if (isset($id_societe))
{
diff --git a/htdocs/projetdon.class.php b/htdocs/projetdon.class.php
index f6b569686dc..294b76033eb 100644
--- a/htdocs/projetdon.class.php
+++ b/htdocs/projetdon.class.php
@@ -47,7 +47,7 @@ class ProjetDon {
{
$projets = array();
- $sql = "SELECT rowid, libelle FROM llx_don_projet";
+ $sql = "SELECT rowid, libelle FROM ".MAIN_DB_PREFIX."don_projet";
if ($this->db->query($sql) )
{
diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php
index b106796f6a9..f12ee5d2dfc 100644
--- a/htdocs/propal.class.php
+++ b/htdocs/propal.class.php
@@ -84,7 +84,7 @@ class Propal
$price = $prod->price - $remise;
}
- $sql = "INSERT INTO llx_propaldet (fk_propal, fk_product, qty, price, tva_tx, description, remise_percent, subprice) VALUES ";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."propaldet (fk_propal, fk_product, qty, price, tva_tx, description, remise_percent, subprice) VALUES ";
$sql .= " (".$this->id.",". $idproduct.",". $qty.",". $price.",".$prod->tva_tx.",'".addslashes($prod->label)."',$remise_percent, $subprice)";
if ($this->db->query($sql) )
@@ -127,7 +127,7 @@ class Propal
$price = $p_price - $remise;
}
- $sql = "INSERT INTO llx_propaldet (fk_propal, fk_product, qty, price, tva_tx, description, remise_percent, subprice) VALUES ";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."propaldet (fk_propal, fk_product, qty, price, tva_tx, description, remise_percent, subprice) VALUES ";
$sql .= " (".$this->id.", 0,". $p_qty.",". $price.",".$p_tva_tx.",'".$p_desc."',$remise_percent, $subprice) ; ";
if ($this->db->query($sql) )
@@ -168,7 +168,7 @@ class Propal
{
if ($this->statut == 0)
{
- $sql = "DELETE FROM llx_propaldet WHERE rowid = $idligne";
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE rowid = $idligne";
if ($this->db->query($sql) )
{
@@ -194,7 +194,7 @@ class Propal
*/
$this->fin_validite = $this->datep + ($this->duree_validite * 24 * 3600);
- $sql = "INSERT INTO llx_propal (fk_soc, fk_soc_contact, price, remise, tva, total, datep, datec, ref, fk_user_author, note, model_pdf, fin_validite) ";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."propal (fk_soc, fk_soc_contact, price, remise, tva, total, datep, datec, ref, fk_user_author, note, model_pdf, fin_validite) ";
$sql .= " VALUES ($this->socidp, $this->contactid, 0, $this->remise, 0,0,".$this->db->idate($this->datep).", now(), '$this->ref', $this->author, '$this->note','$this->modelpdf',".$this->db->idate($this->fin_validite).")";
$sqlok = 0;
@@ -203,7 +203,7 @@ class Propal
$this->id = $this->db->last_insert_id();
- $sql = "SELECT rowid FROM llx_propal WHERE ref='$this->ref';";
+ $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."propal WHERE ref='$this->ref';";
if ( $this->db->query($sql) )
{
/*
@@ -232,7 +232,7 @@ class Propal
*/
if ($this->projetidp)
{
- $sql = "UPDATE llx_propal SET fk_projet=$this->projetidp WHERE ref='$this->ref';";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fk_projet=$this->projetidp WHERE ref='$this->ref';";
$this->db->query($sql);
}
}
@@ -259,7 +259,7 @@ class Propal
/*
* Liste des produits a ajouter
*/
- $sql = "SELECT price, qty, tva_tx FROM llx_propaldet WHERE fk_propal = $this->id";
+ $sql = "SELECT price, qty, tva_tx FROM ".MAIN_DB_PREFIX."propaldet WHERE fk_propal = $this->id";
if ( $this->db->query($sql) )
{
$num = $this->db->num_rows();
@@ -288,7 +288,7 @@ class Propal
/*
*
*/
- $sql = "UPDATE llx_propal set price=$totalht, tva=$totaltva, total=$totalttc, remise=$total_remise WHERE rowid = $this->id";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."propal set price=$totalht, tva=$totaltva, total=$totalttc, remise=$total_remise WHERE rowid = $this->id";
if ( $this->db->query($sql) )
{
return 1;
@@ -308,7 +308,7 @@ class Propal
{
$sql = "SELECT ref,total,price,remise,tva,fk_soc,fk_soc_contact,".$this->db->pdate("datep")."as dp,".$this->db->pdate("fin_validite")."as dfv, model_pdf, note, fk_statut, remise_percent";
- $sql .= " FROM llx_propal WHERE rowid=$rowid;";
+ $sql .= " FROM ".MAIN_DB_PREFIX."propal WHERE rowid=$rowid;";
if ($this->db->query($sql) )
{
@@ -349,7 +349,7 @@ class Propal
*/
$sql = "SELECT p.rowid, p.label, p.description, p.ref, d.price, d.tva_tx, d.qty, d.remise_percent, d.subprice";
- $sql .= " FROM llx_propaldet as d, llx_product as p";
+ $sql .= " FROM ".MAIN_DB_PREFIX."propaldet as d, ".MAIN_DB_PREFIX."product as p";
$sql .= " WHERE d.fk_propal = ".$this->id ." AND d.fk_product = p.rowid ORDER by d.rowid ASC";
$result = $this->db->query($sql);
@@ -387,7 +387,7 @@ class Propal
* Lignes génériques
*/
$sql = "SELECT d.qty, d.description, d.price, d.subprice, d.tva_tx, d.rowid, d.remise_percent";
- $sql .= " FROM llx_propaldet as d";
+ $sql .= " FROM ".MAIN_DB_PREFIX."propaldet as d";
$sql .= " WHERE d.fk_propal = ".$this->id ." AND d.fk_product = 0";
$result = $this->db->query($sql);
@@ -440,7 +440,7 @@ class Propal
if ($user->rights->propale->valider)
{
- $sql = "UPDATE llx_propal SET fk_statut = 1, date_valid=now(), fk_user_valid=$user->id";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET 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) )
@@ -465,7 +465,7 @@ class Propal
$remise = ereg_replace(",",".",$remise);
- $sql = "UPDATE llx_propal SET remise_percent = ".$remise;
+ $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET remise_percent = ".$remise;
$sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;";
if ($this->db->query($sql) )
@@ -490,7 +490,7 @@ class Propal
if ($user->rights->propale->creer)
{
- $sql = "UPDATE llx_propal SET model_pdf = '$modelpdf'";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET model_pdf = '$modelpdf'";
$sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;";
if ($this->db->query($sql) )
@@ -513,7 +513,7 @@ class Propal
$this->statut = $statut;
- $sql = "UPDATE llx_propal SET fk_statut = $statut, note = '$note', date_cloture=now(), fk_user_cloture=$user->id";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fk_statut = $statut, note = '$note', date_cloture=now(), fk_user_cloture=$user->id";
$sql .= " WHERE rowid = $this->id;";
if ($this->db->query($sql) )
@@ -559,7 +559,7 @@ class Propal
*/
Function reopen($userid)
{
- $sql = "UPDATE llx_propal SET fk_statut = 0";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fk_statut = 0";
$sql .= " WHERE rowid = $this->id;";
@@ -580,7 +580,7 @@ class Propal
{
$ga = array();
- $sql = "SELECT rowid, ref FROM llx_propal";
+ $sql = "SELECT rowid, ref FROM ".MAIN_DB_PREFIX."propal";
if ($brouillon = 1)
{
$sql .= " WHERE fk_statut = 0";
@@ -629,7 +629,7 @@ class Propal
{
$ga = array();
- $sql = "SELECT fk_commande FROM llx_co_pr";
+ $sql = "SELECT fk_commande FROM ".MAIN_DB_PREFIX."co_pr";
$sql .= " WHERE fk_propale = " . $this->id;
if ($this->db->query($sql) )
{
@@ -659,10 +659,10 @@ class Propal
*/
Function delete()
{
- $sql = "DELETE FROM llx_propaldet WHERE fk_propal = $this->id ;";
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE fk_propal = $this->id ;";
if ( $this->db->query($sql) )
{
- $sql = "DELETE FROM llx_propal WHERE rowid = $this->id;";
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."propal WHERE rowid = $this->id;";
if ( $this->db->query($sql) )
{
return 1;
diff --git a/htdocs/retourbplc.class.php b/htdocs/retourbplc.class.php
index 812d5a47597..6a0ef26b565 100644
--- a/htdocs/retourbplc.class.php
+++ b/htdocs/retourbplc.class.php
@@ -58,7 +58,7 @@ class Retourbplc
{
- $sql = "INSERT INTO llx_transaction_bplc";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."transaction_bplc";
$sql .= " (ipclient,
num_transaction,
date_transaction,
diff --git a/htdocs/service.class.php b/htdocs/service.class.php
index b0a9d7eaf29..3a788ebedfe 100644
--- a/htdocs/service.class.php
+++ b/htdocs/service.class.php
@@ -47,7 +47,7 @@ class Service {
*/
Function create($user) {
- $sql = "INSERT INTO llx_service (datec, fk_user_author) VALUES (now(), ".$user->id.")";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."service (datec, fk_user_author) VALUES (now(), ".$user->id.")";
if ($this->db->query($sql) ) {
$id = $this->db->last_insert_id();
@@ -66,7 +66,7 @@ class Service {
*/
Function update($id, $user) {
- $sql = "UPDATE llx_service ";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."service ";
$sql .= " SET label = '" . trim($this->libelle) ."'";
$sql .= ",ref = '" . trim($this->ref) ."'";
$sql .= ",price = " . $this->price ;
@@ -88,7 +88,7 @@ class Service {
*/
Function start_comm($id, $user, $datedeb=0) {
- $sql = "UPDATE llx_service ";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."service ";
if ($datedeb) {
$sql .= " SET debut_comm = '$datedeb'";
} else {
@@ -111,7 +111,7 @@ class Service {
*/
Function stop_comm($id, $user, $datefin=0) {
- $sql = "UPDATE llx_service ";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."service ";
if ($datefin) {
$sql .= " SET fin_comm = '$datefin'";
} else {
@@ -137,7 +137,7 @@ class Service {
$sql = "SELECT s.ref,s.label,s.price,s.tms,s.debut_comm,s.fin_comm,s.description,";
$sql .= $this->db->pdate("s.debut_comm") . ' as debut_epoch,';
$sql .= $this->db->pdate("s.fin_comm") . ' as fin_epoch';
- $sql .= " FROM llx_service as s";
+ $sql .= " FROM ".MAIN_DB_PREFIX."service as s";
$sql .= " WHERE s.rowid = $id";
$result = $this->db->query($sql);
diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php
index 3d99b58df36..44cf3dc1c41 100644
--- a/htdocs/societe.class.php
+++ b/htdocs/societe.class.php
@@ -55,7 +55,7 @@ class Societe {
*/
Function create()
{
- $sql = "INSERT INTO llx_societe (nom, datec, datea, client) ";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe (nom, datec, datea, client) ";
$sql .= " VALUES ('".trim($this->nom)."', now(), now(), $this->client);";
if ($this->db->query($sql) ) {
@@ -78,7 +78,7 @@ class Societe {
$this->nom = "VALEUR MANQUANTE";
}
- $sql = "UPDATE llx_societe ";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."societe ";
$sql .= " SET nom = '" . trim($this->nom) ."'";
$sql .= ",address = '" . trim($this->adresse) ."'";
$sql .= ",cp = '" . trim($this->cp) ."'";
@@ -104,7 +104,7 @@ class Societe {
*/
Function delete($id)
{
- $sql = "DELETE from llx_societe ";
+ $sql = "DELETE from ".MAIN_DB_PREFIX."societe ";
$sql .= " WHERE idp = " . $id .";";
if (! $this->db->query($sql))
@@ -150,7 +150,7 @@ class Societe {
* Lignes
*/
$sql = "SELECT f.rowid";
- $sql .= " FROM llx_facture as f WHERE f.fk_soc = ".$this->id;
+ $sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = ".$this->id;
$sql .= " AND f.fk_statut = 1 AND f.paye = 0";
if ($this->db->query($sql))
@@ -181,7 +181,7 @@ class Societe {
$sql = "SELECT s.idp, s.nom, s.address,".$this->db->pdate("s.datec")." as dc, prefix_comm,";
$sql .= " s.tel, s.fax, s.url,s.cp,s.ville, s.note, s.siren, client, fournisseur";
- $sql .= " FROM llx_societe as s";
+ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE s.idp = ".$this->id;
$result = $this->db->query($sql);
@@ -229,7 +229,7 @@ class Societe {
Function attribute_prefix()
{
- $sql = "SELECT nom FROM llx_societe WHERE idp = $this->id";
+ $sql = "SELECT nom FROM ".MAIN_DB_PREFIX."societe WHERE idp = $this->id";
if ( $this->db->query( $sql) )
{
if ( $this->db->num_rows() )
@@ -239,7 +239,7 @@ class Societe {
$prefix = strtoupper(substr($nom, 0, 2));
- $sql = "SELECT count(*) FROM llx_societe WHERE prefix_comm = '$prefix'";
+ $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."societe WHERE prefix_comm = '$prefix'";
if ( $this->db->query( $sql) )
{
if ( $this->db->result(0, 0) )
@@ -250,7 +250,7 @@ class Societe {
{
$this->db->free();
- $sql = "UPDATE llx_societe set prefix_comm='$prefix' WHERE idp=$this->id";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."societe set prefix_comm='$prefix' WHERE idp=$this->id";
if ( $this->db->query( $sql) )
{
@@ -283,7 +283,7 @@ class Societe {
Function get_nom($id)
{
- $sql = "SELECT nom FROM llx_societe WHERE idp=$id;";
+ $sql = "SELECT nom FROM ".MAIN_DB_PREFIX."societe WHERE idp=$id;";
$result = $this->db->query($sql);
@@ -307,7 +307,7 @@ class Societe {
{
$contact_email = array();
- $sql = "SELECT idp, email, name, firstname FROM llx_socpeople WHERE fk_soc = $this->id";
+ $sql = "SELECT idp, email, name, firstname FROM ".MAIN_DB_PREFIX."socpeople WHERE fk_soc = $this->id";
if ($this->db->query($sql) )
{
@@ -340,7 +340,7 @@ class Societe {
{
$contacts = array();
- $sql = "SELECT idp, name, firstname FROM llx_socpeople WHERE fk_soc = $this->id";
+ $sql = "SELECT idp, name, firstname FROM ".MAIN_DB_PREFIX."socpeople WHERE fk_soc = $this->id";
if ($this->db->query($sql) )
{
@@ -372,7 +372,7 @@ class Societe {
Function contact_get_email($rowid)
{
- $sql = "SELECT idp, email, name, firstname FROM llx_socpeople WHERE idp = $rowid";
+ $sql = "SELECT idp, email, name, firstname FROM ".MAIN_DB_PREFIX."socpeople WHERE idp = $rowid";
if ($this->db->query($sql) )
{
diff --git a/htdocs/socnote.php b/htdocs/socnote.php
index 0c366466c89..8e2bd077634 100644
--- a/htdocs/socnote.php
+++ b/htdocs/socnote.php
@@ -22,7 +22,7 @@
require("./pre.inc.php");
if ($HTTP_POST_VARS["action"] == 'add') {
- $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);
}
/*
diff --git a/htdocs/stats.php b/htdocs/stats.php
index 81ae5545df7..500c8c0886d 100644
--- a/htdocs/stats.php
+++ b/htdocs/stats.php
@@ -31,10 +31,10 @@ $mesg = '';
*
*/
$sql = array(
- array("Société","SELECT count(*) FROM llx_societe"),
- array("Contacts","SELECT count(*) FROM llx_socpeople"),
- array("Facture","SELECT count(*) FROM llx_facture"),
- array("Proposition commerciales","SELECT count(*) FROM llx_propal")
+ array("Société","SELECT count(*) FROM ".MAIN_DB_PREFIX."societe"),
+ array("Contacts","SELECT count(*) FROM ".MAIN_DB_PREFIX."socpeople"),
+ array("Facture","SELECT count(*) FROM ".MAIN_DB_PREFIX."facture"),
+ array("Proposition commerciales","SELECT count(*) FROM ".MAIN_DB_PREFIX."propal")
);
diff --git a/htdocs/tva.class.php b/htdocs/tva.class.php
index d3377e62567..9acf3dbef5a 100644
--- a/htdocs/tva.class.php
+++ b/htdocs/tva.class.php
@@ -63,7 +63,7 @@ class Tva
{
$sql = "SELECT sum(f.tva) as amount";
- $sql .= " FROM llx_facture as f WHERE f.paye = 1";
+ $sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE f.paye = 1";
if ($year)
{
@@ -102,7 +102,7 @@ class Tva
{
$sql = "SELECT sum(f.amount) as amount";
- $sql .= " FROM llx_facture_fourn as f";
+ $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
if ($year)
{
@@ -141,7 +141,7 @@ class Tva
{
$sql = "SELECT sum(f.amount) as amount";
- $sql .= " FROM llx_tva as f";
+ $sql .= " FROM ".MAIN_DB_PREFIX."tva as f";
if ($year)
{
@@ -177,7 +177,7 @@ class Tva
*/
Function add_payement($datep, $datev, $amount)
{
- $sql = "INSERT INTO llx_tva (datep, datev, amount) ";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."tva (datep, datev, amount) ";
$sql .= " VALUES ('".$this->db->idate($datep)."',";
$sql .= "'".$this->db->idate($datev)."'," . ereg_replace(",",".",$amount) .")";
diff --git a/htdocs/user.class.php b/htdocs/user.class.php
index d6434618dd8..a4d02baa72b 100644
--- a/htdocs/user.class.php
+++ b/htdocs/user.class.php
@@ -81,7 +81,7 @@ class User
if ($lowid == 1)
{
- $sql = "REPLACE INTO llx_user_rights (fk_user, fk_id) VALUES ($this->id, $rid)";
+ $sql = "REPLACE INTO ".MAIN_DB_PREFIX."user_rights (fk_user, fk_id) VALUES ($this->id, $rid)";
if ($this->db->query($sql))
{
}
@@ -89,12 +89,12 @@ class User
if ($lowid > 1)
{
- $sql = "REPLACE INTO llx_user_rights (fk_user, fk_id) VALUES ($this->id, $rid)";
+ $sql = "REPLACE INTO ".MAIN_DB_PREFIX."user_rights (fk_user, fk_id) VALUES ($this->id, $rid)";
if ($this->db->query($sql))
{
}
$nid = $topid . "1";
- $sql = "REPLACE INTO llx_user_rights (fk_user, fk_id) VALUES ($this->id, $nid)";
+ $sql = "REPLACE INTO ".MAIN_DB_PREFIX."user_rights (fk_user, fk_id) VALUES ($this->id, $nid)";
if ($this->db->query($sql))
{
@@ -110,7 +110,7 @@ class User
for ($i = 1 ; $i < 10 ; $i++)
{
$nid = $topid . "$i";
- $sql = "REPLACE INTO llx_user_rights (fk_user, fk_id) VALUES ($this->id, $nid)";
+ $sql = "REPLACE INTO ".MAIN_DB_PREFIX."user_rights (fk_user, fk_id) VALUES ($this->id, $nid)";
if ($this->db->query($sql))
{
@@ -146,7 +146,7 @@ class User
if ($lowid > 1)
{
- $sql = "DELETE FROM llx_user_rights WHERE fk_user = $this->id AND fk_id=$rid";
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_rights WHERE fk_user = $this->id AND fk_id=$rid";
if ($this->db->query($sql))
{
}
@@ -156,7 +156,7 @@ class User
{
$fid = $topid . "0";
$lid = $topid . "9";
- $sql = "DELETE FROM llx_user_rights WHERE fk_user = $this->id AND fk_id >= $fid AND fk_id <= $lid";
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_rights WHERE fk_user = $this->id AND fk_id >= $fid AND fk_id <= $lid";
if ($this->db->query($sql))
{
@@ -172,7 +172,7 @@ class User
for ($i = 1 ; $i < 10 ; $i++)
{
$nid = $topid . "$i";
- $sql = "DELETE FROM llx_user_rights WHERE fk_user = $this->id AND fk_id=$nid";
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_rights WHERE fk_user = $this->id AND fk_id=$nid";
if ($this->db->query($sql))
{
@@ -192,7 +192,7 @@ class User
*/
Function getrights($module='')
{
- $sql = "SELECT fk_user, fk_id FROM llx_user_rights WHERE fk_user= $this->id";
+ $sql = "SELECT fk_user, fk_id FROM ".MAIN_DB_PREFIX."user_rights WHERE fk_user= $this->id";
/*
if ($module)
{
@@ -375,8 +375,8 @@ class User
{
//$sql = "SELECT u.rowid, u.name, u.firstname, u.email, u.code, u.admin, u.module_comm, u.module_compta, u.login, u.pass, u.webcal_login, u.note";
- //$sql .= " FROM llx_user as u";
- $sql = "SELECT * FROM llx_user as u";
+ //$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
+ $sql = "SELECT * FROM ".MAIN_DB_PREFIX."user as u";
if ($this->id)
{
$sql .= " WHERE u.rowid = $this->id";
@@ -433,11 +433,11 @@ class User
if ($this->contact_id)
{
- $sql = "DELETE FROM llx_user WHERE rowid = $this->id";
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."user WHERE rowid = $this->id";
$result = $this->db->query($sql);
- $sql = "UPDATE llx_socpeople SET fk_user = 0 WHERE idp = $this->contact_id";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET fk_user = 0 WHERE idp = $this->contact_id";
if ($this->db->query($sql))
{
@@ -446,12 +446,12 @@ class User
}
else
{
- $sql = "UPDATE llx_user SET login = '' WHERE rowid = $this->id";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."user SET login = '' WHERE rowid = $this->id";
$result = $this->db->query($sql);
}
- $sql = "DELETE FROM llx_user_rights WHERE fk_user = $this->id";
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_rights WHERE fk_user = $this->id";
if ($this->db->query($sql))
{
@@ -465,7 +465,7 @@ class User
*/
Function create()
{
- $sql = "SELECT login FROM llx_user WHERE login ='$this->login'";
+ $sql = "SELECT login FROM ".MAIN_DB_PREFIX."user WHERE login ='$this->login'";
if ($this->db->query($sql))
{
@@ -479,7 +479,7 @@ class User
}
else
{
- $sql = "INSERT INTO llx_user (datec, login) values (now(),'$this->login');";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."user (datec, login) values (now(),'$this->login');";
if ($this->db->query($sql))
{
if ($this->db->affected_rows())
@@ -513,7 +513,7 @@ class User
$this->login = strtolower(substr($contact->prenom, 0, 3)) . strtolower(substr($contact->nom, 0, 3));
- $sql = "SELECT login FROM llx_user WHERE login ='$this->login'";
+ $sql = "SELECT login FROM ".MAIN_DB_PREFIX."user WHERE login ='$this->login'";
if ($this->db->query($sql))
{
@@ -527,7 +527,7 @@ class User
}
else
{
- $sql = "INSERT INTO llx_user (datec, login, fk_socpeople, fk_societe)";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."user (datec, login, fk_socpeople, fk_societe)";
$sql .= " VALUES (now(),'$this->login',$contact->id, $contact->societeid);";
if ($this->db->query($sql))
{
@@ -537,7 +537,7 @@ class User
$this->admin = 0;
$this->update();
- $sql = "UPDATE llx_socpeople SET fk_user = $this->id WHERE idp = $contact->id";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET fk_user = $this->id WHERE idp = $contact->id";
$this->db->query($sql);
$this->set_default_rights();
@@ -563,7 +563,7 @@ class User
*/
Function set_default_rights()
{
- $sql = "SELECT id FROM llx_rights_def WHERE bydefault = 1";
+ $sql = "SELECT id FROM ".MAIN_DB_PREFIX."rights_def WHERE bydefault = 1";
if ($this->db->query($sql))
{
@@ -581,7 +581,7 @@ class User
$i = 0;
while ($i < $num)
{
- $sql = "REPLACE INTO llx_user_rights (fk_user, fk_id) VALUES ($this->id, $rd[$i])";
+ $sql = "REPLACE INTO ".MAIN_DB_PREFIX."user_rights (fk_user, fk_id) VALUES ($this->id, $rd[$i])";
if ($this->db->query($sql))
{
@@ -595,7 +595,7 @@ class User
*/
Function update()
{
- $sql = "SELECT login FROM llx_user WHERE login ='$this->login' AND rowid <> $this->id";
+ $sql = "SELECT login FROM ".MAIN_DB_PREFIX."user WHERE login ='$this->login' AND rowid <> $this->id";
if ($this->db->query($sql))
{
@@ -612,7 +612,7 @@ class User
if (!strlen($this->code))
$this->code = $this->login;
- $sql = "UPDATE llx_user SET ";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."user SET ";
$sql .= " name = '$this->nom'";
$sql .= ", firstname = '$this->prenom'";
$sql .= ", login = '$this->login'";
@@ -662,7 +662,7 @@ class User
$sqlpass = $password;
}
$this->pass=$password;
- $sql = "UPDATE llx_user SET pass = '".$sqlpass."'";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."user SET pass = '".$sqlpass."'";
$sql .= " WHERE rowid = $this->id";
$result = $this->db->query($sql);
|