New: An external module can add tabs with a label that is a dynamic

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.
This commit is contained in:
Laurent Destailleur 2014-01-12 14:11:03 +01:00
parent eaf3bd5679
commit 02989b9f32
2 changed files with 25 additions and 12 deletions

View File

@ -23,6 +23,12 @@ For developers:
- New: Add option 'aZ' into GETPOST function to check parameters contains - New: Add option 'aZ' into GETPOST function to check parameters contains
only a to z or A to Z characters. 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.* ***** ***** ChangeLog for 3.5 compared to 3.4.* *****
For users: For users:

View File

@ -4330,28 +4330,35 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode=
if (verifCond($values[4])) if (verifCond($values[4]))
{ {
if ($values[3]) $langs->load($values[3]); 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][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]); $head[$h][2] = str_replace('+','',$values[1]);
$h++; $h++;
} }
} }
else if (count($values) == 5) // new declaration else if (count($values) == 5) // deprecated
{ {
if ($values[0] != $type) continue; if ($values[0] != $type) continue;
if ($values[3]) $langs->load($values[3]); if ($values[3]) $langs->load($values[3]);
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', ((is_object($object) && ! empty($object->id))?$object->id:''), $values[4]), 1); if (preg_match('/SUBSTITUTION_([^_]+)/i',$values[2],$reg))
$head[$h][1] = $langs->trans($values[2]);
$head[$h][2] = str_replace('+','',$values[1]);
$h++;
}
else if (count($values) == 4) // old declaration, for backward compatibility
{ {
if ($values[0] != $type) continue; $substitutionarray=array();
if ($values[2]) $langs->load($values[2]); complete_substitutions_array($substitutionarray,$langs,$object);
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', ((is_object($object) && ! empty($object->id))?$object->id:''), $values[3]), 1); $label=make_substitutions($reg[1], $substitutionarray);
$head[$h][1] = $langs->trans($values[1]); }
$head[$h][2] = 'tab'.$values[1]; 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] = $label;
$head[$h][2] = str_replace('+','',$values[1]);
$h++; $h++;
} }
} }