Fix #1682
This commit is contained in:
parent
7dd1b8beda
commit
c4daca2bac
@ -1887,10 +1887,11 @@ abstract class CommonObject
|
|||||||
* @param int $targetid Object target id
|
* @param int $targetid Object target id
|
||||||
* @param string $targettype Object target type
|
* @param string $targettype Object target type
|
||||||
* @param string $clause 'OR' or 'AND' clause used when both source id and target id are provided
|
* @param string $clause 'OR' or 'AND' clause used when both source id and target id are provided
|
||||||
|
* @param int $alsosametype 0=Return only links to different object than source. 1=Include also link to objects of same type.
|
||||||
* @return void
|
* @return void
|
||||||
* @see add_object_linked, updateObjectLinked, deleteObjectLinked
|
* @see add_object_linked, updateObjectLinked, deleteObjectLinked
|
||||||
*/
|
*/
|
||||||
function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR')
|
function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR',$alsosametype=1)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -1924,7 +1925,7 @@ abstract class CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Links beetween objects are stored in this table
|
// Links between objects are stored in table element_element
|
||||||
$sql = 'SELECT fk_source, sourcetype, fk_target, targettype';
|
$sql = 'SELECT fk_source, sourcetype, fk_target, targettype';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'element_element';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'element_element';
|
||||||
$sql.= " WHERE ";
|
$sql.= " WHERE ";
|
||||||
@ -1983,7 +1984,7 @@ abstract class CommonObject
|
|||||||
|
|
||||||
$classpath = $element.'/class';
|
$classpath = $element.'/class';
|
||||||
|
|
||||||
// To work with non standard path
|
// To work with non standard classpath or module name
|
||||||
if ($objecttype == 'facture') {
|
if ($objecttype == 'facture') {
|
||||||
$classpath = 'compta/facture/class';
|
$classpath = 'compta/facture/class';
|
||||||
}
|
}
|
||||||
@ -2019,7 +2020,7 @@ abstract class CommonObject
|
|||||||
$classfile = 'fournisseur.commande'; $classname = 'CommandeFournisseur';
|
$classfile = 'fournisseur.commande'; $classname = 'CommandeFournisseur';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conf->$module->enabled && $element != $this->element)
|
if ($conf->$module->enabled && (($element != $this->element) || $alsosametype))
|
||||||
{
|
{
|
||||||
dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');
|
dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user