Merge pull request #16192 from FHenry/dev_add_hook_ecm_auto
NEW : add hook addSectionECMAuto method to add cuistom diretory into ECM auto files
This commit is contained in:
commit
499ebd73b1
@ -201,6 +201,13 @@ if ($type == 'directory')
|
|||||||
'mrp-mo'
|
'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
|
// TODO change for multicompany sharing
|
||||||
if ($module == 'company') $upload_dir = $conf->societe->dir_output;
|
if ($module == 'company') $upload_dir = $conf->societe->dir_output;
|
||||||
elseif ($module == 'invoice') $upload_dir = $conf->facture->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 == 'recruitment-recruitmentcandidature') $upload_dir = $conf->recruitment->dir_output.'/recruitmentcandidature';
|
||||||
elseif ($module == 'banque') $upload_dir = $conf->bank->dir_output;
|
elseif ($module == 'banque') $upload_dir = $conf->bank->dir_output;
|
||||||
elseif ($module == 'mrp-mo') $upload_dir = $conf->mrp->dir_output.'/mo';
|
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
|
// Automatic list
|
||||||
if (in_array($module, $automodules))
|
if (in_array($module, $automodules))
|
||||||
|
|||||||
@ -161,6 +161,7 @@ class HookManager
|
|||||||
'addMoreMassActions',
|
'addMoreMassActions',
|
||||||
'addSearchEntry',
|
'addSearchEntry',
|
||||||
'addStatisticLine',
|
'addStatisticLine',
|
||||||
|
'addSectionECMAuto',
|
||||||
'createDictionaryFieldlist',
|
'createDictionaryFieldlist',
|
||||||
'editDictionaryFieldlist',
|
'editDictionaryFieldlist',
|
||||||
'getFormMail',
|
'getFormMail',
|
||||||
|
|||||||
@ -1570,6 +1570,20 @@ class FormFile
|
|||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php';
|
||||||
$object_instance = new Mo($this->db);
|
$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);
|
//var_dump($filearray);
|
||||||
@ -1623,6 +1637,17 @@ class FormFile
|
|||||||
'banque'))) {
|
'banque'))) {
|
||||||
preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref = (isset($reg[1]) ? $reg[1] : '');
|
preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref = (isset($reg[1]) ? $reg[1] : '');
|
||||||
} else {
|
} else {
|
||||||
|
$parameters = array('modulepart'=>$modulepart,'fileinfo'=>$file);
|
||||||
|
$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";
|
//print 'Error: Value for modulepart = '.$modulepart.' is not yet implemented in function list_of_autoecmfiles'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -81,6 +81,9 @@ $error = 0;
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
|
$hookmanager->initHooks(array('ecmautocard', 'globalcard'));
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
@ -327,6 +330,14 @@ if (!empty($conf->global->ECM_AUTO_TREE_ENABLED))
|
|||||||
if (!empty($conf->mrp->enabled)) { $langs->load("mrp"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'mrp-mo', 'test'=>$conf->mrp->enabled, 'label'=>$langs->trans("MOs"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ManufacturingOrders"))); }
|
if (!empty($conf->mrp->enabled)) { $langs->load("mrp"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'mrp-mo', 'test'=>$conf->mrp->enabled, 'label'=>$langs->trans("MOs"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ManufacturingOrders"))); }
|
||||||
if (!empty($conf->recruitment->enabled)) { $langs->load("recruitment"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'recruitment-recruitmentcandidature', 'test'=>$conf->recruitment->enabled, 'label'=>$langs->trans("Candidatures"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("JobApplications"))); }
|
if (!empty($conf->recruitment->enabled)) { $langs->load("recruitment"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'recruitment-recruitmentcandidature', 'test'=>$conf->recruitment->enabled, 'label'=>$langs->trans("Candidatures"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("JobApplications"))); }
|
||||||
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'user', 'test'=>1, 'label'=>$langs->trans("Users"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Users")));
|
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'user', 'test'=>1, 'label'=>$langs->trans("Users"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Users")));
|
||||||
|
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters);
|
||||||
|
if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray)>0)
|
||||||
|
{
|
||||||
|
$sectionauto[]=$hookmanager->resArray;
|
||||||
|
$rowspan += count($hookmanager->resArray);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$head = ecm_prepare_dasboard_head('');
|
$head = ecm_prepare_dasboard_head('');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user