Fix regression db => this->db

This commit is contained in:
Laurent Destailleur 2017-09-15 19:37:23 +02:00
parent ac1d701d6f
commit 3c9532841f
21 changed files with 59 additions and 60 deletions

View File

@ -73,7 +73,7 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts
$posindice=9; $posindice=9;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -107,7 +107,7 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts
$posindice=9; $posindice=9;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque";
$sql.= " WHERE ref like '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref like '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -73,7 +73,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."commande"; $sql.= " FROM ".MAIN_DB_PREFIX."commande";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -107,7 +107,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."commande"; $sql.= " FROM ".MAIN_DB_PREFIX."commande";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -72,7 +72,7 @@ class mod_contract_serpis extends ModelNumRefContracts
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."contrat"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -105,7 +105,7 @@ class mod_contract_serpis extends ModelNumRefContracts
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."contrat"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -71,7 +71,7 @@ class mod_expedition_safor extends ModelNumRefExpedition
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."expedition"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -104,7 +104,7 @@ class mod_expedition_safor extends ModelNumRefExpedition
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."expedition"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -72,7 +72,7 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -105,7 +105,7 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -89,7 +89,7 @@ class mod_facture_mars extends ModeleNumRefFactures
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED) as max"; // This is standard SQL $sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture"; $sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$this->db->escape($this->prefixinvoice)."____-%'"; $sql.= " WHERE facnumber LIKE '".$db->escape($this->prefixinvoice)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -111,7 +111,7 @@ class mod_facture_mars extends ModeleNumRefFactures
$posindice=8; $posindice=8;
$sql = "SELECT MAX(SUBSTRING(facnumber FROM ".$posindice.")) as max"; // This is standard SQL $sql = "SELECT MAX(SUBSTRING(facnumber FROM ".$posindice.")) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture"; $sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$this->db->escape($this->prefixcreditnote)."____-%'"; $sql.= " WHERE facnumber LIKE '".$db->escape($this->prefixcreditnote)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -87,7 +87,7 @@ class mod_facture_terre extends ModeleNumRefFactures
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL $sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture"; $sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$this->db->escape($this->prefixinvoice)."____-%'"; $sql.= " WHERE facnumber LIKE '".$db->escape($this->prefixinvoice)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -109,7 +109,7 @@ class mod_facture_terre extends ModeleNumRefFactures
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL $sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture"; $sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$this->db->escape($this->prefixcreditnote)."____-%'"; $sql.= " WHERE facnumber LIKE '".$db->escape($this->prefixcreditnote)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -130,7 +130,7 @@ class mod_facture_terre extends ModeleNumRefFactures
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL $sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture"; $sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$this->db->escape($this->prefixdeposit)."____-%'"; $sql.= " WHERE facnumber LIKE '".$db->escape($this->prefixdeposit)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -74,7 +74,7 @@ class mod_pacific extends ModeleNumRefFicheinter
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter"; $sql.= " FROM ".MAIN_DB_PREFIX."fichinter";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " WHERE entity = ".$conf->entity; $sql.= " WHERE entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -110,7 +110,7 @@ class mod_pacific extends ModeleNumRefFicheinter
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter"; $sql.= " FROM ".MAIN_DB_PREFIX."fichinter";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -60,8 +60,7 @@ abstract class ModelePDFFicheinter extends CommonDocGenerator
/** /**
* \class ModeleNumRefFicheinter * Classe mere des modeles de numerotation des references de fiches d'intervention
* \brief Classe mere des modeles de numerotation des references de fiches d'intervention
*/ */
abstract class ModeleNumRefFicheinter abstract class ModeleNumRefFicheinter
{ {

View File

@ -80,7 +80,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."livraison"; $sql.= " FROM ".MAIN_DB_PREFIX."livraison";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -114,7 +114,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."livraison"; $sql.= " FROM ".MAIN_DB_PREFIX."livraison";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -73,7 +73,7 @@ class mod_payment_cicada extends ModeleNumRefPayments
$posindice=9; $posindice=9;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."paiement"; $sql.= " FROM ".MAIN_DB_PREFIX."paiement";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -107,7 +107,7 @@ class mod_payment_cicada extends ModeleNumRefPayments
$posindice=9; $posindice=9;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."paiement"; $sql.= " FROM ".MAIN_DB_PREFIX."paiement";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -284,7 +284,7 @@ class printing_printgcp extends PrintingDriver
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
global $conf, $user, $db; global $conf, $user;
$error = 0; $error = 0;
$fileprint=$conf->{$module}->dir_output; $fileprint=$conf->{$module}->dir_output;
@ -293,7 +293,7 @@ class printing_printgcp extends PrintingDriver
$mimetype = dol_mimetype($fileprint); $mimetype = dol_mimetype($fileprint);
// select printer uri for module order, propal,... // select printer uri for module order, propal,...
$sql = "SELECT rowid, printer_id, copy FROM ".MAIN_DB_PREFIX."printing WHERE module='".$module."' AND driver='printgcp' AND userid=".$user->id; $sql = "SELECT rowid, printer_id, copy FROM ".MAIN_DB_PREFIX."printing WHERE module='".$module."' AND driver='printgcp' AND userid=".$user->id;
$result = $db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
@ -315,7 +315,7 @@ class printing_printgcp extends PrintingDriver
} }
} }
} }
else dol_print_error($db); else dol_print_error($this->db);
$ret = $this->sendPrintToPrinter($printer_id, $file, $fileprint, $mimetype); $ret = $this->sendPrintToPrinter($printer_id, $file, $fileprint, $mimetype);
$this->errors = 'PRINTGCP: '.mb_convert_encoding($ret['errormessage'], "UTF-8"); $this->errors = 'PRINTGCP: '.mb_convert_encoding($ret['errormessage'], "UTF-8");

