Fix: external modules workflow compatibility

This commit is contained in:
Regis Houssin 2012-07-24 20:15:34 +02:00
parent f8f50a722d
commit 8e953a6858
2 changed files with 19 additions and 13 deletions

View File

@ -83,7 +83,7 @@ class modMyModule extends DolibarrModules
// 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx) // 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx)
// '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 // 'workflow' => array('WORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2'=>array('enabled'=>'! empty($conf->module1->enabled) && ! empty($conf->module2->enabled)', 'picto'=>'yourpicto@mymodule')) // Set here all workflow context managed by module
// ); // );
$this->module_parts = array(); $this->module_parts = array();

View File

@ -77,34 +77,40 @@ print "</tr>\n";
clearstatcache(); clearstatcache();
$workflowcodes=array( $workflowcodes=array(
'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array('enabled'=>($conf->propal->enabled && $conf->commande->enabled), 'picto'=>'order'), 'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array('enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'),
'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array('enabled'=>($conf->propal->enabled && $conf->commande->enabled), 'picto'=>'order','warning'=>'WarningCloseAlways'), 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array('enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>'WarningCloseAlways'),
'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array('enabled'=>($conf->commande->enabled && $conf->facture->enabled), 'picto'=>'bill'), 'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array('enabled'=>'! empty($conf->commande->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'bill'),
'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('enabled'=>($conf->facture->enabled && $conf->commande->enabled), 'picto'=>'bill','warning'=>'WarningCloseAlways'), 'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'),
); );
if (! empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow'])) $workflow = array_merge($workflow, $conf->modules_parts['workflow']); if (! empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow']))
{
foreach($conf->modules_parts['workflow'] as $workflow)
{
$workflowcodes = array_merge($workflowcodes, $workflow);
}
}
$nbqualified=0; $nbqualified=0;
foreach($workflowcodes as $key => $tmparray) foreach($workflowcodes as $key => $params)
{ {
$picto=$tmparray['picto']; $picto=$params['picto'];
$enabled=$tmparray['enabled']; $enabled=$params['enabled'];
if (empty($enabled)) continue; if (! verifCond($enabled)) continue;
$nbqualified++; $nbqualified++;
$var = !$var; $var = !$var;
print "<tr ".$bc[$var].">\n"; print "<tr ".$bc[$var].">\n";
print "<td>".img_object('', $picto).$langs->trans('desc'.$key); print "<td>".img_object('', $picto).$langs->trans('desc'.$key);
if (! empty($tmparray['warning'])) if (! empty($params['warning']))
{ {
$langs->load("errors"); $langs->load("errors");
print ' '.img_warning($langs->transnoentitiesnoconv($tmparray['warning'])); print ' '.img_warning($langs->transnoentitiesnoconv($params['warning']));
} }
print "</td>\n"; print "</td>\n";
print '<td align="center">'; print '<td align="center">';
if ($conf->use_javascript_ajax) if (! empty($conf->use_javascript_ajax))
{ {
print ajax_constantonoff($key); print ajax_constantonoff($key);
} }