Fix: getEntity $shared param value is now 1 by default

This commit is contained in:
Regis Houssin
2017-07-24 08:52:10 +02:00
parent 9043cf759b
commit 48800bc268

View File

@@ -334,23 +334,23 @@ abstract class CommonObject
// No constructor as it is an abstract class
/**
* Check an object id/ref exists
* If you don't need/want to instantiate object and just need to know if object exists, use this method instead of fetch
*
/**
* Check an object id/ref exists
* If you don't need/want to instantiate object and just need to know if object exists, use this method instead of fetch
*
* @param string $element String of element ('product', 'facture', ...)
* @param int $id Id of object
* @param string $ref Ref of object to check
* @param string $ref_ext Ref ext of object to check
* @return int <0 if KO, 0 if OK but not found, >0 if OK and exists
*/
static function isExistingObject($element, $id, $ref='', $ref_ext='')
{
global $db,$conf;
*/
static function isExistingObject($element, $id, $ref='', $ref_ext='')
{
global $db,$conf;
$sql = "SELECT rowid, ref, ref_ext";
$sql.= " FROM ".MAIN_DB_PREFIX.$element;
$sql.= " WHERE entity IN (".getEntity($element, true).")" ;
$sql.= " WHERE entity IN (".getEntity($element).")" ;
if ($id > 0) $sql.= " AND rowid = ".$db->escape($id);
else if ($ref) $sql.= " AND ref = '".$db->escape($ref)."'";
@@ -371,17 +371,17 @@ abstract class CommonObject
else return 0;
}
return -1;
}
}
/**
* Method to output saved errors
*
* @return string String with errors
*/
function errorsToString()
{
return $this->error.(is_array($this->errors)?(($this->error!=''?', ':'').join(', ',$this->errors)):'');
}
/**
* Method to output saved errors
*
* @return string String with errors
*/
function errorsToString()
{
return $this->error.(is_array($this->errors)?(($this->error!=''?', ':'').join(', ',$this->errors)):'');
}
/**
* Return full name (civility+' '+name+' '+lastname)