View File

@ -77,7 +77,7 @@ class printing_printipp extends PrintingDriver
*/ */
function print_file($file, $module, $subdir='') function print_file($file, $module, $subdir='')
{ {
global $conf, $user, $db; global $conf, $user;
$error = 0; $error = 0;
include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php'; include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php';
@ -92,7 +92,7 @@ class printing_printipp extends PrintingDriver
// select printer uri for module order, propal,... // select printer uri for module order, propal,...
$sql = "SELECT rowid,printer_id,copy FROM ".MAIN_DB_PREFIX."printing WHERE module = '".$module."' AND driver = 'printipp' AND userid = ".$user->id; $sql = "SELECT rowid,printer_id,copy FROM ".MAIN_DB_PREFIX."printing WHERE module = '".$module."' AND driver = 'printipp' AND userid = ".$user->id;
$result = $db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
@ -116,7 +116,7 @@ class printing_printipp extends PrintingDriver
} }
} }
} }
else dol_print_error($db); else dol_print_error($this->db);
// Set number of copy // Set number of copy
$ipp->setCopies($obj->copy); $ipp->setCopies($obj->copy);

View File

@ -75,7 +75,7 @@ class mod_project_simple extends ModeleNumRefProjects
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."projet"; $sql.= " FROM ".MAIN_DB_PREFIX."projet";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
@ -111,7 +111,7 @@ class mod_project_simple extends ModeleNumRefProjects
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."projet"; $sql.= " FROM ".MAIN_DB_PREFIX."projet";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -76,7 +76,7 @@ class mod_task_simple extends ModeleNumRefTask
$sql = "SELECT MAX(CAST(SUBSTRING(task.ref FROM " . $posindice . ") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(task.ref FROM " . $posindice . ") AS SIGNED)) as max";
$sql .= " FROM " . MAIN_DB_PREFIX . "projet_task AS task, "; $sql .= " FROM " . MAIN_DB_PREFIX . "projet_task AS task, ";
$sql .= MAIN_DB_PREFIX . "projet AS project WHERE task.fk_projet=project.rowid"; $sql .= MAIN_DB_PREFIX . "projet AS project WHERE task.fk_projet=project.rowid";
$sql .= " AND task.ref LIKE '" . $this->db->escape($this->prefix) . "____-%'"; $sql .= " AND task.ref LIKE '" . $db->escape($this->prefix) . "____-%'";
$sql .= " AND project.entity = " . $conf->entity; $sql .= " AND project.entity = " . $conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
@ -112,7 +112,7 @@ class mod_task_simple extends ModeleNumRefTask
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task"; $sql.= " FROM ".MAIN_DB_PREFIX."projet_task";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)

View File

@ -75,7 +75,7 @@ class mod_propale_marbre extends ModeleNumRefPropales
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."propal"; $sql.= " FROM ".MAIN_DB_PREFIX."propal";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -112,7 +112,7 @@ class mod_propale_marbre extends ModeleNumRefPropales
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."propal"; $sql.= " FROM ".MAIN_DB_PREFIX."propal";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -159,7 +159,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
$sql.= " WHERE "; $sql.= " WHERE ";
if ($type == 'customer') $sql.= "code_compta"; if ($type == 'customer') $sql.= "code_compta";
else if ($type == 'supplier') $sql.= "code_compta_fournisseur"; else if ($type == 'supplier') $sql.= "code_compta_fournisseur";
$sql.= " = '".$this->db->escape($code)."'"; $sql.= " = '".$db->escape($code)."'";
if (! empty($societe->id)) $sql.= " AND rowid <> ".$societe->id; if (! empty($societe->id)) $sql.= " AND rowid <> ".$societe->id;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -82,7 +82,7 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn"; $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefixinvoice)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefixinvoice)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
@ -103,7 +103,7 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn"; $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefixcreditnote)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefixcreditnote)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -124,7 +124,7 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn"; $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefixdeposit)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefixdeposit)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -85,7 +85,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
@ -120,7 +120,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -73,7 +73,7 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments
$posindice=9; $posindice=9;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn"; $sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -107,7 +107,7 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments
$posindice=10; $posindice=10;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn"; $sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -75,7 +75,7 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."supplier_proposal"; $sql.= " FROM ".MAIN_DB_PREFIX."supplier_proposal";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
@ -112,7 +112,7 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."supplier_proposal"; $sql.= " FROM ".MAIN_DB_PREFIX."supplier_proposal";
$sql.= " WHERE ref LIKE '".$this->db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);