2
0
forked from Wavyzz/dolibarr

Merge branch '18.0' of git@github.com:Dolibarr/dolibarr.git into 19.0

This commit is contained in:
Laurent Destailleur
2024-04-27 03:14:17 +02:00
4 changed files with 103 additions and 14 deletions

View File

@@ -103,7 +103,7 @@ function tree_showpad(&$fulltree, $key, $silent = 0)
* TODO Replace with jstree plugin instead of treeview plugin.
*
* @param array $tab Array of all elements
* @param array $pere Array with parent ids ('rowid'=>,'mainmenu'=>,'leftmenu'=>,'fk_mainmenu=>,'fk_leftmenu=>)
* @param array $pere Array with parent ids ('rowid'=>,'mainmenu'=>,'leftmenu'=>,'fk_mainmenu'=>,'fk_leftmenu'=>)
* @param int $rang Level of element
* @param string $iddivjstree Id to use for parent ul element
* @param int $donoresetalreadyloaded Do not reset global array $donoresetalreadyloaded used to avoid to go down on an aleady processed record
@@ -142,13 +142,14 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset
return; // Protect against infinite loop. Max 50 depth
}
//ballayage du tableau
$sizeoftab = count($tab);
// Loop on each element of tree
$ulprinted = 0;
for ($x = 0; $x < $sizeoftab; $x++) {
foreach ($tab as $tmpkey => $tmpval) {
$x = $tmpkey;
//var_dump($tab[$x]);exit;
// If an element has $pere for parent
if ($tab[$x]['fk_menu'] != -1 && $tab[$x]['fk_menu'] == $pere['rowid']) {
if ($tab[$x]['fk_menu'] != -1 && ((int) $tab[$x]['fk_menu']) == $pere['rowid']) {
//print 'rang='.$rang.'-x='.$x." rowid=".$tab[$x]['rowid']." tab[x]['fk_leftmenu'] = ".$tab[$x]['fk_leftmenu']." leftmenu pere = ".$pere['leftmenu']."<br>\n";
if (empty($ulprinted) && !empty($pere['rowid'])) {
if (!empty($tree_recur_alreadyadded[$tab[$x]['rowid']])) {
@@ -178,7 +179,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset
// And now we search all its sons of lower level
tree_recur($tab, $tab[$x], $rang + 1, 'iddivjstree', 0, $showfk);
print '</li>';
} elseif (!empty($tab[$x]['rowid']) && $tab[$x]['fk_menu'] == -1 && $tab[$x]['fk_mainmenu'] == $pere['mainmenu'] && $tab[$x]['fk_leftmenu'] == $pere['leftmenu']) {
} elseif (!empty($tab[$x]['rowid']) && ((int) $tab[$x]['fk_menu']) == -1 && $tab[$x]['fk_mainmenu'] == $pere['mainmenu'] && $tab[$x]['fk_leftmenu'] == $pere['leftmenu']) {
//print 'rang='.$rang.'-x='.$x." rowid=".$tab[$x]['rowid']." tab[x]['fk_leftmenu'] = ".$tab[$x]['fk_leftmenu']." leftmenu pere = ".$pere['leftmenu']."<br>\n";
if (empty($ulprinted) && !empty($pere['rowid'])) {
if (!empty($tree_recur_alreadyadded[$tab[$x]['rowid']])) {