Prefix en dur "llx_" remplac par constante "MAIN_DB_PREFIX".

This commit is contained in:
Laurent Destailleur 2004-02-01 00:42:23 +00:00
parent a8ac76084f
commit 28d6f60875
13 changed files with 54 additions and 54 deletions

View File

@ -249,7 +249,7 @@ class Adherent
$this->date = $this->db->idate($this->date);
$sql = "INSERT INTO llx_adherent (datec)";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent (datec)";
$sql .= " VALUES (now())";
$result = $this->db->query($sql);
@ -275,7 +275,7 @@ class Adherent
Function update()
{
$sql = "UPDATE llx_adherent SET ";
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET ";
$sql .= "prenom = '".$this->prenom ."'";
$sql .= ",nom='" .$this->nom."'";
$sql .= ",societe='".$this->societe."'";
@ -307,7 +307,7 @@ class Adherent
if (sizeof($this->array_options) > 0 )
{
$sql = "REPLACE INTO llx_adherent_options SET adhid = $this->id";
$sql = "REPLACE INTO ".MAIN_DB_PREFIX."adherent_options SET adhid = $this->id";
foreach($this->array_options as $key => $value)
{
// recupere le nom de l'attribut
@ -337,14 +337,14 @@ class Adherent
{
$result = 0;
$sql = "DELETE FROM llx_adherent WHERE rowid = $rowid";
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent WHERE rowid = $rowid";
if ( $this->db->query( $sql) )
{
if ( $this->db->affected_rows() )
{
$sql = "DELETE FROM llx_cotisation WHERE fk_adherent = $rowid";
$sql = "DELETE FROM ".MAIN_DB_PREFIX."cotisation WHERE fk_adherent = $rowid";
if ( $this->db->query( $sql) )
{
if ( $this->db->affected_rows() )
@ -352,7 +352,7 @@ class Adherent
$result = 1;
}
}
$sql = "DELETE FROM llx_adherent_options WHERE adhid = $rowid";
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_options WHERE adhid = $rowid";
if ( $this->db->query( $sql) )
{
if ( $this->db->affected_rows() )
@ -378,7 +378,7 @@ class Adherent
/* Fetch adherent corresponding to login passed in argument */
Function fetch_login($login)
{
$sql = "SELECT rowid FROM llx_adherent WHERE login='$login' LIMIT 1";
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent WHERE login='$login' LIMIT 1";
if ( $this->db->query( $sql) )
{
if ($this->db->num_rows())
@ -397,7 +397,7 @@ class Adherent
{
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, d.statut, d.public, d.adresse, d.cp, d.ville, d.pays, d.note, d.email, d.login, d.pass, d.naiss, d.photo, d.fk_adherent_type, d.morphy, t.libelle as type";
$sql .= ",".$this->db->pdate("d.datefin")." as datefin";
$sql .= " FROM llx_adherent as d, llx_adherent_type as t";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
$sql .= " WHERE d.rowid = $rowid AND d.fk_adherent_type = t.rowid";
if ( $this->db->query( $sql) )
@ -444,7 +444,7 @@ class Adherent
{
$tab=array();
$sql = "SELECT *";
$sql .= " FROM llx_adherent_options";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_options";
$sql .= " WHERE adhid=$rowid";
if ( $this->db->query( $sql) ){
@ -472,7 +472,7 @@ class Adherent
Function fetch_name_optionals()
{
$array_name_options=array();
$sql = "SHOW COLUMNS FROM llx_adherent_options";
$sql = "SHOW COLUMNS FROM ".MAIN_DB_PREFIX."adherent_options";
if ( $this->db->query( $sql) ){
if ($this->db->num_rows()){
@ -502,7 +502,7 @@ class Adherent
{
$sql = "INSERT INTO llx_cotisation (fk_adherent, dateadh, cotisation)";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."cotisation (fk_adherent, dateadh, cotisation)";
$sql .= " VALUES ($this->id, ".$this->db->idate($date).", $montant)";
if ( $this->db->query( $sql) )
@ -515,7 +515,7 @@ class Adherent
strftime("%d",$date),
strftime("%Y",$date)+1) - (24 * 3600);
$sql = "UPDATE llx_adherent SET datefin = ".$this->db->idate($datefin)." WHERE rowid =". $this->id;
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET datefin = ".$this->db->idate($datefin)." WHERE rowid =". $this->id;
if ( $this->db->query( $sql) )
{
@ -544,7 +544,7 @@ class Adherent
Function validate($userid)
{
$sql = "UPDATE llx_adherent SET ";
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET ";
$sql .= "statut=1";
$sql .= ",fk_user_valid=".$userid;
@ -571,7 +571,7 @@ class Adherent
Function resiliate($userid)
{
$sql = "UPDATE llx_adherent SET ";
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET ";
$sql .= "statut=0";
$sql .= ",fk_user_valid=".$userid;

View File

@ -117,7 +117,7 @@ class AdherentOptions
* Insertion dans la base
*/
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-]*$/",$attrname)){
$sql = "ALTER TABLE llx_adherent_options ";
$sql = "ALTER TABLE ".MAIN_DB_PREFIX."adherent_options ";
switch ($type){
case 'varchar' :
case 'interger' :
@ -153,7 +153,7 @@ class AdherentOptions
* Insertion dans la base
*/
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-]*$/",$attrname)){
$sql = "INSERT INTO llx_adherent_options_label SET ";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_options_label SET ";
$escaped_label=mysql_escape_string($label);
$sql .= " name='$attrname',label='$escaped_label' ";
@ -177,7 +177,7 @@ class AdherentOptions
Function delete($attrname)
{
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-]*$/",$attrname)){
$sql = "ALTER TABLE llx_adherent_options DROP COLUMN $attrname";
$sql = "ALTER TABLE ".MAIN_DB_PREFIX."adherent_options DROP COLUMN $attrname";
if ( $this->db->query( $sql) )
{
@ -202,7 +202,7 @@ class AdherentOptions
Function delete_label($attrname)
{
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-]*$/",$attrname)){
$sql = "DELETE FROM llx_adherent_options_label WHERE name='$attrname'";
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_options_label WHERE name='$attrname'";
if ( $this->db->query( $sql) )
{
@ -227,7 +227,7 @@ class AdherentOptions
Function update($attrname,$type='varchar',$length=255)
{
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-]*$/",$attrname)){
$sql = "ALTER TABLE llx_adherent_options ";
$sql = "ALTER TABLE ".MAIN_DB_PREFIX."adherent_options ";
switch ($type){
case 'varchar' :
case 'interger' :
@ -268,7 +268,7 @@ class AdherentOptions
{
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-]*$/",$attrname)){
$escaped_label=mysql_escape_string($label);
$sql = "REPLACE INTO llx_adherent_options_label SET name='$attrname',label='$escaped_label'";
$sql = "REPLACE INTO ".MAIN_DB_PREFIX."adherent_options_label SET name='$attrname',label='$escaped_label'";
if ( $this->db->query( $sql) )
{
@ -301,7 +301,7 @@ class AdherentOptions
Function fetch_name_optionals()
{
$array_name_options=array();
$sql = "SHOW COLUMNS FROM llx_adherent_options";
$sql = "SHOW COLUMNS FROM ".MAIN_DB_PREFIX."adherent_options";
if ( $this->db->query( $sql) )
{
@ -333,7 +333,7 @@ class AdherentOptions
Function fetch_name_optionals_label()
{
$array_name_label=array();
$sql = "SELECT name,label FROM llx_adherent_options_label";
$sql = "SELECT name,label FROM ".MAIN_DB_PREFIX."adherent_options_label";
if ( $this->db->query( $sql) )
{

View File

@ -67,7 +67,7 @@ class AdherentType
* Insertion dans la base
*/
$sql = "INSERT INTO llx_adherent_type (statut)";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type (statut)";
$sql .= " VALUES ($this->statut)";
$result = $this->db->query($sql);
@ -93,7 +93,7 @@ class AdherentType
Function update()
{
$sql = "UPDATE llx_adherent_type SET ";
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type SET ";
$sql .= "libelle = '".$this->libelle ."'";
$sql .= ",statut=".$this->statut;
$sql .= ",cotisation='".$this->cotisation."'";
@ -125,7 +125,7 @@ class AdherentType
{
$sql = "DELETE FROM llx_adherent_type WHERE rowid = $rowid";
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_type WHERE rowid = $rowid";
if ( $this->db->query( $sql) )
{
@ -152,7 +152,7 @@ class AdherentType
Function fetch($rowid)
{
$sql = "SELECT *";
$sql .= " FROM llx_adherent_type as d";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
$sql .= " WHERE d.rowid = $rowid";
if ( $this->db->query( $sql) )
@ -186,7 +186,7 @@ class AdherentType
{
$projets = array();
$sql = "SELECT rowid, libelle FROM llx_adherent_type";
$sql = "SELECT rowid, libelle FROM ".MAIN_DB_PREFIX."adherent_type";
if ($this->db->query($sql) )
{

View File

@ -64,7 +64,7 @@ if (!isset($annee)){
// requete en prenant que les adherents a jour de cotisation
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, ".$db->pdate("d.datefin")." as datefin, adresse,cp,ville,pays, t.libelle as type, d.naiss, d.email, d.photo";
$sql .= " FROM llx_adherent as d, llx_adherent_type as t";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1 AND datefin > now()";
$sql .= " ORDER BY d.rowid ASC ";

View File

@ -52,7 +52,7 @@ if (!isset($annee)){
// requete en prenant que les adherents a jour de cotisation
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, ".$db->pdate("d.datefin")." as datefin, adresse,cp,ville,pays, t.libelle as type, d.naiss, d.email, d.photo";
$sql .= " FROM llx_adherent as d, llx_adherent_type as t";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1 AND datefin > now()";
$sql .= " ORDER BY d.rowid ASC ";

View File

@ -166,7 +166,7 @@ class Cotisation
$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);
@ -193,7 +193,7 @@ class Cotisation
$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 ."'";
@ -234,7 +234,7 @@ class Cotisation
{
$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) )
{
@ -305,7 +305,7 @@ class Cotisation
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) )
{
@ -330,7 +330,7 @@ class Cotisation
*/
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)
{
@ -361,7 +361,7 @@ class Cotisation
*/
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 ;";
@ -389,7 +389,7 @@ class Cotisation
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) )
{
@ -414,7 +414,7 @@ class Cotisation
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) )
@ -432,7 +432,7 @@ class Cotisation
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) )
@ -450,7 +450,7 @@ class Cotisation
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) )

View File

@ -47,7 +47,7 @@ if ($action == 'add') {
if ($HTTP_POST_VARS["action"] == '2bank' && $HTTP_POST_VARS["rowid"] !=''){
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0){
$dateop=strftime("%Y%m%d",time());
$sql="SELECT cotisation FROM llx_cotisation WHERE rowid=".$HTTP_POST_VARS["rowid"]." ";
$sql="SELECT cotisation FROM ".MAIN_DB_PREFIX."cotisation WHERE rowid=".$HTTP_POST_VARS["rowid"]." ";
$result = $db->query($sql);
if ($result)
{
@ -65,7 +65,7 @@ if ($HTTP_POST_VARS["action"] == '2bank' && $HTTP_POST_VARS["rowid"] !=''){
else
{
// met a jour la table cotisation
$sql="UPDATE llx_cotisation SET fk_bank=$insertid WHERE rowid=".$HTTP_POST_VARS["rowid"]." ";
$sql="UPDATE ".MAIN_DB_PREFIX."cotisation SET fk_bank=$insertid WHERE rowid=".$HTTP_POST_VARS["rowid"]." ";
$result = $db->query($sql);
if ($result)
{
@ -101,7 +101,7 @@ $pageprev = $page - 1;
$pagenext = $page + 1;
$sql = "SELECT c.cotisation, ".$db->pdate("c.dateadh")." as dateadh";
$sql .= " FROM llx_adherent as d, llx_cotisation as c";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c";
$sql .= " WHERE d.rowid = c.fk_adherent";
if(isset($date_select) && $date_select != ''){
$sql .= " AND dateadh LIKE '$date_select%'";
@ -122,7 +122,7 @@ if ($result)
}
}
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, c.cotisation, ".$db->pdate("c.dateadh")." as dateadh, c.fk_bank as bank, c.rowid as crowid";
$sql .= " FROM llx_adherent as d, llx_cotisation as c";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c";
$sql .= " WHERE d.rowid = c.fk_adherent";
if(isset($date_select) && $date_select != ''){
$sql .= " AND dateadh LIKE '$date_select%'";

View File

@ -98,7 +98,7 @@ if ($rowid)
$adho->fetch_optionals();
$sql = "SELECT s.nom,s.idp, f.amount, f.total, f.facnumber";
$sql .= " FROM societe as s, llx_facture as f WHERE f.fk_soc = s.idp";
$sql .= " FROM societe as s, ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.idp";
$sql .= " AND f.rowid = $facid";
$result = $db->query($sql);

View File

@ -73,7 +73,7 @@ if ($HTTP_POST_VARS["action"] == 'cotisation')
else
{
// met a jour la table cotisation
$sql="UPDATE llx_cotisation SET fk_bank=$insertid WHERE rowid=$crowid ";
$sql="UPDATE ".MAIN_DB_PREFIX."cotisation SET fk_bank=$insertid WHERE rowid=$crowid ";
$result = $db->query($sql);
if ($result)
{
@ -97,7 +97,7 @@ if ($HTTP_POST_VARS["action"] == 'add')
$error+=1;
$errmsg .="Login vide. Veuillez en positionner un<BR>\n";
}
$sql = "SELECT login FROM llx_adherent WHERE login='$login';";
$sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='$login';";
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows();
@ -175,7 +175,7 @@ if ($HTTP_POST_VARS["action"] == 'add')
else
{
// met a jour la table cotisation
$sql="UPDATE llx_cotisation SET fk_bank=$insertid WHERE rowid=$crowid ";
$sql="UPDATE ".MAIN_DB_PREFIX."cotisation SET fk_bank=$insertid WHERE rowid=$crowid ";
$result = $db->query($sql);
if ($result)
{
@ -765,7 +765,7 @@ if ($rowid > 0)
*
*/
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, c.cotisation, ".$db->pdate("c.dateadh")." as dateadh";
$sql .= " FROM llx_adherent as d, llx_cotisation as c";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c";
$sql .= " WHERE d.rowid = c.fk_adherent AND d.rowid=$rowid";
$result = $db->query($sql);

View File

@ -38,7 +38,7 @@ if (! isset($cotis))
$cotis=1;
}
$sql = "SELECT d.login, d.pass, ".$db->pdate("d.datefin")." as datefin";
$sql .= " FROM llx_adherent as d ";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d ";
$sql .= " WHERE d.statut = $statut ";
if ($cotis==1){
$sql .= " AND datefin > now() ";

View File

@ -38,7 +38,7 @@ print "</TR>\n";
$var=True;
$sql = "SELECT count(*) as somme , t.libelle FROM llx_adherent as d, llx_adherent_type as t";
$sql = "SELECT count(*) as somme , t.libelle FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1 GROUP BY t.libelle";
$Adherents=array();
@ -60,7 +60,7 @@ if ($result)
}
$sql = "SELECT count(*) as somme , t.libelle FROM llx_adherent as d, llx_adherent_type as t";
$sql = "SELECT count(*) as somme , t.libelle FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1 AND d.datefin >= now() GROUP BY t.libelle";
$result = $db->query($sql);

View File

@ -51,7 +51,7 @@ if (! isset($statut))
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, ".$db->pdate("d.datefin")." as datefin";
$sql .= " , d.email, t.libelle as type, d.morphy, d.statut, t.cotisation";
$sql .= " FROM llx_adherent as d, llx_adherent_type as t";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = $statut";
if ( $_POST["action"] == 'search')
{

View File

@ -84,7 +84,7 @@ print_titre("Configuration");
/* ************************************************************************** */
$sql = "SELECT d.rowid, d.libelle, d.cotisation, d.vote";
$sql .= " FROM llx_adherent_type as d";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
$result = $db->query($sql);
if ($result)
@ -162,7 +162,7 @@ if ($action == 'create') {
/*
* $sql = "SELECT s.nom,s.idp, f.amount, f.total, f.facnumber";
* $sql .= " FROM societe as s, llx_facture as f WHERE f.fk_soc = s.idp";
* $sql .= " FROM societe as s, ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.idp";
* $sql .= " AND f.rowid = $facid";
* $result = $db->query($sql);