New: add workflow module part for external modules
This commit is contained in:
parent
14b6173d87
commit
c57063878d
@ -81,6 +81,7 @@ class modMyModule extends DolibarrModules
|
|||||||
// 'models' => 0, // Set this to 1 if module has its own models directory
|
// 'models' => 0, // Set this to 1 if module has its own models directory
|
||||||
// 'css' => '/mymodule/css/mymodule.css.php', // Set this to relative path of css if module has its own css file
|
// 'css' => '/mymodule/css/mymodule.css.php', // Set this to relative path of css if module has its own css file
|
||||||
// 'hooks' => array('hookcontext1','hookcontext2') // Set here all hooks context managed by module
|
// 'hooks' => array('hookcontext1','hookcontext2') // Set here all hooks context managed by module
|
||||||
|
// 'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) // Set here all workflow context managed by module
|
||||||
// );
|
// );
|
||||||
$this->module_parts = array();
|
$this->module_parts = array();
|
||||||
|
|
||||||
|
|||||||
@ -77,10 +77,36 @@ print "</tr>\n";
|
|||||||
clearstatcache();
|
clearstatcache();
|
||||||
|
|
||||||
$workflowcodes=array();
|
$workflowcodes=array();
|
||||||
if ($conf->propal->enabled && $conf->commande->enabled) $workflowcodes['WORKFLOW_PROPAL_AUTOCREATE_ORDER']='WORKFLOW_PROPAL_AUTOCREATE_ORDER';
|
$workflow=array(
|
||||||
//if ($conf->propal->enabled && $conf->facture->enabled) $workflowcodes['WORKFLOW_PROPAL_AUTOCREATE_INVOICE']='WORKFLOW_PROPAL_AUTOCREATE_INVOICE';
|
'order' => array(
|
||||||
//if ($conf->contrat->enabled && $conf->facture->enabled) $workflowcodes['WORKFLOW_CONTRACT_AUTOCREATE_INVOICE']='WORKFLOW_CONTRACT_AUTOCREATE_INVOICE';
|
'propal' => array('WORKFLOW_PROPAL_AUTOCREATE_ORDER')
|
||||||
if ($conf->commande->enabled && $conf->facture->enabled) $workflowcodes['WORKFLOW_ORDER_AUTOCREATE_INVOICE']='WORKFLOW_ORDER_AUTOCREATE_INVOICE';
|
),
|
||||||
|
'invoice' => array (
|
||||||
|
'order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')
|
||||||
|
//,'contract' => array('WORKFLOW_CONTRACT_AUTOCREATE_INVOICE')
|
||||||
|
//, 'propal' => array('WORKFLOW_PROPAL_AUTOCREATE_INVOICE')
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$workflow = array_merge($workflow, $conf->modules_parts['workflow']);
|
||||||
|
|
||||||
|
foreach($workflow as $child => $parents)
|
||||||
|
{
|
||||||
|
if ($conf->$child->enabled)
|
||||||
|
{
|
||||||
|
$langs->Load($child.'@'.$child);
|
||||||
|
|
||||||
|
foreach($parents as $parent => $actions)
|
||||||
|
{
|
||||||
|
if ($conf->$parent->enabled)
|
||||||
|
{
|
||||||
|
foreach($actions as $action)
|
||||||
|
{
|
||||||
|
$workflowcodes[$action] = $action;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (count($workflowcodes) > 0)
|
if (count($workflowcodes) > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -401,6 +401,9 @@ class Conf
|
|||||||
|
|
||||||
// For backward compatibility
|
// For backward compatibility
|
||||||
$this->produit=$this->product;
|
$this->produit=$this->product;
|
||||||
|
$this->invoice=$this->facture;
|
||||||
|
$this->order=$this->commande;
|
||||||
|
$this->contract=$this->contrat;
|
||||||
|
|
||||||
|
|
||||||
// Define menu manager in setup
|
// Define menu manager in setup
|
||||||
|
|||||||
@ -69,7 +69,7 @@ class modWorkflow extends DolibarrModules
|
|||||||
$this->dirs = array("/workflow/temp");
|
$this->dirs = array("/workflow/temp");
|
||||||
|
|
||||||
// Config pages. Put here list of php page names stored in admmin directory used to setup module.
|
// Config pages. Put here list of php page names stored in admmin directory used to setup module.
|
||||||
$this->config_page_url = 'workflow.php';
|
$this->config_page_url = array('workflow.php');
|
||||||
|
|
||||||
// Dependencies
|
// Dependencies
|
||||||
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
|
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user