Fix: if no results do not charge data
This commit is contained in:
parent
b6643de001
commit
353c932e11
@ -63,7 +63,7 @@ class Categorie
|
|||||||
* Load category into memory from database
|
* Load category into memory from database
|
||||||
*
|
*
|
||||||
* @param int $id Id of category
|
* @param int $id Id of category
|
||||||
* @param strin $label Label of category
|
* @param string $label Label of category
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function fetch($id,$label='')
|
function fetch($id,$label='')
|
||||||
@ -86,20 +86,27 @@ class Categorie
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$res = $this->db->fetch_array($resql);
|
if ($this->db->num_rows($resql) > 0)
|
||||||
|
{
|
||||||
|
$res = $this->db->fetch_array($resql);
|
||||||
|
|
||||||
$this->id = $res['rowid'];
|
$this->id = $res['rowid'];
|
||||||
$this->fk_parent = $res['fk_parent'];
|
$this->fk_parent = $res['fk_parent'];
|
||||||
$this->label = $res['label'];
|
$this->label = $res['label'];
|
||||||
$this->description = $res['description'];
|
$this->description = $res['description'];
|
||||||
$this->socid = $res['fk_soc'];
|
$this->socid = $res['fk_soc'];
|
||||||
$this->visible = $res['visible'];
|
$this->visible = $res['visible'];
|
||||||
$this->type = $res['type'];
|
$this->type = $res['type'];
|
||||||
$this->entity = $res['entity'];
|
$this->entity = $res['entity'];
|
||||||
|
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -265,30 +265,37 @@ class Entrepot extends CommonObject
|
|||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$obj=$this->db->fetch_object($result);
|
if ($this->db->num_rows($result) > 0)
|
||||||
|
{
|
||||||
|
$obj=$this->db->fetch_object($result);
|
||||||
|
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
$this->ref = $obj->rowid;
|
$this->ref = $obj->rowid;
|
||||||
$this->libelle = $obj->label;
|
$this->libelle = $obj->label;
|
||||||
$this->description = $obj->description;
|
$this->description = $obj->description;
|
||||||
$this->statut = $obj->statut;
|
$this->statut = $obj->statut;
|
||||||
$this->lieu = $obj->lieu;
|
$this->lieu = $obj->lieu;
|
||||||
$this->address = $obj->address;
|
$this->address = $obj->address;
|
||||||
$this->cp = $obj->zip; // deprecated
|
$this->cp = $obj->zip; // deprecated
|
||||||
$this->ville = $obj->town; // deprecated
|
$this->ville = $obj->town; // deprecated
|
||||||
$this->pays_id = $obj->country_id; // deprecated
|
$this->pays_id = $obj->country_id; // deprecated
|
||||||
$this->zip = $obj->zip;
|
$this->zip = $obj->zip;
|
||||||
$this->town = $obj->town;
|
$this->town = $obj->town;
|
||||||
$this->country_id = $obj->country_id;
|
$this->country_id = $obj->country_id;
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||||
$tmp=getCountry($this->country_id,'all');
|
$tmp=getCountry($this->country_id,'all');
|
||||||
$this->pays=$tmp['label']; // deprecated
|
$this->pays=$tmp['label']; // deprecated
|
||||||
$this->pays_code=$tmp['code']; // deprecated
|
$this->pays_code=$tmp['code']; // deprecated
|
||||||
$this->country=$tmp['label'];
|
$this->country=$tmp['label'];
|
||||||
$this->country_code=$tmp['code'];
|
$this->country_code=$tmp['code'];
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user