Skip to content

Commit

Permalink
New: An external module can add tabs with a label that is a dynamic
Browse files Browse the repository at this point in the history
value.
Qual: The deprecated way (with 4 parameters) to declare a new tab into a
module descriptor file has been removed. You must now use the 6
parameters way. See file modMyModule.class.php for example.
  • Loading branch information
eldy committed Jan 12, 2014
1 parent eaf3bd5 commit 02989b9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Expand Up @@ -23,6 +23,12 @@ For developers:
- New: Add option 'aZ' into GETPOST function to check parameters contains
only a to z or A to Z characters.

WARNING: Following change may create regression for some external modules, but was necessary to make
Dolibarr better:

- The deprecated way (with 4 parameters) to declare a new tab into a module descriptor file has been
removed. You must now use the 6 parameters way. See file modMyModule.class.php for example.


***** ChangeLog for 3.5 compared to 3.4.* *****
For users:
Expand Down
31 changes: 19 additions & 12 deletions htdocs/core/lib/functions.lib.php
Expand Up @@ -4330,30 +4330,37 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode=
if (verifCond($values[4]))
{
if ($values[3]) $langs->load($values[3]);
if (preg_match('/SUBSTITUTION_([^_]+)/i',$values[2],$reg))
{
$substitutionarray=array();
complete_substitutions_array($substitutionarray,$langs,$object);
$label=make_substitutions($reg[1], $substitutionarray);
}
else $label=$langs->trans($values[2]);

$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', ((is_object($object) && ! empty($object->id))?$object->id:''), $values[5]), 1);
$head[$h][1] = $langs->trans($values[2]);
$head[$h][1] = $label;
$head[$h][2] = str_replace('+','',$values[1]);
$h++;
}
}
else if (count($values) == 5) // new declaration
else if (count($values) == 5) // deprecated
{
if ($values[0] != $type) continue;
if ($values[3]) $langs->load($values[3]);
if (preg_match('/SUBSTITUTION_([^_]+)/i',$values[2],$reg))
{
$substitutionarray=array();
complete_substitutions_array($substitutionarray,$langs,$object);
$label=make_substitutions($reg[1], $substitutionarray);
}
else $label=$langs->trans($values[2]);

$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', ((is_object($object) && ! empty($object->id))?$object->id:''), $values[4]), 1);
$head[$h][1] = $langs->trans($values[2]);
$head[$h][1] = $label;
$head[$h][2] = str_replace('+','',$values[1]);
$h++;
}
else if (count($values) == 4) // old declaration, for backward compatibility
{
if ($values[0] != $type) continue;
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', ((is_object($object) && ! empty($object->id))?$object->id:''), $values[3]), 1);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;
}
}
else if ($mode == 'remove' && preg_match('/^\-/',$values[1]))
{
Expand Down

0 comments on commit 02989b9

Please sign in to comment.