2
0
forked from Wavyzz/dolibarr

default envent status

This commit is contained in:
Florian HENRY
2021-03-01 19:54:30 +01:00
parent 0edae6e19a
commit 7d3bd131ab
3 changed files with 42 additions and 9 deletions

View File

@@ -235,12 +235,11 @@ class DefaultValues extends CommonObject
* Load object in memory from the database
*
* @param int $id Id object
* @param string $ref Ref
* @return int <0 if KO, 0 if not found, >0 if OK
*/
public function fetch($id, $ref = null)
public function fetch($id)
{
$result = $this->fetchCommon($id, $ref);
$result = $this->fetchCommon($id, null);
return $result;
}
@@ -272,11 +271,13 @@ class DefaultValues extends CommonObject
$sqlwhere = array();
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
if ($key == 't.rowid') {
if ($key == 't.rowid' || ($key == 't.entity' && !is_array($value)) || $key == 't.user_id') {
$sqlwhere[] = $key.'='.$value;
} elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
$sqlwhere[] = $key.' = \''.$this->db->idate($value).'\'';
} elseif ($key == 'customsql') {
} elseif ($key == 't.page' || $key == 't.param' || $key == 't.type'){
$sqlwhere[] = $key.' = \''.$this->db->escape($value).'\'';
} elseif ($key == 'customsql') {
$sqlwhere[] = $value;
} elseif (is_array($value)) {
$sqlwhere[] = $key.' IN ('.implode(',',$value).')';