Fix check parameters
This commit is contained in:
parent
d847f9581e
commit
0df2b4cc26
@ -1158,12 +1158,21 @@ class Societe extends CommonObject
|
|||||||
* @param boolean $case Case sensitive (true/false)
|
* @param boolean $case Case sensitive (true/false)
|
||||||
* @param boolean $similar Add test if string inside name into database, or name into database inside string. Do not use this: Not compatible with other database.
|
* @param boolean $similar Add test if string inside name into database, or name into database inside string. Do not use this: Not compatible with other database.
|
||||||
* @param string $clause Clause for filters
|
* @param string $clause Clause for filters
|
||||||
* @return array Array of thirdparties object
|
* @return array|int <0 if KO, array of thirdparties object if OK
|
||||||
*/
|
*/
|
||||||
function searchByName($name, $type='0', $filters = array(), $exact = false, $case = false, $similar = false, $clause = 'AND')
|
function searchByName($name, $type='0', $filters = array(), $exact = false, $case = false, $similar = false, $clause = 'AND')
|
||||||
{
|
{
|
||||||
$thirdparties = array();
|
$thirdparties = array();
|
||||||
|
|
||||||
|
dol_syslog("searchByName name=".$name." type=".$type." exact=".$exact);
|
||||||
|
|
||||||
|
// Check parameter
|
||||||
|
if (empty($name))
|
||||||
|
{
|
||||||
|
$this->errors[]='ErrorBadValueForParameter';
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// Generation requete recherche
|
// Generation requete recherche
|
||||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe";
|
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe";
|
||||||
$sql.= " WHERE entity IN (".getEntity('category',1).")";
|
$sql.= " WHERE entity IN (".getEntity('category',1).")";
|
||||||
@ -1242,7 +1251,7 @@ class Societe extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error().' sql='.$sql;
|
$this->error=$this->db->lasterror();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user