diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php
index f91b6e19b48..292fb55a29f 100644
--- a/htdocs/accountancy/class/accountancycategory.class.php
+++ b/htdocs/accountancy/class/accountancycategory.class.php
@@ -354,7 +354,7 @@ class AccountancyCategory // extends CommonObject
$sql .= " position=".(isset($this->position) ? $this->position : "null").",";
$sql .= " fk_country=".(isset($this->fk_country) ? $this->fk_country : "null").",";
$sql .= " active=".(isset($this->active) ? $this->active : "null")."";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
@@ -392,7 +392,7 @@ class AccountancyCategory // extends CommonObject
$error = 0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."c_accounting_category";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php
index 4f46fc7683f..a7d89c45294 100644
--- a/htdocs/accountancy/class/accountingaccount.class.php
+++ b/htdocs/accountancy/class/accountingaccount.class.php
@@ -414,7 +414,7 @@ class AccountingAccount extends CommonObject
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."accounting_account";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::delete sql=".$sql);
$resql = $this->db->query($sql);
diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php
index 82334807bfb..7286e954d0e 100644
--- a/htdocs/accountancy/class/bookkeeping.class.php
+++ b/htdocs/accountancy/class/bookkeeping.class.php
@@ -1262,7 +1262,7 @@ class BookKeeping extends CommonObject
$sql .= ' code_journal = '.(isset($this->code_journal) ? "'".$this->db->escape($this->code_journal)."'" : "null").',';
$sql .= ' journal_label = '.(isset($this->journal_label) ? "'".$this->db->escape($this->journal_label)."'" : "null").',';
$sql .= ' piece_num = '.(isset($this->piece_num) ? $this->piece_num : "null");
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
$this->db->begin();
@@ -1359,7 +1359,7 @@ class BookKeeping extends CommonObject
if (!$error) {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.$mode;
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
$resql = $this->db->query($sql);
if (!$resql) {
diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index f8b49e51b34..53c85e6a05d 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -2085,9 +2085,9 @@ class Adherent extends CommonObject
}
$label .= '';
- $url = DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id;
+ $url = DOL_URL_ROOT.'/adherents/card.php?rowid='.((int) $this->id);
if ($option == 'subscription') {
- $url = DOL_URL_ROOT.'/adherents/subscription.php?rowid='.$this->id;
+ $url = DOL_URL_ROOT.'/adherents/subscription.php?rowid='.((int) $this->id);
}
if ($option != 'nolink') {
diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php
index 40e3e97deb4..9acecaab1ce 100644
--- a/htdocs/adherents/class/adherent_type.class.php
+++ b/htdocs/adherents/class/adherent_type.class.php
@@ -623,7 +623,7 @@ class AdherentType extends CommonObject
$label .= '
'.$langs->trans("SubscriptionRequired").': '.yn($this->subscription);
}
- $linkstart = '';
+ $linkstart = '';
$linkend = '';
$result .= $linkstart;
diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php
index 9bd9bedc78c..65b01991100 100644
--- a/htdocs/adherents/class/subscription.class.php
+++ b/htdocs/adherents/class/subscription.class.php
@@ -417,7 +417,7 @@ class Subscription extends CommonObject
$label .= '
'.$langs->trans('DateEnd').': '.dol_print_date($this->datef, 'day');
}
- $url = DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.$this->id;
+ $url = DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.((int) $this->id);
if ($option != 'nolink') {
// Add param to save lastsearch_values or not
diff --git a/htdocs/asset/class/asset_type.class.php b/htdocs/asset/class/asset_type.class.php
index 7354b8dfd15..6b345aaef68 100644
--- a/htdocs/asset/class/asset_type.class.php
+++ b/htdocs/asset/class/asset_type.class.php
@@ -397,7 +397,7 @@ class AssetType extends CommonObject
$result = '';
$label = $langs->trans("ShowTypeCard", $this->label);
- $linkstart = '';
+ $linkstart = '';
$linkend = '';
$result .= $linkstart;
diff --git a/htdocs/blockedlog/class/authority.class.php b/htdocs/blockedlog/class/authority.class.php
index e3425888fe2..9fc10fdc59e 100644
--- a/htdocs/blockedlog/class/authority.class.php
+++ b/htdocs/blockedlog/class/authority.class.php
@@ -259,7 +259,7 @@ class BlockedLogAuthority
$sql = "UPDATE ".MAIN_DB_PREFIX."blockedlog_authority SET ";
$sql .= " blockchain='".$this->db->escape($this->blockchain)."'";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$res = $this->db->query($sql);
if ($res) {
diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php
index 69ba6cd1308..366d7042d77 100644
--- a/htdocs/blockedlog/class/blockedlog.class.php
+++ b/htdocs/blockedlog/class/blockedlog.class.php
@@ -796,7 +796,7 @@ class BlockedLog
public function setCertified()
{
- $res = $this->db->query("UPDATE ".MAIN_DB_PREFIX."blockedlog SET certified=1 WHERE rowid=".$this->id);
+ $res = $this->db->query("UPDATE ".MAIN_DB_PREFIX."blockedlog SET certified=1 WHERE rowid=".((int) $this->id));
if ($res === false) {
return false;
}
diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php
index 5e5535d8bd6..c811b673197 100644
--- a/htdocs/comm/mailing/class/advtargetemailing.class.php
+++ b/htdocs/comm/mailing/class/advtargetemailing.class.php
@@ -419,7 +419,7 @@ class AdvanceTargetingMailing extends CommonObject
$sql .= " filtervalue=".(isset($this->filtervalue) ? "'".$this->db->escape($this->filtervalue)."'" : "null").",";
$sql .= " fk_user_mod=".$user->id;
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
@@ -459,7 +459,7 @@ class AdvanceTargetingMailing extends CommonObject
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."advtargetemailing";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::delete sql=".$sql);
$resql = $this->db->query($sql);
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index af77b56bc15..197c9c7074f 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -1644,7 +1644,7 @@ class Propal extends CommonObject
$sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").",";
$sql .= " model_pdf=".(isset($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null").",";
$sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null")."";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
@@ -2996,7 +2996,7 @@ class Propal extends CommonObject
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal';
$sql .= ' SET fk_availability = '.$availability_id;
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
dol_syslog(__METHOD__.' availability('.$availability_id.')', LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -3060,7 +3060,7 @@ class Propal extends CommonObject
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal';
$sql .= ' SET fk_input_reason = '.$demand_reason_id;
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
dol_syslog(__METHOD__.' demand_reason('.$demand_reason_id.')', LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index dc4aee66254..cc744f9eb56 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -1060,7 +1060,7 @@ class Commande extends CommonOrder
$initialref = $this->ref;
}
- $sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='".$this->db->escape($initialref)."' WHERE rowid=".$this->id;
+ $sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='".$this->db->escape($initialref)."' WHERE rowid=".((int) $this->id);
if ($this->db->query($sql)) {
$this->ref = $initialref;
@@ -2741,7 +2741,7 @@ class Commande extends CommonOrder
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
$sql .= ' SET fk_availability = '.$availability_id;
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -2805,7 +2805,7 @@ class Commande extends CommonOrder
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
$sql .= ' SET fk_input_reason = '.$demand_reason_id;
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -3310,7 +3310,7 @@ class Commande extends CommonOrder
$sql .= " model_pdf=".(isset($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null").",";
$sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null")."";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php
index a8519236931..16e26b9bc94 100644
--- a/htdocs/compta/bank/class/account.class.php
+++ b/htdocs/compta/bank/class/account.class.php
@@ -2319,7 +2319,7 @@ class AccountLine extends CommonObject
$label = img_picto('', $this->picto).' '.$langs->trans("Transaction").':
';
$label .= ''.$langs->trans("Ref").': '.$this->ref;
- $linkstart = '';
+ $linkstart = '';
$linkend = '';
$result .= $linkstart;
diff --git a/htdocs/compta/bank/class/bankcateg.class.php b/htdocs/compta/bank/class/bankcateg.class.php
index d7651ee3678..ccf5828d40a 100644
--- a/htdocs/compta/bank/class/bankcateg.class.php
+++ b/htdocs/compta/bank/class/bankcateg.class.php
@@ -170,7 +170,7 @@ class BankCateg // extends CommonObject
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."bank_categ SET";
$sql .= " label=".(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null")."";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$sql .= " AND entity = ".$conf->entity;
$this->db->begin();
@@ -237,7 +237,7 @@ class BankCateg // extends CommonObject
// Delete bank categ
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_categ";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$resql = $this->db->query($sql);
if (!$resql) {
diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php
index 8dce4149511..dccdcd5cd24 100644
--- a/htdocs/compta/bank/class/paymentvarious.class.php
+++ b/htdocs/compta/bank/class/paymentvarious.class.php
@@ -214,7 +214,7 @@ class PaymentVarious extends CommonObject
$sql .= " fk_bank=".($this->fk_bank > 0 ? $this->fk_bank : "null").",";
$sql .= " fk_user_author=".(int) $this->fk_user_author.",";
$sql .= " fk_user_modif=".(int) $this->fk_user_modif;
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -334,7 +334,7 @@ class PaymentVarious extends CommonObject
$sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_various";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php
index fd6d7d9fa25..1b9860c976a 100644
--- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php
+++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php
@@ -244,7 +244,7 @@ class CashControl extends CommonObject
$sql .= " SET status = ".self::STATUS_VALIDATED.",";
$sql .= " date_valid='".$this->db->idate($now)."',";
$sql .= " fk_user_valid = ".$user->id;
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php
index 09efdb60f29..4119846e394 100644
--- a/htdocs/compta/facture/class/facture-rec.class.php
+++ b/htdocs/compta/facture/class/facture-rec.class.php
@@ -1967,7 +1967,7 @@ class FactureLigneRec extends CommonInvoiceLine
}
if (!$error) {
- $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.$this->id;
+ $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.((int) $this->id);
$res = $this->db->query($sql);
if ($res === false) {
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index fc6c558a31c..69356287288 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -694,7 +694,7 @@ class Facture extends CommonInvoice
// Update ref with new one
$this->ref = '(PROV'.$this->id.')';
- $sql = 'UPDATE '.MAIN_DB_PREFIX."facture SET ref='".$this->db->escape($this->ref)."' WHERE rowid=".$this->id;
+ $sql = 'UPDATE '.MAIN_DB_PREFIX."facture SET ref='".$this->db->escape($this->ref)."' WHERE rowid=".((int) $this->id);
$resql = $this->db->query($sql);
if (!$resql) {
@@ -1978,7 +1978,7 @@ class Facture extends CommonInvoice
$sql .= " retained_warranty=".(empty($this->retained_warranty) ? "0" : $this->db->escape($this->retained_warranty)).",";
$sql .= " retained_warranty_date_limit=".(strval($this->retained_warranty_date_limit) != '' ? "'".$this->db->idate($this->retained_warranty_date_limit)."'" : 'null').",";
$sql .= " retained_warranty_fk_cond_reglement=".(isset($this->retained_warranty_fk_cond_reglement) ?intval($this->retained_warranty_fk_cond_reglement) : "null");
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
@@ -2375,7 +2375,7 @@ class Facture extends CommonInvoice
$now = dol_now();
- dol_syslog(get_class($this)."::set_paid rowid=".$this->id, LOG_DEBUG);
+ dol_syslog(get_class($this)."::set_paid rowid=".((int) $this->id), LOG_DEBUG);
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture SET';
$sql .= ' fk_statut='.self::STATUS_CLOSED;
@@ -2513,7 +2513,7 @@ class Facture extends CommonInvoice
*/
public function setCanceled($user, $close_code = '', $close_note = '')
{
- dol_syslog(get_class($this)."::setCanceled rowid=".$this->id, LOG_DEBUG);
+ dol_syslog(get_class($this)."::setCanceled rowid=".((int) $this->id), LOG_DEBUG);
$this->db->begin();
@@ -4825,7 +4825,7 @@ class Facture extends CommonInvoice
$fieldname = 'retained_warranty';
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET '.$fieldname.' = '.floatval($value);
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
if ($this->db->query($sql)) {
$this->retained_warranty = floatval($value);
@@ -4862,7 +4862,7 @@ class Facture extends CommonInvoice
$fieldname = 'retained_warranty_date_limit';
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET '.$fieldname.' = '.(strval($timestamp) != '' ? '\''.$this->db->idate($timestamp).'\'' : 'null');
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
if ($this->db->query($sql)) {
$this->retained_warranty_date_limit = $timestamp;
diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php
index f0b199818ef..46b2b2b7805 100644
--- a/htdocs/compta/localtax/class/localtax.class.php
+++ b/htdocs/compta/localtax/class/localtax.class.php
@@ -180,7 +180,7 @@ class Localtax extends CommonObject
$sql .= " fk_bank=".(int) $this->fk_bank.",";
$sql .= " fk_user_creat=".(int) $this->fk_user_creat.",";
$sql .= " fk_user_modif=".(int) $this->fk_user_modif;
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -284,7 +284,7 @@ class Localtax extends CommonObject
// End call triggers
$sql = "DELETE FROM ".MAIN_DB_PREFIX."localtax";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php
index 3d73c59d967..8af9d5a6543 100644
--- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php
+++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php
@@ -191,7 +191,7 @@ class RemiseCheque extends CommonObject
if ($this->id > 0 && $this->errno == 0) {
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
$sql .= " SET ref='(PROV".$this->id.")'";
- $sql .= " WHERE rowid=".$this->id."";
+ $sql .= " WHERE rowid=".((int) $this->id)."";
$resql = $this->db->query($sql);
if (!$resql) {
diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php
index f70daf75c3a..3d04cf1f6a5 100644
--- a/htdocs/compta/prelevement/class/bonprelevement.class.php
+++ b/htdocs/compta/prelevement/class/bonprelevement.class.php
@@ -427,7 +427,7 @@ class BonPrelevement extends CommonObject
$sql .= " SET fk_user_credit = ".$user->id;
$sql .= ", statut = ".self::STATUS_CREDITED;
$sql .= ", date_credit = '".$this->db->idate($date)."'";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$sql .= " AND entity = ".$conf->entity;
$sql .= " AND statut = ".self::STATUS_TRANSFERED;
diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php
index fc91d5f8ed3..d7fcd9278a9 100644
--- a/htdocs/compta/sociales/class/chargesociales.class.php
+++ b/htdocs/compta/sociales/class/chargesociales.class.php
@@ -311,7 +311,7 @@ class ChargeSociales extends CommonObject
}
if (!$error) {
- $sql = "DELETE FROM ".MAIN_DB_PREFIX."chargesociales WHERE rowid=".$this->id;
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."chargesociales WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
@@ -350,7 +350,7 @@ class ChargeSociales extends CommonObject
$sql .= ", fk_projet=".($this->fk_project > 0 ? $this->db->escape($this->fk_project) : "NULL");
$sql .= ", fk_user=".($this->fk_user > 0 ? $this->db->escape($this->fk_user) : "NULL");
$sql .= ", fk_user_modif=".$user->id;
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
index e9c5dfb960d..8f7f13e6043 100644
--- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
+++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
@@ -362,7 +362,7 @@ class PaymentSocialContribution extends CommonObject
$sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? $this->fk_user_modif : "null")."";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
@@ -416,7 +416,7 @@ class PaymentSocialContribution extends CommonObject
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/compta/tva/class/paymentvat.class.php b/htdocs/compta/tva/class/paymentvat.class.php
index e1ee4e5d241..9ba1bd2ed1d 100644
--- a/htdocs/compta/tva/class/paymentvat.class.php
+++ b/htdocs/compta/tva/class/paymentvat.class.php
@@ -365,7 +365,7 @@ class PaymentVAT extends CommonObject
$sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? $this->fk_user_modif : "null")."";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
@@ -419,7 +419,7 @@ class PaymentVAT extends CommonObject
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_vat";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php
index 100406ae5d8..552195cf2d2 100644
--- a/htdocs/compta/tva/class/tva.class.php
+++ b/htdocs/compta/tva/class/tva.class.php
@@ -209,7 +209,7 @@ class Tva extends CommonObject
$sql .= " note='".$this->db->escape($this->note)."',";
$sql .= " fk_user_creat=".$this->fk_user_creat.",";
$sql .= " fk_user_modif=".($this->fk_user_modif > 0 ? $this->fk_user_modif : $user->id)."";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -360,7 +360,7 @@ class Tva extends CommonObject
// End call triggers
$sql = "DELETE FROM ".MAIN_DB_PREFIX."tva";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php
index ede8e6698dd..5e0c65e1b70 100644
--- a/htdocs/contact/class/contact.class.php
+++ b/htdocs/contact/class/contact.class.php
@@ -1275,7 +1275,7 @@ class Contact extends CommonObject
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."socpeople";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(__METHOD__, LOG_DEBUG);
$result = $this->db->query($sql);
if (!$result) {
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 91298a4bfce..36a97be3b27 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -979,7 +979,7 @@ class Contrat extends CommonObject
if (!empty($modCodeContract->code_auto)) {
// Force the ref to a draft value if numbering module is an automatic numbering
- $sql = 'UPDATE '.MAIN_DB_PREFIX."contrat SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id;
+ $sql = 'UPDATE '.MAIN_DB_PREFIX."contrat SET ref='(PROV".$this->id.")' WHERE rowid=".((int) $this->id);
if ($this->db->query($sql)) {
if ($this->id) {
$this->ref = "(PROV".$this->id.")";
@@ -1225,7 +1225,7 @@ class Contrat extends CommonObject
// Delete contract
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."contrat";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::delete contrat", LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -1353,7 +1353,7 @@ class Contrat extends CommonObject
$sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").",";
$sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null")."";
//$sql.= " extraparams=".(isset($this->extraparams)?"'".$this->db->escape($this->extraparams)."'":"null")."";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
@@ -3098,7 +3098,7 @@ class ContratLigne extends CommonObjectLine
$sql .= " fk_user_cloture=".($this->fk_user_cloture > 0 ? $this->fk_user_cloture : "NULL").",";
$sql .= " commentaire='".$this->db->escape($this->commentaire)."',";
$sql .= " fk_unit=".(!$this->fk_unit ? 'NULL' : $this->fk_unit);
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/core/class/ccountry.class.php b/htdocs/core/class/ccountry.class.php
index ad088002caf..4f448845e80 100644
--- a/htdocs/core/class/ccountry.class.php
+++ b/htdocs/core/class/ccountry.class.php
@@ -240,7 +240,7 @@ class Ccountry // extends CommonObject
$sql .= " code_iso=".(isset($this->code_iso) ? "'".$this->db->escape($this->code_iso)."'" : "null").",";
$sql .= " label=".(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null").",";
$sql .= " active=".(isset($this->active) ? $this->active : "null")."";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
@@ -279,7 +279,7 @@ class Ccountry // extends CommonObject
$error = 0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."c_country";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
diff --git a/htdocs/core/class/comment.class.php b/htdocs/core/class/comment.class.php
index a8da44b0d79..78f168fd8f7 100644
--- a/htdocs/core/class/comment.class.php
+++ b/htdocs/core/class/comment.class.php
@@ -262,7 +262,7 @@ class Comment extends CommonObject
$sql .= " fk_user_modif=".$user->id.",";
$sql .= " entity=".(!empty($this->entity) ? $this->entity : '1').",";
$sql .= " import_key=".(!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null");
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
@@ -316,7 +316,7 @@ class Comment extends CommonObject
$this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element;
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$resql = $this->db->query($sql);
if (!$resql) {
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 719cd8b9789..0b4954e5e88 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -2243,7 +2243,7 @@ abstract class CommonObject
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET '.$fieldname.' = '.(($id > 0 || $id == '0') ? $id : 'NULL');
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
if ($this->db->query($sql)) {
$this->mode_reglement_id = $id;
@@ -2278,7 +2278,7 @@ abstract class CommonObject
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET '.$fieldname." = '".$this->db->escape($code)."'";
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
if ($this->db->query($sql)) {
$this->multicurrency_code = $code;
@@ -2316,7 +2316,7 @@ abstract class CommonObject
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET '.$fieldname.' = '.$rate;
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
if ($this->db->query($sql)) {
$this->multicurrency_tx = $rate;
@@ -2524,7 +2524,7 @@ abstract class CommonObject
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET '.$fieldname.' = '.(($id > 0 || $id == '0') ? $id : 'NULL');
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
if ($this->db->query($sql)) {
$this->cond_reglement_id = $id;
@@ -2566,7 +2566,7 @@ abstract class CommonObject
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET '.$fieldname.' = '.(($id > 0 || $id == '0') ? $id : 'NULL');
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
if ($this->db->query($sql)) {
$this->transport_mode_id = $id;
@@ -2601,7 +2601,7 @@ abstract class CommonObject
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET '.$fieldname.' = '.$id;
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
if ($this->db->query($sql)) {
$this->retained_warranty_fk_cond_reglement = $id;
@@ -2679,7 +2679,7 @@ abstract class CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " SET fk_shipping_method = ".$shipping_method_id;
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$resql = $this->db->query($sql);
if (!$resql) {
dol_syslog(get_class($this).'::setShippingMethod Error ', LOG_DEBUG);
@@ -2726,7 +2726,7 @@ abstract class CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " SET fk_warehouse = ".$warehouse_id;
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
if ($this->db->query($sql)) {
$this->warehouse_id = ($warehouse_id == 'NULL') ?null:$warehouse_id;
@@ -2803,7 +2803,7 @@ abstract class CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " SET fk_account = ".$fk_account;
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$resql = $this->db->query($sql);
if (!$resql) {
@@ -8622,7 +8622,7 @@ abstract class CommonObject
}*/
}
- $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET '.implode(', ', $tmp).' WHERE rowid='.$this->id;
+ $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET '.implode(', ', $tmp).' WHERE rowid='.((int) $this->id);
$this->db->begin();
if (!$error) {
@@ -8768,7 +8768,7 @@ abstract class CommonObject
}
if (!$error) {
- $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.$this->id;
+ $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.((int) $this->id);
$res = $this->db->query($sql);
if ($res === false) {
diff --git a/htdocs/core/class/cstate.class.php b/htdocs/core/class/cstate.class.php
index ca5f4bcfeb0..2b9b1d6880e 100644
--- a/htdocs/core/class/cstate.class.php
+++ b/htdocs/core/class/cstate.class.php
@@ -223,7 +223,7 @@ class Cstate // extends CommonObject
$sql .= " code_departement=".(isset($this->code_departement) ? "'".$this->db->escape($this->code_departement)."'" : "null").",";
$sql .= " nom=".(isset($this->nom) ? "'".$this->db->escape($this->nom)."'" : "null").",";
$sql .= " active=".(isset($this->active) ? $this->active : "null")."";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
@@ -261,7 +261,7 @@ class Cstate // extends CommonObject
$error = 0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."c_departements";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
diff --git a/htdocs/core/class/ctyperesource.class.php b/htdocs/core/class/ctyperesource.class.php
index 77d2fe507d3..6ba04c044e9 100644
--- a/htdocs/core/class/ctyperesource.class.php
+++ b/htdocs/core/class/ctyperesource.class.php
@@ -320,7 +320,7 @@ class Ctyperesource
$sql .= ' active = '.(isset($this->active) ? $this->active : "null");
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
$this->db->begin();
@@ -383,7 +383,7 @@ class Ctyperesource
if (!$error) {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element;
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
$resql = $this->db->query($sql);
if (!$resql) {
diff --git a/htdocs/core/class/cunits.class.php b/htdocs/core/class/cunits.class.php
index d3f08db5a53..ed3981d243d 100644
--- a/htdocs/core/class/cunits.class.php
+++ b/htdocs/core/class/cunits.class.php
@@ -345,7 +345,7 @@ class CUnits // extends CommonObject
$sql .= " unit_type=".(isset($this->unit_type) ? "'".$this->db->escape($this->unit_type)."'" : "null").",";
$sql .= " scale=".(isset($this->scale) ? "'".$this->db->escape($this->scale)."'" : "null").",";
$sql .= " active=".(isset($this->active) ? $this->active : "null");
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
@@ -384,7 +384,7 @@ class CUnits // extends CommonObject
$error = 0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."c_units";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php
index 89db5d248a8..1771f0d18f0 100644
--- a/htdocs/core/class/events.class.php
+++ b/htdocs/core/class/events.class.php
@@ -206,7 +206,7 @@ class Events // extends CommonObject
$sql .= " type='".$this->db->escape($this->type)."',";
$sql .= " dateevent='".$this->db->idate($this->dateevent)."',";
$sql .= " description='".$this->db->escape($this->description)."'";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -275,7 +275,7 @@ class Events // extends CommonObject
public function delete($user)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."events";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php
index 8b59cb95bfc..65fdaff9645 100644
--- a/htdocs/core/class/menubase.class.php
+++ b/htdocs/core/class/menubase.class.php
@@ -294,7 +294,7 @@ class Menubase
$resql = $this->db->query($sql);
if ($resql) {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."menu");
- dol_syslog(get_class($this)."::create record added has rowid=".$this->id, LOG_DEBUG);
+ dol_syslog(get_class($this)."::create record added has rowid=".((int) $this->id), LOG_DEBUG);
return $this->id;
} else {
@@ -364,7 +364,7 @@ class Menubase
$sql .= " perms='".$this->db->escape($this->perms)."',";
$sql .= " enabled='".$this->db->escape($this->enabled)."',";
$sql .= " usertype='".$this->db->escape($this->user)."'";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -461,7 +461,7 @@ class Menubase
//global $conf, $langs;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."menu";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php
index 99294837ff6..0b926f6a802 100644
--- a/htdocs/cron/class/cronjob.class.php
+++ b/htdocs/cron/class/cronjob.class.php
@@ -786,7 +786,7 @@ class Cronjob extends CommonObject
$sql .= " maxrun=".((isset($this->maxrun) && $this->maxrun > 0) ? $this->maxrun : "0").",";
$sql .= " libname=".(isset($this->libname) ? "'".$this->db->escape($this->libname)."'" : "null").",";
$sql .= " test=".(isset($this->test) ? "'".$this->db->escape($this->test)."'" : "null");
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
@@ -825,7 +825,7 @@ class Cronjob extends CommonObject
$this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."cronjob";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php
index f96aa69de46..a5fb676e314 100644
--- a/htdocs/don/class/don.class.php
+++ b/htdocs/don/class/don.class.php
@@ -565,7 +565,7 @@ class Don extends CommonObject
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."don";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$resql = $this->db->query($sql);
if (!$resql) {
diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php
index be796874732..7c8bd71ccd2 100644
--- a/htdocs/don/class/paymentdonation.class.php
+++ b/htdocs/don/class/paymentdonation.class.php
@@ -394,7 +394,7 @@ class PaymentDonation extends CommonObject
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_donation";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php
index 802e3681bd7..5222fc0d21a 100644
--- a/htdocs/ecm/class/ecmdirectory.class.php
+++ b/htdocs/ecm/class/ecmdirectory.class.php
@@ -262,7 +262,7 @@ class EcmDirectory extends CommonObject
$sql .= " label='".$this->db->escape($this->label)."',";
$sql .= " fk_parent='".$this->db->escape($this->fk_parent)."',";
$sql .= " description='".$this->db->escape($this->description)."'";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -403,7 +403,7 @@ class EcmDirectory extends CommonObject
$this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."ecm_directories";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php
index bd550dbf751..e5e7ce8549b 100644
--- a/htdocs/ecm/class/ecmfiles.class.php
+++ b/htdocs/ecm/class/ecmfiles.class.php
@@ -679,7 +679,7 @@ class EcmFiles extends CommonObject
$sql .= ' acl = '.(isset($this->acl) ? "'".$this->db->escape($this->acl)."'" : "null").',';
$sql .= ' src_object_id = '.($this->src_object_id > 0 ? $this->src_object_id : "null").',';
$sql .= ' src_object_type = '.(isset($this->src_object_type) ? "'".$this->db->escape($this->src_object_type)."'" : "null");
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
$this->db->begin();
@@ -742,7 +742,7 @@ class EcmFiles extends CommonObject
if (!$error) {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element;
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
$resql = $this->db->query($sql);
if (!$resql) {
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index a79ee76a2fa..c251fdaf7cd 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -1143,7 +1143,7 @@ class Expedition extends CommonObject
$sql .= " model_pdf=".(isset($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null").",";
$sql .= " entity=".$conf->entity;
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index 0c9458c5001..89178693a43 100644
--- a/htdocs/expensereport/class/expensereport.class.php
+++ b/htdocs/expensereport/class/expensereport.class.php
@@ -294,7 +294,7 @@ class ExpenseReport extends CommonObject
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
$this->ref = '(PROV'.$this->id.')';
- $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element." SET ref='".$this->db->escape($this->ref)."' WHERE rowid=".$this->id;
+ $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element." SET ref='".$this->db->escape($this->ref)."' WHERE rowid=".((int) $this->id);
$resql = $this->db->query($sql);
if (!$resql) {
$this->error = $this->db->lasterror();
diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php
index 0fcd5c3a17b..c9cf0cdaf41 100644
--- a/htdocs/expensereport/class/paymentexpensereport.class.php
+++ b/htdocs/expensereport/class/paymentexpensereport.class.php
@@ -317,7 +317,7 @@ class PaymentExpenseReport extends CommonObject
$sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? $this->fk_user_modif : "null")."";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
@@ -370,7 +370,7 @@ class PaymentExpenseReport extends CommonObject
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_expensereport";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php
index 174a7271d25..8c1bf9642b1 100644
--- a/htdocs/exports/class/export.class.php
+++ b/htdocs/exports/class/export.class.php
@@ -798,7 +798,7 @@ class Export
$error = 0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."export_model";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php
index dc1e40dd068..f5602bc5abb 100644
--- a/htdocs/fichinter/class/fichinter.class.php
+++ b/htdocs/fichinter/class/fichinter.class.php
@@ -305,7 +305,7 @@ class Fichinter extends CommonObject
if ($this->id) {
$this->ref = '(PROV'.$this->id.')';
- $sql = 'UPDATE '.MAIN_DB_PREFIX."fichinter SET ref='".$this->db->escape($this->ref)."' WHERE rowid=".$this->id;
+ $sql = 'UPDATE '.MAIN_DB_PREFIX."fichinter SET ref='".$this->db->escape($this->ref)."' WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index 5876550d15d..b3500a4e45d 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -1214,7 +1214,7 @@ class CommandeFournisseur extends CommonOrder
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur";
$sql .= " SET fk_statut=".self::STATUS_ORDERSENT.", fk_input_method=".$methode.", date_commande='".$this->db->idate($date)."', ";
$sql .= " note_private='".$this->db->escape($newnoteprivate)."'";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::commande", LOG_DEBUG);
if ($this->db->query($sql)) {
@@ -1381,7 +1381,7 @@ class CommandeFournisseur extends CommonOrder
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur";
$sql .= " SET ref='(PROV".$this->id.")'";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::create", LOG_DEBUG);
if ($this->db->query($sql)) {
// Add link with price request and supplier order
@@ -1510,7 +1510,7 @@ class CommandeFournisseur extends CommonOrder
$sql .= " model_pdf=".(isset($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null").",";
$sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null")."";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
@@ -3820,7 +3820,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
return -1;
}
- $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid=".$this->id;
+ $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid=".((int) $this->id);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php
index 379fef0fe81..21c36ced633 100644
--- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php
@@ -389,7 +389,7 @@ class CommandeFournisseurDispatch extends CommonObject
$sql .= " sellby=".(dol_strlen($this->sellby) != 0 ? "'".$this->db->idate($this->sellby)."'" : 'null')."";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
@@ -472,7 +472,7 @@ class CommandeFournisseurDispatch extends CommonObject
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element;
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(__METHOD__);
$resql = $this->db->query($sql);
diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php
index c90db37882c..dccb3901069 100644
--- a/htdocs/fourn/class/fournisseur.facture.class.php
+++ b/htdocs/fourn/class/fournisseur.facture.class.php
@@ -442,7 +442,7 @@ class FactureFournisseur extends CommonInvoice
// Update ref with new one
$this->ref = '(PROV'.$this->id.')';
- $sql = 'UPDATE '.MAIN_DB_PREFIX."facture_fourn SET ref='".$this->db->escape($this->ref)."' WHERE rowid=".$this->id;
+ $sql = 'UPDATE '.MAIN_DB_PREFIX."facture_fourn SET ref='".$this->db->escape($this->ref)."' WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -1007,7 +1007,7 @@ class FactureFournisseur extends CommonInvoice
$sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").",";
$sql .= " model_pdf=".(isset($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null").",";
$sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null")."";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
@@ -3166,7 +3166,7 @@ class SupplierInvoiceLine extends CommonObjectLine
{
global $user, $conf;
- dol_syslog(get_class($this)."::deleteline rowid=".$this->id, LOG_DEBUG);
+ dol_syslog(get_class($this)."::deleteline rowid=".((int) $this->id), LOG_DEBUG);
$error = 0;
diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php
index d7839305d17..0426231becf 100644
--- a/htdocs/holiday/class/holiday.class.php
+++ b/htdocs/holiday/class/holiday.class.php
@@ -306,7 +306,7 @@ class Holiday extends CommonObject
$initialref = $this->ref;
}
- $sql = 'UPDATE '.MAIN_DB_PREFIX."holiday SET ref='".$this->db->escape($initialref)."' WHERE rowid=".$this->id;
+ $sql = 'UPDATE '.MAIN_DB_PREFIX."holiday SET ref='".$this->db->escape($initialref)."' WHERE rowid=".((int) $this->id);
if ($this->db->query($sql)) {
$this->ref = $initialref;
@@ -976,7 +976,7 @@ class Holiday extends CommonObject
$error = 0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."holiday";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php
index c9bb41389c9..5372a6e16c5 100644
--- a/htdocs/imports/class/import.class.php
+++ b/htdocs/imports/class/import.class.php
@@ -328,7 +328,7 @@ class Import
$error = 0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."import_model";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php
index 3075cd82387..b628de1b68b 100644
--- a/htdocs/loan/class/loan.class.php
+++ b/htdocs/loan/class/loan.class.php
@@ -317,7 +317,7 @@ class Loan extends CommonObject
}
if (!$error) {
- $sql = "DELETE FROM ".MAIN_DB_PREFIX."loan where rowid=".$this->id;
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."loan where rowid=".((int) $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
@@ -364,7 +364,7 @@ class Loan extends CommonObject
$sql .= " fk_projet=".(empty($this->fk_project) ? 'NULL' : $this->fk_project).",";
$sql .= " fk_user_modif = ".$user->id.",";
$sql .= " insurance_amount = '".price2num($this->db->escape($this->insurance_amount))."'";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/loan/class/loanschedule.class.php b/htdocs/loan/class/loanschedule.class.php
index dd11b39a2e6..bc819f747ca 100644
--- a/htdocs/loan/class/loanschedule.class.php
+++ b/htdocs/loan/class/loanschedule.class.php
@@ -339,7 +339,7 @@ class LoanSchedule extends CommonObject
$sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? $this->fk_user_creat : "null").",";
$sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? $this->fk_user_modif : "null")."";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
@@ -376,7 +376,7 @@ class LoanSchedule extends CommonObject
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element;
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php
index f1bc3008577..c7f1940943b 100644
--- a/htdocs/loan/class/paymentloan.class.php
+++ b/htdocs/loan/class/paymentloan.class.php
@@ -348,7 +348,7 @@ class PaymentLoan extends CommonObject
$sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? $this->fk_user_creat : "null").",";
$sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? $this->fk_user_modif : "null")."";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
@@ -400,7 +400,7 @@ class PaymentLoan extends CommonObject
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_loan";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php
index 82342cd6aab..7886bd35774 100644
--- a/htdocs/multicurrency/class/multicurrency.class.php
+++ b/htdocs/multicurrency/class/multicurrency.class.php
@@ -301,7 +301,7 @@ class MultiCurrency extends CommonObject
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET';
$sql .= ' name=\''.$this->db->escape($this->name).'\'';
$sql .= ' code=\''.$this->db->escape($this->code).'\'';
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
$this->db->begin();
@@ -363,7 +363,7 @@ class MultiCurrency extends CommonObject
}
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element;
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -888,7 +888,7 @@ class CurrencyRate extends CommonObjectLine
if (!empty($this->fk_multicurrency)) {
$sql .= ', fk_multicurrency='.$this->fk_multicurrency;
}
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
$this->db->begin();
@@ -944,7 +944,7 @@ class CurrencyRate extends CommonObjectLine
if (!$error) {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element;
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php
index 2cb6cdfe65a..10704f2f53e 100644
--- a/htdocs/product/class/productbatch.class.php
+++ b/htdocs/product/class/productbatch.class.php
@@ -206,7 +206,7 @@ class Productbatch extends CommonObject
$sql .= " batch=".(isset($this->batch) ? "'".$this->db->escape($this->batch)."'" : "null").",";
$sql .= " qty=".(isset($this->qty) ? $this->qty : "null").",";
$sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null")."";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
@@ -246,7 +246,7 @@ class Productbatch extends CommonObject
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX.self::$_table_element."";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php
index aab99a2d154..94f438a77cb 100644
--- a/htdocs/product/class/productcustomerprice.class.php
+++ b/htdocs/product/class/productcustomerprice.class.php
@@ -754,7 +754,7 @@ class Productcustomerprice extends CommonObject
$sql .= " fk_user=".$user->id.",";
$sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null")."";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -897,7 +897,6 @@ class Productcustomerprice extends CommonObject
*/
public function delete($user, $notrigger = 0)
{
-
global $conf, $langs;
$error = 0;
@@ -912,7 +911,7 @@ class Productcustomerprice extends CommonObject
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_customer_price";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/product/class/propalmergepdfproduct.class.php b/htdocs/product/class/propalmergepdfproduct.class.php
index 186fdad7e6d..f7cf48df5e0 100644
--- a/htdocs/product/class/propalmergepdfproduct.class.php
+++ b/htdocs/product/class/propalmergepdfproduct.class.php
@@ -324,7 +324,7 @@ class Propalmergepdfproduct extends CommonObject
$sql .= " fk_user_mod=".$user->id;
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
@@ -365,7 +365,7 @@ class Propalmergepdfproduct extends CommonObject
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propal_merge_pdf_product";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php
index 2d6e543f80a..9b6c0a38a1c 100644
--- a/htdocs/product/stock/class/productlot.class.php
+++ b/htdocs/product/stock/class/productlot.class.php
@@ -376,7 +376,7 @@ class Productlot extends CommonObject
$sql .= ' fk_user_creat = '.(isset($this->fk_user_creat) ? $this->fk_user_creat : "null").',';
$sql .= ' fk_user_modif = '.(isset($this->fk_user_modif) ? $this->fk_user_modif : "null").',';
$sql .= ' import_key = '.(isset($this->import_key) ? $this->import_key : "null");
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
$this->db->begin();
@@ -446,7 +446,7 @@ class Productlot extends CommonObject
if (!$error) {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element;
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
$resql = $this->db->query($sql);
if (!$resql) {
diff --git a/htdocs/product/stock/class/productstockentrepot.class.php b/htdocs/product/stock/class/productstockentrepot.class.php
index ad82d6da526..88fc636e07e 100644
--- a/htdocs/product/stock/class/productstockentrepot.class.php
+++ b/htdocs/product/stock/class/productstockentrepot.class.php
@@ -365,7 +365,7 @@ class ProductStockEntrepot extends CommonObject
$sql .= ' import_key = '.(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null");
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
$this->db->begin();
@@ -426,7 +426,7 @@ class ProductStockEntrepot extends CommonObject
if (!$error) {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element;
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
$resql = $this->db->query($sql);
if (!$resql) {
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index 6b6eca05026..750f58c1526 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -832,7 +832,7 @@ class Project extends CommonObject
// Delete project
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."projet";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$resql = $this->db->query($sql);
if (!$resql) {
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index 8506461f09d..9a72124199c 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -381,7 +381,7 @@ class Task extends CommonObject
$sql .= " datee=".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null').",";
$sql .= " progress=".(($this->progress != '' && $this->progress >= 0) ? $this->progress : 'null').",";
$sql .= " rang=".((!empty($this->rang)) ? $this->rang : "0");
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
@@ -535,7 +535,7 @@ class Task extends CommonObject
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$resql = $this->db->query($sql);
if (!$resql) {
diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php
index a3775498293..a8a55c7faf2 100644
--- a/htdocs/reception/class/reception.class.php
+++ b/htdocs/reception/class/reception.class.php
@@ -853,7 +853,7 @@ class Reception extends CommonObject
$sql .= " model_pdf=".(isset($this->modelpdf) ? "'".$this->db->escape($this->modelpdf)."'" : "null").",";
$sql .= " entity=".$conf->entity;
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php
index 0dcf23a9ffb..b3d7fab8082 100644
--- a/htdocs/resource/class/dolresource.class.php
+++ b/htdocs/resource/class/dolresource.class.php
@@ -275,7 +275,7 @@ class Dolresource extends CommonObject
$sql .= " fk_country=".($this->country_id > 0 ? $this->country_id : "null").",";
$sql .= " fk_code_type_resource=".(isset($this->fk_code_type_resource) ? "'".$this->db->escape($this->fk_code_type_resource)."'" : "null").",";
$sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null')."";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
@@ -779,7 +779,7 @@ class Dolresource extends CommonObject
$sql .= " mandatory=".(isset($this->mandatory) ? $this->mandatory : "null").",";
$sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null')."";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php
index 317d87d1252..68c96888b5c 100644
--- a/htdocs/salaries/class/paymentsalary.class.php
+++ b/htdocs/salaries/class/paymentsalary.class.php
@@ -319,7 +319,7 @@ class PaymentSalary extends CommonObject
$sql .= " fk_bank=".(isset($this->fk_bank) ? $this->fk_bank : "null").",";
$sql .= " fk_user_author=".(isset($this->fk_user_author) ? $this->fk_user_author : "null").",";
$sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? $this->fk_user_modif : "null")."";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
@@ -370,7 +370,7 @@ class PaymentSalary extends CommonObject
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_salary";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php
index 880d684be40..fdd1bfd7f73 100644
--- a/htdocs/salaries/class/salary.class.php
+++ b/htdocs/salaries/class/salary.class.php
@@ -148,7 +148,7 @@ class Salary extends CommonObject
$sql .= " fk_user_author=".((int) $this->fk_user_author).",";
$sql .= " fk_user_modif=".($this->fk_user_modif > 0 ? (int) $this->fk_user_modif : 'null');
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -293,7 +293,7 @@ class Salary extends CommonObject
}*/
$sql = "DELETE FROM ".MAIN_DB_PREFIX."salary";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php
index a101f74258f..c9abb624286 100644
--- a/htdocs/societe/price.php
+++ b/htdocs/societe/price.php
@@ -145,7 +145,7 @@ if (empty($reshook)) {
if ($action == 'delete_customer_price' && ($user->rights->produit->creer || $user->rights->service->creer)) {
// Delete price by customer
- $prodcustprice->id = GETPOST('lineid');
+ $prodcustprice->id = GETPOST('lineid', 'int');
$result = $prodcustprice->delete($user);
if ($result < 0) {
diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php
index f413dfa2f78..78b1df5f6a4 100644
--- a/htdocs/supplier_proposal/class/supplier_proposal.class.php
+++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php
@@ -959,7 +959,7 @@ class SupplierProposal extends CommonObject
if ($this->id) {
$this->ref = '(PROV'.$this->id.')';
- $sql = 'UPDATE '.MAIN_DB_PREFIX."supplier_proposal SET ref='".$this->db->escape($this->ref)."' WHERE rowid=".$this->id;
+ $sql = 'UPDATE '.MAIN_DB_PREFIX."supplier_proposal SET ref='".$this->db->escape($this->ref)."' WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php
index c4730008285..44a7a81ee81 100644
--- a/htdocs/ticket/class/ticket.class.php
+++ b/htdocs/ticket/class/ticket.class.php
@@ -914,7 +914,7 @@ class Ticket extends CommonObject
$sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').",";
$sql .= " date_read=".(dol_strlen($this->date_read) != 0 ? "'".$this->db->idate($this->date_read)."'" : 'null').",";
$sql .= " date_close=".(dol_strlen($this->date_close) != 0 ? "'".$this->db->idate($this->date_close)."'" : 'null')."";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
@@ -1008,7 +1008,7 @@ class Ticket extends CommonObject
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."ticket";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::delete sql=".$sql);
$resql = $this->db->query($sql);
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index 97cf99eac06..b27e12e3f3e 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -1503,7 +1503,7 @@ class User extends CommonObject
} elseif (!empty($this->pass_crypted)) { // If a crypted password is already known, we save it directly into database because the previous create did not save it.
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
$sql .= " SET pass_crypted = '".$this->db->escape($this->pass_crypted)."'";
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
$resql = $this->db->query($sql);
if (!$resql) {
@@ -1514,7 +1514,7 @@ class User extends CommonObject
if ($result > 0 && $member->fk_soc) { // If member is linked to a thirdparty
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
$sql .= " SET fk_soc=".$member->fk_soc;
- $sql .= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::create_from_member", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php
index fe2e6aab4cf..1d30b71ad0a 100644
--- a/htdocs/website/class/website.class.php
+++ b/htdocs/website/class/website.class.php
@@ -522,7 +522,7 @@ class Website extends CommonObject
$sql .= ' fk_user_modif = '.(!isset($this->fk_user_modif) ? $user->id : $this->fk_user_modif).',';
$sql .= ' date_creation = '.(!isset($this->date_creation) || dol_strlen($this->date_creation) != 0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').',';
$sql .= ' tms = '.(dol_strlen($this->date_modification) != 0 ? "'".$this->db->idate($this->date_modification)."'" : "'".$this->db->idate(dol_now())."'");
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
$this->db->begin();
@@ -597,7 +597,7 @@ class Website extends CommonObject
if (!$error) {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element;
- $sql .= ' WHERE rowid='.$this->id;
+ $sql .= ' WHERE rowid='.((int) $this->id);
$resql = $this->db->query($sql);
if (!$resql) {