diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php
index 57bd8d0e8d3..e6334496b8c 100644
--- a/htdocs/compta/bank/account.php
+++ b/htdocs/compta/bank/account.php
@@ -257,6 +257,7 @@ if ($account > 0)
if ($result)
{
_print_lines($db, $sql, $acct);
+ $db->free($result);
}
@@ -409,6 +410,6 @@ function _print_lines($db,$sql,$acct)
$i++;
}
- $db->free();
+
}
?>
diff --git a/htdocs/compta/export/liste.php b/htdocs/compta/export/liste.php
index 24a17114478..b5d3e4f28a7 100644
--- a/htdocs/compta/export/liste.php
+++ b/htdocs/compta/export/liste.php
@@ -69,15 +69,16 @@ $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $
$result = $db->query($sql);
if ($result)
{
- $num = $db->num_rows();
+ $num = $db->num_rows($result);
$i = 0;
- print_barre_liste("Exports", $page, "liste.php", $urladd, $sortfield, $sortorder, '', $num);
+ print_barre_liste($langs->trans("Exports"), $page, "liste.php", $urladd, $sortfield, $sortorder, '', $num);
+
print"\n\n";
- print '
';
+ print '';
print '';
- print_liste_field_titre("Réf","liste.php","ec.ref");
+ print_liste_field_titre($langs->trans("Ref"),"liste.php","ec.ref");
print '| Client facturé | ';
@@ -89,7 +90,7 @@ if ($result)
while ($i < min($num,$conf->liste_limit))
{
- $obj = $db->fetch_object($i);
+ $obj = $db->fetch_object($result);
$var=!$var;
print "
";
@@ -100,11 +101,11 @@ if ($result)
$i++;
}
print "
";
- $db->free();
+ $db->free($result);
}
else
{
- print $db->error() . ' ' . $sql;
+ dolibarr_print_error($db);
}
$db->close();
diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php
index 7e5df3c917a..575ae9fec73 100644
--- a/htdocs/compta/facture/prelevement.php
+++ b/htdocs/compta/facture/prelevement.php
@@ -165,7 +165,7 @@ if ($_GET["facid"] > 0)
$result_sql = $db->query($sql);
if ($result_sql)
{
- $num = $db->num_rows();
+ $num = $db->num_rows($result_sql);
}
@@ -184,7 +184,7 @@ if ($_GET["facid"] > 0)
/*
* Prélèvement
*/
- print '';
+ print '';
print '';
print '| Date demande | ';
@@ -201,7 +201,7 @@ if ($_GET["facid"] > 0)
while ($i < $num)
{
- $obj = $db->fetch_object($i);
+ $obj = $db->fetch_object($result_sql);
$var=!$var;
print "
";
@@ -218,7 +218,7 @@ if ($_GET["facid"] > 0)
$i++;
}
- $db->free();
+ $db->free($result_sql);
}
else
{
@@ -239,12 +239,12 @@ if ($_GET["facid"] > 0)
$result = $db->query($sql);
if ($result)
{
- $num = $db->num_rows();
+ $num = $db->num_rows($result);
$i = 0;
while ($i < $num)
{
- $obj = $db->fetch_object($i);
+ $obj = $db->fetch_object($result);
$var=!$var;
print "
";
@@ -265,7 +265,7 @@ if ($_GET["facid"] > 0)
$i++;
}
- $db->free();
+ $db->free($result);
}
else
{
diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php
index a53304068d1..427e5df21bc 100755
--- a/htdocs/compta/paiement_charge.php
+++ b/htdocs/compta/paiement_charge.php
@@ -217,7 +217,7 @@ if ($_GET["action"] == 'create')
$result = $db->query($sql);
if ($result)
{
- $num = $db->num_rows();
+ $num = $db->num_rows($result);
$i = 0;
while ($i < $num)
{
@@ -249,9 +249,10 @@ if ($_GET["action"] == 'create')
// $sql .= " AND f.fk_statut = 1"; // Statut=0 => non validée, Statut=2 => annulée
// $sql .= " GROUP BY f.facnumber";
//
-// if ($db->query($sql))
+// $result=$db->query($sql);
+// if ($result)
// {
-// $num = $db->num_rows();
+// $num = $db->num_rows($result);
//
// if ($num > 0)
// {
@@ -273,7 +274,7 @@ if ($_GET["action"] == 'create')
while ($i < $num)
{
- //$objp = $db->fetch_object($i);
+ //$objp = $db->fetch_object($result);
$objp = $charge;
$var=!$var;
diff --git a/htdocs/compta/param/comptes/fiche.php b/htdocs/compta/param/comptes/fiche.php
index 7ddb9d9cf34..27788497f99 100644
--- a/htdocs/compta/param/comptes/fiche.php
+++ b/htdocs/compta/param/comptes/fiche.php
@@ -205,15 +205,16 @@ else
$sql .=" WHERE pf.fk_soc = s.idp AND pf.fk_product = ".$product->id;
$sql .= " ORDER BY lower(s.nom)";
- if ( $db->query($sql) )
+ $result=$db->query($sql);
+ if ($result)
{
- $num_fournisseur = $db->num_rows();
+ $num_fournisseur = $db->num_rows($result);
$i = 0;
print '';
$var=True;
while ($i < $num_fournisseur)
{
- $objp = $db->fetch_object($i);
+ $objp = $db->fetch_object($result);
$var=!$var;
print "";
print '| '.$objp->nom.' | ';
@@ -223,7 +224,7 @@ else
$i++;
}
print '
';
- $db->free();
+ $db->free($result);
}
print '
';
@@ -309,13 +310,14 @@ else
$sql = "SELECT s.idp, s.nom, s.ville FROM ".MAIN_DB_PREFIX."societe as s WHERE s.fournisseur=1";
$sql .= " ORDER BY lower(s.nom)";
- if ($db->query($sql))
+ $result=$db->query($sql);
+ if ($result)
{
- $num = $db->num_rows();
+ $num = $db->num_rows($result);
$i = 0;
while ($i < $num)
{
- $obj = $db->fetch_object($i);
+ $obj = $db->fetch_object($result);
print '
";
- $db->free();
+ $db->free($result);
}
else
{
- print $db->error() . ' ' . $sql;
+ dolibarr_print_error($db);
}
$db->close();
diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php
index b796ea16319..3cfb31b73a7 100644
--- a/htdocs/compta/prelevement/bons.php
+++ b/htdocs/compta/prelevement/bons.php
@@ -65,7 +65,7 @@ $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $
$result = $db->query($sql);
if ($result)
{
- $num = $db->num_rows();
+ $num = $db->num_rows($result);
$i = 0;
$urladd= "&statut=".$_GET["statut"];
@@ -93,7 +93,7 @@ if ($result)
while ($i < min($num,$conf->liste_limit))
{
- $obj = $db->fetch_object($i);
+ $obj = $db->fetch_object($result);
$var=!$var;
print "| ";
@@ -109,7 +109,7 @@ if ($result)
$i++;
}
print " |
";
- $db->free();
+ $db->free($result);
}
else
{
diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php
index dbc0d628971..224f36406a1 100644
--- a/htdocs/compta/prelevement/factures.php
+++ b/htdocs/compta/prelevement/factures.php
@@ -117,7 +117,7 @@ $result = $db->query($sql);
if ($result)
{
- $num = $db->num_rows();
+ $num = $db->num_rows($result);
$i = 0;
$urladd = "&id=".$_GET["id"];
@@ -137,7 +137,7 @@ if ($result)
while ($i < min($num,$conf->liste_limit))
{
- $obj = $db->fetch_object($i);
+ $obj = $db->fetch_object($result);
print "| ";
@@ -188,11 +188,11 @@ if ($result)
}
print " |
";
- $db->free();
+ $db->free($result);
}
else
{
- print $db->error() . ' ' . $sql;
+ dolibarr_print_error($db);
}
$db->close();
diff --git a/htdocs/compta/prelevement/facturesrejets.php b/htdocs/compta/prelevement/facturesrejets.php
index b7673a9e5aa..11762c466e0 100644
--- a/htdocs/compta/prelevement/facturesrejets.php
+++ b/htdocs/compta/prelevement/facturesrejets.php
@@ -97,7 +97,7 @@ $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $
$result = $db->query($sql);
if ($result)
{
- $num = $db->num_rows();
+ $num = $db->num_rows($result);
$i = 0;
print_barre_liste("Prélèvements rejetés", $page, "rejets.php", $urladd, $sortfield, $sortorder, '', $num);
@@ -116,7 +116,7 @@ if ($result)
while ($i < min($num,$conf->liste_limit))
{
- $obj = $db->fetch_object($i);
+ $obj = $db->fetch_object($result);
print "| ";
@@ -147,11 +147,11 @@ if ($result)
}
print "";
- $db->free();
+ $db->free($result);
}
else
{
- print $db->error() . ' ' . $sql;
+ dolibarr_print_error($db);
}
$db->close();
diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php
index 14b4895a8dc..73a71a4e801 100644
--- a/htdocs/compta/prelevement/fiche-rejet.php
+++ b/htdocs/compta/prelevement/fiche-rejet.php
@@ -106,7 +106,7 @@ $sql .= " ORDER BY pl.amount DESC";
$result = $db->query($sql);
if ($result)
{
- $num = $db->num_rows();
+ $num = $db->num_rows($result);
$i = 0;
print_barre_liste("Lignes de prélèvement rejetées", $page, "fiche-rejet.php", $urladd, $sortfield, $sortorder, '', $num);
@@ -121,7 +121,7 @@ if ($result)
while ($i < $num)
{
- $obj = $db->fetch_object($i);
+ $obj = $db->fetch_object($result);
print " |
";
print ' ';
@@ -140,11 +140,11 @@ if ($result)
}
print "";
- $db->free();
+ $db->free($result);
}
else
{
- print $db->error() . ' ' . $sql;
+ dolibarr_print_error($db);
}
$db->close();
diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php
index 398d2d363c4..7d536cec776 100644
--- a/htdocs/compta/prelevement/index.php
+++ b/htdocs/compta/prelevement/index.php
@@ -56,7 +56,7 @@ $sql .= " ORDER BY datec DESC LIMIT 5";
$result = $db->query($sql);
if ($result)
{
- $num = $db->num_rows();
+ $num = $db->num_rows($result);
$i = 0;
$var=True;
@@ -68,7 +68,7 @@ if ($result)
while ($i < $num)
{
- $obj = $db->fetch_object($i);
+ $obj = $db->fetch_object($result);
$var=!$var;
print " |
| ";
@@ -85,7 +85,7 @@ if ($result)
$i++;
}
print "";
- $db->free();
+ $db->free($result);
}
else
{
diff --git a/htdocs/compta/prelevement/ligne.php b/htdocs/compta/prelevement/ligne.php
index 54e40b53f38..c997a637d0d 100644
--- a/htdocs/compta/prelevement/ligne.php
+++ b/htdocs/compta/prelevement/ligne.php
@@ -212,7 +212,7 @@ if ($_GET["id"])
if ($result)
{
- $num = $db->num_rows();
+ $num = $db->num_rows($result);
$i = 0;
$urladd = "&id=".$_GET["id"];
@@ -230,7 +230,7 @@ if ($_GET["id"])
while ($i < min($num,$conf->liste_limit))
{
- $obj = $db->fetch_object($i);
+ $obj = $db->fetch_object($result);
print " |
| ";
@@ -253,11 +253,11 @@ if ($_GET["id"])
print "";
- $db->free();
+ $db->free($result);
}
else
{
- print $db->error() . ' ' . $sql;
+ dolibarr_print_error($db);
}
$db->close();
diff --git a/htdocs/compta/prelevement/lignes.php b/htdocs/compta/prelevement/lignes.php
index 3be772ed917..47a70e11ba6 100644
--- a/htdocs/compta/prelevement/lignes.php
+++ b/htdocs/compta/prelevement/lignes.php
@@ -118,7 +118,7 @@ $result = $db->query($sql);
if ($result)
{
- $num = $db->num_rows();
+ $num = $db->num_rows($result);
$i = 0;
$urladd = "&id=".$_GET["id"];
@@ -138,7 +138,7 @@ if ($result)
while ($i < min($num,$conf->liste_limit))
{
- $obj = $db->fetch_object($i);
+ $obj = $db->fetch_object($result);
print " |
| ";
@@ -183,11 +183,11 @@ if ($result)
}
print "";
- $db->free();
+ $db->free($result);
}
else
{
- print $db->error() . ' ' . $sql;
+ dolibarr_print_error($db);
}
$db->close();
diff --git a/htdocs/compta/prelevement/liste.php b/htdocs/compta/prelevement/liste.php
index 7d75d756cd6..87a990fe0fd 100644
--- a/htdocs/compta/prelevement/liste.php
+++ b/htdocs/compta/prelevement/liste.php
@@ -72,7 +72,7 @@ $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $
$result = $db->query($sql);
if ($result)
{
- $num = $db->num_rows();
+ $num = $db->num_rows($result);
$i = 0;
$urladd = "&statut=".$_GET["statut"];
@@ -106,7 +106,7 @@ if ($result)
while ($i < min($num,$conf->liste_limit))
{
- $obj = $db->fetch_object($i);
+ $obj = $db->fetch_object($result);
$var=!$var;
print " |
| ";
@@ -128,11 +128,11 @@ if ($result)
$i++;
}
print "";
- $db->free();
+ $db->free($result);
}
else
{
- print $db->error() . ' ' . $sql;
+ dolibarr_print_error($db);
}
$db->close();
diff --git a/htdocs/compta/prelevement/liste_factures.php b/htdocs/compta/prelevement/liste_factures.php
index be0cceccf93..48422acf779 100644
--- a/htdocs/compta/prelevement/liste_factures.php
+++ b/htdocs/compta/prelevement/liste_factures.php
@@ -77,7 +77,7 @@ $result = $db->query($sql);
if ($result)
{
- $num = $db->num_rows();
+ $num = $db->num_rows($result);
$i = 0;
$urladd = "&socid=".$_GET["socid"];
@@ -111,7 +111,7 @@ if ($result)
while ($i < min($num,$conf->liste_limit))
{
- $obj = $db->fetch_object($i);
+ $obj = $db->fetch_object($result);
print " |
| ";
@@ -146,11 +146,11 @@ if ($result)
}
print "";
- $db->free();
+ $db->free($result);
}
else
{
- print $db->error() . ' ' . $sql;
+ dolibarr_print_error($db);
}
$db->close();
diff --git a/htdocs/compta/prelevement/rejets.php b/htdocs/compta/prelevement/rejets.php
index 53c44093c11..038b3587ffa 100644
--- a/htdocs/compta/prelevement/rejets.php
+++ b/htdocs/compta/prelevement/rejets.php
@@ -91,7 +91,7 @@ $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $
$result = $db->query($sql);
if ($result)
{
- $num = $db->num_rows();
+ $num = $db->num_rows($result);
$i = 0;
print_barre_liste("Prélèvements rejetés", $page, "rejets.php", $urladd, $sortfield, $sortorder, '', $num);
@@ -109,7 +109,7 @@ if ($result)
while ($i < min($num,$conf->liste_limit))
{
- $obj = $db->fetch_object($i);
+ $obj = $db->fetch_object($result);
print " |
";
print ' ';
@@ -126,11 +126,11 @@ if ($result)
}
print "";
- $db->free();
+ $db->free($result);
}
else
{
- print $db->error() . ' ' . $sql;
+ dolibarr_print_error($db);
}
$db->close();
diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php
index f48e071302f..fff913f6ee1 100644
--- a/htdocs/compta/resultat/index.php
+++ b/htdocs/compta/resultat/index.php
@@ -89,13 +89,15 @@ if ($modecompta != 'CREANCES-DETTES') {
$sql .= " AND f.paye = 1";
}
$sql .= " GROUP BY dm DESC";
-if ($db->query($sql))
+
+$result=$db->query($sql);
+if ($result)
{
- $num = $db->num_rows();
+ $num = $db->num_rows($result);
$i = 0;
while ($i < $num)
{
- $row = $db->fetch_object($i);
+ $row = $db->fetch_object($result);
$encaiss[$row->dm] = $row->amount_ht;
$encaiss_ttc[$row->dm] = $row->amount_ttc;
$i++;
@@ -104,6 +106,7 @@ if ($db->query($sql))
else {
dolibarr_print_error($db);
}
+$db->free($result);
/*
* Frais, factures fournisseurs.
@@ -123,13 +126,14 @@ if ($modecompta != 'CREANCES-DETTES') {
}
$sql .= " GROUP BY dm DESC";
-if ($db->query($sql))
+$result=$db->query($sql);
+if ($result)
{
- $num = $db->num_rows();
+ $num = $db->num_rows($result);
$i = 0;
while ($i < $num)
{
- $row = $db->fetch_object($i);
+ $row = $db->fetch_object($result);
$decaiss[$row->dm] = $row->amount_ht;
$decaiss_ttc[$row->dm] = $row->amount_ttc;
$i++;
@@ -138,7 +142,7 @@ if ($db->query($sql))
else {
dolibarr_print_error($db);
}
-
+$db->free($result);
/*
* Tableau
diff --git a/htdocs/fourn/commande/liste.php b/htdocs/fourn/commande/liste.php
index 297580392eb..bde13fbf63e 100644
--- a/htdocs/fourn/commande/liste.php
+++ b/htdocs/fourn/commande/liste.php
@@ -99,7 +99,7 @@ $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $
$result = $db->query($sql);
if ($result)
{
- $num = $db->num_rows();
+ $num = $db->num_rows($result);
$i = 0;
$langs->load("orders");
@@ -131,7 +131,7 @@ if ($result)
while ($i < min($num,$conf->liste_limit))
{
- $obj = $db->fetch_object($i);
+ $obj = $db->fetch_object($result);
$var=!$var;
print " |
";
@@ -154,7 +154,7 @@ if ($result)
$i++;
}
print "";
- $db->free();
+ $db->free($result);
}
else
{
diff --git a/htdocs/product/album/album.class.php b/htdocs/product/album/album.class.php
index 79a61ef58c3..7d30482339e 100644
--- a/htdocs/product/album/album.class.php
+++ b/htdocs/product/album/album.class.php
@@ -129,26 +129,29 @@ class Album {
$sql .= " WHERE g.rowid = l.fk_groupart AND l.fk_album = ".$this->id;
$sql .= " ORDER BY g.nom";
- if ($this->db->query($sql) )
+ $result=$this->db->query($sql);
+ if ($result)
{
- $nump = $this->db->num_rows();
+ $nump = $this->db->num_rows($result);
if ($nump)
{
$i = 0;
while ($i < $nump)
{
- $obj = $this->db->fetch_object($i);
+ $obj = $this->db->fetch_object($result);
$ga[$obj->rowid] = $obj->nom;
$i++;
}
+ $this->db->free($result);
}
return $ga;
}
else
{
- print $this->db->error();
+ print $this->db->error();
+ return -1;
}
}
/*
diff --git a/htdocs/product/categorie/categorie.class.php b/htdocs/product/categorie/categorie.class.php
index 97033e433c0..cd960eeb018 100644
--- a/htdocs/product/categorie/categorie.class.php
+++ b/htdocs/product/categorie/categorie.class.php
@@ -159,33 +159,33 @@ class Categorie {
$sql .= " WHERE c.categories_id = cd.categories_id AND cd.language_id = ".OSC_LANGUAGE_ID;
$sql .= " AND c.parent_id = " . $this->id;
$sql .= " ORDER BY cd.categories_name";
- if ($this->db->query($sql) )
+
+ $result=$this->db->query($sql);
+ if ($result)
{
- $nump = $this->db->num_rows();
+ $nump = $this->db->num_rows($result);
if ($nump)
{
$i = 0;
while ($i < $nump)
{
- $obj = $this->db->fetch_object($i);
+ $obj = $this->db->fetch_object($result);
$ga[$obj->categories_id] = $obj->categories_name;
$i++;
}
+ $this->db->free($result);
}
return $ga;
}
else
{
print $this->db->error();
+ return -1;
}
}
- /*
- *
- *
- *
- */
+
/*
*
*
diff --git a/htdocs/product/concert/concert.class.php b/htdocs/product/concert/concert.class.php
index 9f9a8689ee5..b27bb001bd2 100644
--- a/htdocs/product/concert/concert.class.php
+++ b/htdocs/product/concert/concert.class.php
@@ -94,7 +94,7 @@ class Concert {
$result = $this->db->query($sql) ;
if ( $result ) {
- $result = $this->db->fetch_array();
+ $result = $this->db->fetch_array($result);
$this->id = $result["rowid"];
$this->date = $result["dc"];
@@ -103,18 +103,12 @@ class Concert {
$this->groupartid = $result["fk_groupart"];
$this->lieuid = $result["fk_lieu_concert"];
}
- $this->db->free();
+ $this->db->free($result);
- return $result;
+ return $this->id;
}
- /*
- *
- *
- */
-
-
/*
*
*
@@ -127,16 +121,17 @@ class Concert {
$sql .= " WHERE g.rowid = l.fk_groupart AND l.fk_album = ".$this->id;
$sql .= " ORDER BY g.nom";
- if ($this->db->query($sql) )
+ $result=$this->db->query($sql);
+ if ($result)
{
- $nump = $this->db->num_rows();
+ $nump = $this->db->num_rows($result);
if ($nump)
{
$i = 0;
while ($i < $nump)
{
- $obj = $this->db->fetch_object($i);
+ $obj = $this->db->fetch_object($result);
$ga[$obj->rowid] = $obj->nom;
$i++;
@@ -147,6 +142,7 @@ class Concert {
else
{
print $this->db->error();
+ return -1;
}
}
diff --git a/htdocs/product/concert/lieuconcert.class.php b/htdocs/product/concert/lieuconcert.class.php
index 5bcbc1e1f2f..56c4ba0471b 100644
--- a/htdocs/product/concert/lieuconcert.class.php
+++ b/htdocs/product/concert/lieuconcert.class.php
@@ -128,16 +128,18 @@ class LieuConcert {
$sql = "SELECT rowid, nom, ville, description FROM ".MAIN_DB_PREFIX."lieu_concert";
$sql .= " ORDER BY ville, nom";
- if ($this->db->query($sql) )
+
+ $result=$this->db->query($sql);
+ if ($result)
{
- $nump = $this->db->num_rows();
+ $nump = $this->db->num_rows($result);
if ($nump)
{
$i = 0;
while ($i < $nump)
{
- $obj = $this->db->fetch_object($i);
+ $obj = $this->db->fetch_object($result);
$ga[$obj->rowid] = $obj->ville . " - " .$obj->nom;
$i++;
@@ -148,6 +150,7 @@ class LieuConcert {
else
{
print $this->db->error();
+ return -1;
}
}
diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php
index 59267ade903..e2ff9f559de 100644
--- a/htdocs/product/fiche.php
+++ b/htdocs/product/fiche.php
@@ -530,13 +530,14 @@ else
$sql = "SELECT s.idp, s.nom, s.ville FROM ".MAIN_DB_PREFIX."societe as s WHERE s.fournisseur=1";
$sql .= " ORDER BY lower(s.nom)";
- if ($db->query($sql))
+ $result=$db->query($sql);
+ if ($result)
{
- $num = $db->num_rows();
+ $num = $db->num_rows($result);
$i = 0;
while ($i < $num)
{
- $obj = $db->fetch_object($i);
+ $obj = $db->fetch_object($result);
print '