diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 3c2e8763fe1..7a65fa0ffaa 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -349,7 +349,7 @@ if ($action != 'export_csv') { $sql .= " GROUP BY t.numero_compte"; $resql = $db->query($sql); - $nrows = $resql->num_rows; + $nrows = $db->num_rows($resql); $opening_balances = array(); for ($i = 0; $i < $nrows; $i++) { $arr = $resql->fetch_array(); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 3dde8ce2638..0e1f1835fce 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5024,7 +5024,7 @@ class Facture extends CommonInvoice $sql .= " WHERE f.entity IN (".getEntity('invoice', 0).")"; $resql = $this->db->query($sql); if ($resql) { - if ($resql->num_rows > 0) { + if ($this->db->num_rows($resql) > 0) { $res = $this->db->fetch_array($resql); $ref = $res['max(situation_cycle_ref)']; $ref++; @@ -5069,7 +5069,7 @@ class Facture extends CommonInvoice $sql .= ' AND entity = '.($this->entity > 0 ? $this->entity : $conf->entity); $resql = $this->db->query($sql); $res = array(); - if ($resql && $resql->num_rows > 0) { + if ($resql && $this->db->num_rows($resql) > 0) { while ($row = $this->db->fetch_object($resql)) { $id = $row->rowid; $situation = new Facture($this->db); @@ -5147,7 +5147,7 @@ class Facture extends CommonInvoice $sql .= ' AND entity = '.($this->entity > 0 ? $this->entity : $conf->entity); $resql = $this->db->query($sql); - if ($resql && $resql->num_rows > 0) { + if ($resql && $this->db->num_rows($resql) > 0) { $res = $this->db->fetch_array($resql); $last = $res['max(situation_counter)']; return ($last == $this->situation_counter); @@ -6287,7 +6287,7 @@ class FactureLigne extends CommonInvoiceLine $sql = "SELECT situation_percent FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".((int) $this->fk_prev_id); $resql = $this->db->query($sql); - if ($resql && $resql->num_rows > 0) { + if ($resql && $this->db->num_rows($resql) > 0) { $res = $this->db->fetch_array($resql); $returnPercent = floatval($res['situation_percent']); diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index b57fa1bf655..95c02af8e73 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -804,11 +804,12 @@ class ImportCsv extends ModeleImports $resql = $this->db->query($sqlSelect); if ($resql) { - $res = $this->db->fetch_object($resql); - if ($resql->num_rows == 1) { + $num_rows = $this->db->num_rows($resql); + if ($num_rows == 1) { + $res = $this->db->fetch_object($resql); $lastinsertid = $res->rowid; $last_insert_id_array[$tablename] = $lastinsertid; - } elseif ($resql->num_rows > 1) { + } elseif ($num_rows > 1) { $this->errors[$error]['lib'] = $langs->trans('MultipleRecordFoundWithTheseFilters', implode(', ', $filters)); $this->errors[$error]['type'] = 'SQL'; $error++; @@ -837,7 +838,7 @@ class ImportCsv extends ModeleImports $resql = $this->db->query($sqlSelect); if ($resql) { $res = $this->db->fetch_object($resql); - if ($resql->num_rows == 1) { + if ($this->db->num_rows($resql) == 1) { // We have a row referencing this last foreign key, continue with UPDATE. } else { // No record found referencing this last foreign key, diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index d9fe3048e2f..7877275b034 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -844,11 +844,12 @@ class ImportXlsx extends ModeleImports $resql = $this->db->query($sqlSelect); if ($resql) { - $res = $this->db->fetch_object($resql); - if ($resql->num_rows == 1) { + $num_rows = $this->db->num_rows($resql); + if ($num_rows == 1) { + $res = $this->db->fetch_object($resql); $lastinsertid = $res->rowid; $last_insert_id_array[$tablename] = $lastinsertid; - } elseif ($resql->num_rows > 1) { + } elseif ($num_rows > 1) { $this->errors[$error]['lib'] = $langs->trans('MultipleRecordFoundWithTheseFilters', implode(', ', $filters)); $this->errors[$error]['type'] = 'SQL'; $error++; @@ -877,7 +878,7 @@ class ImportXlsx extends ModeleImports $resql = $this->db->query($sqlSelect); if ($resql) { $res = $this->db->fetch_object($resql); - if ($resql->num_rows == 1) { + if ($this->db->num_rows($resql) == 1) { // We have a row referencing this last foreign key, continue with UPDATE. } else { // No record found referencing this last foreign key, diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index ef1557f4f00..508db07c65e 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1920,7 +1920,7 @@ class EmailCollector extends CommonObject if (count($pj) > 0) { $sql = "SELECT rowid as id FROM " . MAIN_DB_PREFIX . "user WHERE email LIKE '%" . $from . "%'"; $resql = $this->db->query($sql); - if ($resql->num_rows == 0) { + if ($this->db->num_rows($resql) == 0) { $this->errors = 'User Not allowed to add documents'; } $arrayobject = array( diff --git a/htdocs/intracommreport/class/intracommreport.class.php b/htdocs/intracommreport/class/intracommreport.class.php index d3f34fc149b..ef13649f8c8 100644 --- a/htdocs/intracommreport/class/intracommreport.class.php +++ b/htdocs/intracommreport/class/intracommreport.class.php @@ -231,7 +231,7 @@ class IntracommReport extends CommonObject if ($resql) { $i = 1; - if (empty($resql->num_rows)) { + if ($this->db->num_rows($resql) <= 0) { $this->errors[] = 'No data for this period'; return 0; }