diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php
index 0b43912027b..c10812f0b18 100644
--- a/htdocs/contrat/index.php
+++ b/htdocs/contrat/index.php
@@ -319,9 +319,10 @@ if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.
if ($socid) $sql.= " AND s.rowid = ".$socid;
$sql.= " ORDER BY cd.tms DESC";
-if ( $db->query($sql) )
+$resql=$db->query($sql);
+if ($resql)
{
- $num = $db->num_rows();
+ $num = $db->num_rows($resql);
$i = 0;
print '
';
@@ -332,7 +333,7 @@ if ( $db->query($sql) )
$var=True;
while ($i < $num)
{
- $obj = $db->fetch_object();
+ $obj = $db->fetch_object($resql);
$var=!$var;
print "";
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 34516b6cc4f..591b896b177 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -1309,17 +1309,18 @@ class Form
$sql .= " ORDER BY a.label ASC";
dol_syslog("Form::select_address sql=".$sql);
- if ($this->db->query($sql))
+ $resql=$db->query($sql);
+ if ($resql)
{
print '
";
- $db->free();
+ $db->free($resql);
print "
".$langs->trans("Total")." $DureeTotal jour[s]";
}
else
diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php
index 821c16e2548..4f92c2890f5 100644
--- a/htdocs/fourn/commande/index.php
+++ b/htdocs/fourn/commande/index.php
@@ -127,13 +127,14 @@ if ($conf->fournisseur->enabled)
if ($socid) $sql.= " AND c.fk_soc = ".$socid;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- if ( $db->query($sql) )
+ $resql=$db->query($sql);
+ if ($resql)
{
print '';
print '';
print '| '.$langs->trans("DraftOrders").' |
';
$langs->load("orders");
- $num = $db->num_rows();
+ $num = $db->num_rows($resql);
if ($num)
{
$i = 0;
@@ -141,7 +142,7 @@ if ($conf->fournisseur->enabled)
while ($i < $num)
{
$var=!$var;
- $obj = $db->fetch_object();
+ $obj = $db->fetch_object($resql);
print "";
print '| ';
print "rowid."\">".img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref." | ";
diff --git a/htdocs/fourn/facture/index.php b/htdocs/fourn/facture/index.php
index 9ac08ea248b..f6a21d116e9 100644
--- a/htdocs/fourn/facture/index.php
+++ b/htdocs/fourn/facture/index.php
@@ -72,14 +72,15 @@ if ($_POST["mode"] == 'search')
$sql.= " WHERE s.nom like '%".addslashes(strtolower($socname))."%'";
}
- if ( $db->query($sql) )
+ $resql=$db->query($sql);
+ if ($resql)
{
- if ( $db->num_rows() == 1)
+ if ( $db->num_rows($resql) == 1)
{
- $obj = $db->fetch_object();
+ $obj = $db->fetch_object($resql);
$socid = $obj->rowid;
}
- $db->free();
+ $db->free($resql);
}
}
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 2f19b8af8ba..530a0e31aa8 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -941,14 +941,15 @@ class Societe extends CommonObject
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = '".$this->id . "'";
$sql .= " AND f.fk_statut = '1' AND f.paye = '0'";
- if ($this->db->query($sql))
+ $resql=$this->db->query($sql);
+ if ($resql)
{
- $num = $this->db->num_rows();
+ $num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num)
{
- $objp = $this->db->fetch_object();
+ $objp = $this->db->fetch_object($resql);
$array_push($facimp, $objp->rowid);
$i++;
print $i;
@@ -1441,14 +1442,15 @@ class Societe extends CommonObject
$sql = "SELECT rowid, email, name, firstname FROM ".MAIN_DB_PREFIX."socpeople WHERE rowid = '".$rowid."'";
- if ($this->db->query($sql) )
+ $resql=$this->db->query($sql);
+ if ($resql)
{
- $nump = $this->db->num_rows();
+ $nump = $this->db->num_rows($resql);
if ($nump)
{
- $obj = $this->db->fetch_object();
+ $obj = $this->db->fetch_object($resql);
$contact_email = "$obj->firstname $obj->name <$obj->email>";
@@ -1828,7 +1830,7 @@ class Societe extends CommonObject
if ($resql)
{
$nump = $this->db->num_rows($resql);
- $obj = $this->db->fetch_object();
+ $obj = $this->db->fetch_object($resql);
$count = $obj->numproj;
}
else