More information returned into return code

This commit is contained in:
Laurent Destailleur 2013-12-13 18:33:05 +01:00
parent 14f85dc8f1
commit 2f5932026e

View File

@ -2049,7 +2049,7 @@ abstract class CommonObject
* *
* @param int $rowid Id of line * @param int $rowid Id of line
* @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label() * @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label()
* @return void * @return int <0 if error, 0 if no optionals to find nor found, 1 if a line is found and optionnal loaded
*/ */
function fetch_optionals($rowid,$optionsArray='') function fetch_optionals($rowid,$optionsArray='')
{ {
@ -2077,7 +2077,8 @@ abstract class CommonObject
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
if ($this->db->num_rows($resql)) $numrows=$this->db->num_rows($resql);
if ($numrows)
{ {
$tab = $this->db->fetch_array($resql); $tab = $this->db->fetch_array($resql);
@ -2093,12 +2094,17 @@ abstract class CommonObject
} }
$this->db->free($resql); $this->db->free($resql);
if ($numrows) return $numrows;
else return 0;
} }
else else
{ {
dol_print_error($this->db); dol_print_error($this->db);
return -1;
} }
} }
return 0;
} }
/** /**