add hook to custom directory into automatic file ECM
This commit is contained in:
parent
901b3287a9
commit
3b4f8c32f7
@ -201,6 +201,13 @@ if ($type == 'directory')
|
||||
'mrp-mo'
|
||||
);
|
||||
|
||||
$parameters = array('modulepart'=>$module);
|
||||
$reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters);
|
||||
if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray)>0)
|
||||
{
|
||||
$automodules[]=$hookmanager->resArray['module'];
|
||||
}
|
||||
|
||||
// TODO change for multicompany sharing
|
||||
if ($module == 'company') $upload_dir = $conf->societe->dir_output;
|
||||
elseif ($module == 'invoice') $upload_dir = $conf->facture->dir_output;
|
||||
@ -220,6 +227,13 @@ if ($type == 'directory')
|
||||
elseif ($module == 'recruitment-recruitmentcandidature') $upload_dir = $conf->recruitment->dir_output.'/recruitmentcandidature';
|
||||
elseif ($module == 'banque') $upload_dir = $conf->bank->dir_output;
|
||||
elseif ($module == 'mrp-mo') $upload_dir = $conf->mrp->dir_output.'/mo';
|
||||
else {
|
||||
$parameters = array('modulepart'=>$module);
|
||||
$reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters);
|
||||
if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray) > 0) {
|
||||
$upload_dir = $hookmanager->resArray['directory'];
|
||||
}
|
||||
}
|
||||
|
||||
// Automatic list
|
||||
if (in_array($module, $automodules))
|
||||
|
||||
@ -1570,6 +1570,20 @@ class FormFile
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php';
|
||||
$object_instance = new Mo($this->db);
|
||||
} else {
|
||||
$parameters = array('modulepart'=>$modulepart);
|
||||
$reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters);
|
||||
if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray)>0)
|
||||
{
|
||||
if (array_key_exists('classpath', $hookmanager->resArray) && !empty($hookmanager->resArray['classpath'])) {
|
||||
dol_include_once($hookmanager->resArray['classpath']);
|
||||
if (array_key_exists('classname', $hookmanager->resArray) && !empty($hookmanager->resArray['classname'])) {
|
||||
if (class_exists($hookmanager->resArray['classname'])) {
|
||||
$object_instance = new ${$hookmanager->resArray['classname']}($this->db);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($filearray);
|
||||
@ -1623,6 +1637,17 @@ class FormFile
|
||||
'banque'))) {
|
||||
preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref = (isset($reg[1]) ? $reg[1] : '');
|
||||
} else {
|
||||
$parameters = array('modulepart'=>$modulepart,'fullname'=>$file['fullname']);
|
||||
$reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters);
|
||||
if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray)>0)
|
||||
{
|
||||
if (array_key_exists('ref', $hookmanager->resArray) && !empty($hookmanager->resArray['ref'])) {
|
||||
$ref = $hookmanager->resArray['ref'];
|
||||
}
|
||||
if (array_key_exists('id', $hookmanager->resArray) && !empty($hookmanager->resArray['id'])) {
|
||||
$id = $hookmanager->resArray['id'];
|
||||
}
|
||||
}
|
||||
//print 'Error: Value for modulepart = '.$modulepart.' is not yet implemented in function list_of_autoecmfiles'."\n";
|
||||
}
|
||||
|
||||
|
||||
@ -1867,7 +1867,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
$menu->mainmenu = isset($this->menu[$key]['mainmenu']) ? $this->menu[$key]['mainmenu'] : (isset($menu->fk_mainmenu) ? $menu->fk_mainmenu : '');
|
||||
$menu->leftmenu = isset($this->menu[$key]['leftmenu']) ? $this->menu[$key]['leftmenu'] : '';
|
||||
$menu->title = $this->menu[$key]['titre'];
|
||||
$menu->prefix = $this->menu[$key]['prefix'];
|
||||
if (array_key_exists('prefix', $this->menu[$key])) $menu->prefix = $this->menu[$key]['prefix'];
|
||||
$menu->url = $this->menu[$key]['url'];
|
||||
$menu->langs = $this->menu[$key]['langs'];
|
||||
$menu->position = $this->menu[$key]['position'];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user