Merge pull request #10483 from atm-maxime/fix_warehouse_fetch
Fix warehouse fetch was not checking parameters. Fixes #10414
This commit is contained in:
commit
d773c74f09
@ -308,6 +308,16 @@ class Entrepot extends CommonObject
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch id=".$id." ref=".$ref);
|
||||
|
||||
// Check parameters
|
||||
if (! $id && ! $ref)
|
||||
{
|
||||
$this->error='ErrorWrongParameters';
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$sql = "SELECT rowid, fk_parent, ref as label, description, statut, lieu, address, zip, town, fk_pays as country_id";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot";
|
||||
if ($id)
|
||||
@ -320,7 +330,6 @@ class Entrepot extends CommonObject
|
||||
if ($ref) $sql.= " AND ref = '".$this->db->escape($ref)."'";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user