Merge pull request #13138 from indelog/indelog-dev
NEW: Allow custom module class origine type in Mouvementstock
This commit is contained in:
commit
f1d16d6961
@ -377,7 +377,7 @@ class MouvementStock extends CommonObject
|
|||||||
{
|
{
|
||||||
$fk_project = 0;
|
$fk_project = 0;
|
||||||
if(!empty($this->origin)) { // This is set by caller for tracking reason
|
if(!empty($this->origin)) { // This is set by caller for tracking reason
|
||||||
$origintype = $this->origin->element;
|
$origintype = empty($this->origin->origin_type)?$this->origin->element:$this->origin->origin_type;
|
||||||
$fk_origin = $this->origin->id;
|
$fk_origin = $this->origin->id;
|
||||||
if ($origintype == 'project') $fk_project = $fk_origin;
|
if ($origintype == 'project') $fk_project = $fk_origin;
|
||||||
else
|
else
|
||||||
@ -981,10 +981,14 @@ class MouvementStock extends CommonObject
|
|||||||
default:
|
default:
|
||||||
if ($origintype)
|
if ($origintype)
|
||||||
{
|
{
|
||||||
$result = dol_include_once('/'.$origintype.'/class/'.$origintype.'.class.php');
|
// Separate originetype with "@" : left part is class name, right part is module name
|
||||||
|
$origintype_array = explode('@', $origintype);
|
||||||
|
$classname = ucfirst($origintype_array[0]);
|
||||||
|
$modulename = empty($origintype_array[1]) ? $classname : empty($origintype_array[1]);
|
||||||
|
$result=dol_include_once('/'.$modulename.'/class/'.strtolower($classname).'.class.php');
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$classname = ucfirst($origintype);
|
$classname = ucfirst($classname);
|
||||||
$origin = new $classname($this->db);
|
$origin = new $classname($this->db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user