Merge branch '16.0' of git@github.com:Dolibarr/dolibarr.git into 16.0

This commit is contained in:
Laurent Destailleur 2022-12-30 04:15:10 +01:00
parent dfa13ea255
commit 534db40d87
2 changed files with 22 additions and 1 deletions

View File

@ -3789,7 +3789,7 @@ abstract class CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Add objects linked in llx_element_element. * Add an object link into llx_element_element.
* *
* @param string $origin Linked element type * @param string $origin Linked element type
* @param int $origin_id Linked element id * @param int $origin_id Linked element id
@ -4111,6 +4111,21 @@ abstract class CommonObject
} }
} }
/**
* Clear the cache saying that all linked object were already loaded. So next fetchObjectLinked will reload all links.
*
* @return int <0 if KO, >0 if OK
* @see fetchObjectLinked()
*/
public function clearObjectLinkedCache()
{
if ($this->id > 0 && !empty($this->linkedObjectsFullLoaded[$this->id])) {
unset($this->linkedObjectsFullLoaded[$this->id]);
}
return 1;
}
/** /**
* Update object linked of a current object * Update object linked of a current object
* *

View File

@ -90,6 +90,9 @@ class InterfaceWorkflowManager extends DolibarrTriggers
$this->error = $newobject->error; $this->error = $newobject->error;
$this->errors[] = $newobject->error; $this->errors[] = $newobject->error;
} }
$object->clearObjectLinkedCache();
return $ret; return $ret;
} }
} }
@ -111,6 +114,9 @@ class InterfaceWorkflowManager extends DolibarrTriggers
$this->error = $newobject->error; $this->error = $newobject->error;
$this->errors[] = $newobject->error; $this->errors[] = $newobject->error;
} }
$object->clearObjectLinkedCache();
return $ret; return $ret;
} }
} }