NEW Add param to not show links when output tags

This commit is contained in:
Laurent Destailleur 2020-06-16 02:56:48 +02:00
parent e28bbfbd63
commit 9ec8051a37
2 changed files with 8 additions and 3 deletions

View File

@ -1347,7 +1347,7 @@ class Categorie extends CommonObject
* separated by $sep (" >> " by default)
*
* @param string $sep Separator
* @param string $url Url
* @param string $url Url ('', 'none' or 'urltouse')
* @param int $nocolor 0
* @param string $addpicto Add picto into link
* @return array
@ -1386,6 +1386,10 @@ class Categorie extends CommonObject
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$cat->id.'&type='.$cat->type.'" class="'.$forced_color.'">';
$linkend = '</a>';
$w[] = $link.($addpicto ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend;
} elseif ($url == 'none') {
$link = '';
$linkend = '';
$w[] = $link.($addpicto ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend;
} else {
$w[] = "<a href='".DOL_URL_ROOT."/".$url."?catid=".$cat->id."'>".($addpicto ? img_object('', 'category') : '').$cat->label."</a>";
}

View File

@ -6554,9 +6554,10 @@ class Form
* @param int $id Id of object
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact'). Old mode (0, 1, 2, ...) is deprecated.
* @param int $rendermode 0=Default, use multiselect. 1=Emulate multiselect (recommended)
* @param int $nolink 1=Do not add html links
* @return string String with categories
*/
public function showCategories($id, $type, $rendermode = 0)
public function showCategories($id, $type, $rendermode = 0, $nolink = 0)
{
global $db;
@ -6570,7 +6571,7 @@ class Form
$toprint = array();
foreach ($categories as $c)
{
$ways = $c->print_all_ways(' &gt;&gt; ', '', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text
$ways = $c->print_all_ways(' &gt;&gt; ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text
foreach ($ways as $way)
{
$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.$way.'</li>';