FIX #yogosha5746 - next step (work in progress)

This commit is contained in:
Laurent Destailleur 2021-03-30 17:45:15 +02:00
parent c80a8517d4
commit fae3cca494
10 changed files with 13 additions and 13 deletions

View File

@ -2233,7 +2233,7 @@ class Facture extends CommonInvoice
if (!$error) {
// If invoice was converted into a discount not yet consumed, we remove discount
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'societe_remise_except';
$sql .= ' WHERE fk_facture_source = '.$rowid;
$sql .= ' WHERE fk_facture_source = '.((int) $rowid);
$sql .= ' AND fk_facture_line IS NULL';
$resql = $this->db->query($sql);
@ -4575,7 +4575,7 @@ class Facture extends CommonInvoice
global $conf;
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture';
$sql .= ' WHERE situation_cycle_ref = '.$this->situation_cycle_ref;
$sql .= ' WHERE situation_cycle_ref = '.((int) $this->situation_cycle_ref);
$sql .= ' AND situation_counter < '.$this->situation_counter;
$sql .= ' AND entity = '.($this->entity > 0 ? $this->entity : $conf->entity);
$resql = $this->db->query($sql);
@ -4654,7 +4654,7 @@ class Facture extends CommonInvoice
if (!empty($this->situation_cycle_ref)) {
// No point in testing anything if we're not inside a cycle
$sql = 'SELECT max(situation_counter) FROM '.MAIN_DB_PREFIX.'facture';
$sql .= ' WHERE situation_cycle_ref = '.$this->situation_cycle_ref;
$sql .= ' WHERE situation_cycle_ref = '.((int) $this->situation_cycle_ref);
$sql .= ' AND entity = '.($this->entity > 0 ? $this->entity : $conf->entity);
$resql = $this->db->query($sql);

View File

@ -746,7 +746,7 @@ class RemiseCheque extends CommonObject
// Get invoices list to reopen them
$sql = 'SELECT pf.fk_facture, pf.amount';
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf';
$sql .= ' WHERE pf.fk_paiement = '.$payment->id;
$sql .= ' WHERE pf.fk_paiement = '.((int) $payment->id);
$resql = $this->db->query($sql);
if ($resql) {

View File

@ -4047,7 +4047,7 @@ abstract class CommonObject
global $db;
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$table_element.' WHERE '.$field_where.' = '.$fk_object_where;
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$table_element.' WHERE '.$field_where.' = '.((int) $fk_object_where);
$resql = $db->query($sql);
if (empty($resql)) {

View File

@ -1318,8 +1318,8 @@ if ($ok && GETPOST('repair_link_dispatch_lines_supplier_order_lines')) {
}
while ($obj_dispatch = $db->fetch_object($resql_dispatch)) {
$sql_line = 'SELECT line.rowid, line.qty FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet AS line';
$sql_line .= ' WHERE line.fk_commande = '.$obj_dispatch->fk_commande;
$sql_line .= ' AND line.fk_product = '.$obj_dispatch->fk_product;
$sql_line .= ' WHERE line.fk_commande = '.((int) $obj_dispatch->fk_commande);
$sql_line .= ' AND line.fk_product = '.((int) $obj_dispatch->fk_product);
$resql_line = $db->query($sql_line);
// sil y a plusieurs lignes avec le même produit sur cette commande fournisseur,

View File

@ -1342,7 +1342,7 @@ function migrate_paiementfourn_facturefourn($db, $langs, $conf)
// Verifier si la ligne est deja dans la nouvelle table. On ne veut pas inserer de doublons.
$check_sql = 'SELECT fk_paiementfourn, fk_facturefourn';
$check_sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn_facturefourn';
$check_sql .= ' WHERE fk_paiementfourn = '.$select_obj->rowid.' AND fk_facturefourn = '.((int) $select_obj->fk_facture_fourn);
$check_sql .= ' WHERE fk_paiementfourn = '.((int) $select_obj->rowid).' AND fk_facturefourn = '.((int) $select_obj->fk_facture_fourn);
$check_resql = $db->query($check_sql);
if ($check_resql) {
$check_num = $db->num_rows($check_resql);

View File

@ -417,7 +417,7 @@ class IntracommReport extends CommonObject
(
SELECT fk_product
FROM '.MAIN_DB_PREFIX.'categorie_product
WHERE fk_categorie = '.$categ_fraisdeport->id.'
WHERE fk_categorie = '.((int) $categ_fraisdeport->id).'
)
)';

View File

@ -594,7 +594,7 @@ class Opensurveysondage extends CommonObject
*/
public function deleteComment($id_comment)
{
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'opensurvey_comments WHERE id_comment = '.$id_comment.' AND id_sondage = "'.$this->db->escape($this->id_sondage).'"';
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'opensurvey_comments WHERE id_comment = '.((int) $id_comment).' AND id_sondage = "'.$this->db->escape($this->id_sondage).'"';
$resql = $this->db->query($sql);
if (!$resql) {

View File

@ -283,7 +283,7 @@ for ($i = 0; $i < $nblines; $i++) {
if ($compteur == $i) {
$sql2 = 'DELETE FROM '.MAIN_DB_PREFIX.'opensurvey_user_studs';
$sql2 .= ' WHERE id_users = '.$db->escape($obj->id_users);
$sql2 .= " WHERE id_users = ".((int) $obj->id_users);
$resql2 = $db->query($sql2);
}

View File

@ -453,7 +453,7 @@ if ($object->id > 0) {
$sql = 'SELECT id.rowid, id.datec as date_creation, id.tms as date_modification, id.fk_inventory, id.fk_warehouse,';
$sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated';
$sql .= ' FROM '.MAIN_DB_PREFIX.'inventorydet as id';
$sql .= ' WHERE id.fk_inventory = '.$object->id;
$sql .= ' WHERE id.fk_inventory = '.((int) $object->id);
$cacheOfProducts = array();
$cacheOfWarehouses = array();

View File

@ -1281,7 +1281,7 @@ class Website extends CommonObject
$objectpagestatic = new WebsitePage($this->db);
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'website_page WHERE fk_website = '.$this->id;
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'website_page WHERE fk_website = '.((int) $this->id);
$resql = $this->db->query($sql);
if (!$resql) {