Merge pull request #10483 from atm-maxime/fix_warehouse_fetch

Fix warehouse fetch was not checking parameters. Fixes #10414
This commit is contained in:
Laurent Destailleur 2019-02-03 19:11:47 +01:00 committed by GitHub
commit d773c74f09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
{