Fix num_rows
This commit is contained in:
parent
6d848edba7
commit
6b88655213
@ -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();
|
||||
|
||||
@ -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']);
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user