avoid fetch_objectlinked for each page of the document
This commit is contained in:
parent
d0ed15ce5c
commit
2455d8fe52
@ -123,6 +123,11 @@ abstract class CommonObject
|
||||
*/
|
||||
public $linkedObjects;
|
||||
|
||||
/**
|
||||
* @var boolean is linkedObjects full loaded. Loaded by ->fetchObjectLinked
|
||||
*/
|
||||
public $linkedObjectsFullLoaded = false;
|
||||
|
||||
/**
|
||||
* @var Object To store a cloned copy of object before to edit it and keep track of old properties
|
||||
*/
|
||||
@ -3834,6 +3839,9 @@ abstract class CommonObject
|
||||
} else {
|
||||
$sql .= "(fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."')";
|
||||
$sql .= " ".$clause." (fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."')";
|
||||
if ($sourceid == $this->id && $sourcetype == $this->element && $targetid == $this->id && $targettype == $this->element && $clause == 'OR') {
|
||||
$this->linkedObjectsFullLoaded = true;
|
||||
}
|
||||
}
|
||||
$sql .= " ORDER BY ".$orderby;
|
||||
|
||||
|
||||
@ -2282,7 +2282,9 @@ function pdf_getLinkedObjects(&$object, $outputlangs)
|
||||
|
||||
$linkedobjects = array();
|
||||
|
||||
$object->fetchObjectLinked();
|
||||
if (empty($object->linkedObjectsFullLoaded)) {
|
||||
$object->fetchObjectLinked();
|
||||
}
|
||||
|
||||
foreach ($object->linkedObjects as $objecttype => $objects) {
|
||||
if ($objecttype == 'facture') {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user