mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-08 00:52:01 +01:00
Fix: Database compatibility
This commit is contained in:
@@ -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 '<table class="noborder" width="100%">';
|
||||
@@ -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 "<tr $bc[$var]>";
|
||||
|
||||
|
||||
@@ -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 '<select class="flat" name="'.$htmlname.'">';
|
||||
if ($showempty) print '<option value="0"> </option>';
|
||||
$num = $this->db->num_rows();
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object();
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
if ($selected && $selected == $obj->rowid)
|
||||
{
|
||||
@@ -1553,17 +1554,18 @@ class Form
|
||||
$sql .= " WHERE active = 1";
|
||||
|
||||
dol_syslog("Form::select_propal_statut sql=".$sql);
|
||||
if ($this->db->query($sql))
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
print '<select class="flat" name="propal_statut">';
|
||||
print '<option value=""> </option>';
|
||||
$num = $this->db->num_rows();
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object();
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($selected == $obj->id)
|
||||
{
|
||||
print '<option value="'.$obj->id.'" selected="true">';
|
||||
|
||||
@@ -164,17 +164,18 @@ class FormOther
|
||||
$sql.= " WHERE e.active = 1 AND e.fk_pays = p.rowid";
|
||||
$sql.= " ORDER BY pays, e.organization ASC, e.code ASC";
|
||||
|
||||
if ($this->db->query($sql))
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
print '<select class="flat" name="'.$htmlname.'">';
|
||||
$num = $this->db->num_rows();
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
print '<option value="-1"> </option>'."\n";
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object();
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($selected && $selected == $obj->rowid)
|
||||
{
|
||||
print '<option value="'.$obj->rowid.'" selected="true">';
|
||||
|
||||
@@ -126,9 +126,10 @@ 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;
|
||||
$sql.= " ORDER BY c.rowid ASC";
|
||||
|
||||
if ( $db->query($sql) )
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
$langs->load("orders");
|
||||
@@ -141,7 +142,7 @@ if ( $db->query($sql) )
|
||||
while ($i < $num)
|
||||
{
|
||||
$var=!$var;
|
||||
$obj = $db->fetch_object();
|
||||
$obj = $db->fetch_object($resql);
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td nowrap="nowrap">';
|
||||
$orderstatic->id=$obj->rowid;
|
||||
|
||||
@@ -91,7 +91,8 @@ $sql .= " AND datei >= '".$start."' AND datei < '".$end."'" ;
|
||||
|
||||
$sql .= " ORDER BY $sortfield $sortorder ";
|
||||
|
||||
if ( $db->query($sql) )
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$title = $langs->trans("Report")." ".dol_print_date(strtotime($start),"%B %Y");
|
||||
@@ -112,7 +113,7 @@ if ( $db->query($sql) )
|
||||
$DureeTotal = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object();
|
||||
$objp = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td><a href="fiche.php?id='.$objp->fichid.'">'.$objp->ref.'</a></td>\n';
|
||||
@@ -132,7 +133,7 @@ if ( $db->query($sql) )
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
$db->free();
|
||||
$db->free($resql);
|
||||
print "<br>".$langs->trans("Total")." $DureeTotal jour[s]";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -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 '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans("DraftOrders").'</td></tr>';
|
||||
$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 "<tr $bc[$var]>";
|
||||
print '<td nowrap="nowrap">';
|
||||
print "<a href=\"fiche.php?id=".$obj->rowid."\">".img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref."</a></td>";
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user