Fix: Remove sql error when no link

This commit is contained in:
Laurent Destailleur 2011-03-01 09:33:59 +00:00
parent eee0d1aa07
commit d34a653734

View File

@ -1540,45 +1540,49 @@ class Propal extends CommonObject
}
}
$sql= "SELECT rowid as facid, facnumber, total, datef as df, fk_user_author, fk_statut, paye";
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE rowid IN (".implode(',',$linkedInvoices).")";
if (sizeof($linkedInvoices) > 0)
{
$sql= "SELECT rowid as facid, facnumber, total, datef as df, fk_user_author, fk_statut, paye";
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE rowid IN (".implode(',',$linkedInvoices).")";
dol_syslog("Propal::InvoiceArrayList sql=".$sql);
$resql=$this->db->query($sql);
dol_syslog("Propal::InvoiceArrayList sql=".$sql);
$resql=$this->db->query($sql);
if ($resql)
{
$tab_sqlobj=array();
$nump = $this->db->num_rows($resql);
for ($i = 0;$i < $nump;$i++)
{
$sqlobj = $this->db->fetch_object($resql);
$tab_sqlobj[] = $sqlobj;
}
$this->db->free($resql);
if ($resql)
{
$tab_sqlobj=array();
$nump = $this->db->num_rows($resql);
for ($i = 0;$i < $nump;$i++)
{
$sqlobj = $this->db->fetch_object($resql);
$tab_sqlobj[] = $sqlobj;
}
$this->db->free($resql);
$nump = sizeOf($tab_sqlobj);
$nump = sizeOf($tab_sqlobj);
if ($nump)
{
$i = 0;
while ($i < $nump)
{
$obj = array_shift($tab_sqlobj);
if ($nump)
{
$i = 0;
while ($i < $nump)
{
$obj = array_shift($tab_sqlobj);
$ga[$i] = $obj;
$ga[$i] = $obj;
$i++;
}
}
return $ga;
}
else
{
return -1;
}
}
$i++;
}
}
return $ga;
}
else
{
return -1;
}
}
else return $ga;
}
/**
* \brief Efface propal