Merge pull request #21036 from OPEN-DSI/14.0_fix_show_category_on_sellist_extrafields

FIX: Show sellist type of extrafield when none category selected
This commit is contained in:
Laurent Destailleur 2022-05-29 11:24:35 +02:00 committed by GitHub
commit f5da6ebfe2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1766,15 +1766,18 @@ class ExtraFields
}
}
} else {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$toprint = array();
$obj = $this->db->fetch_object($resql);
$c = new Categorie($this->db);
$c->fetch($obj->rowid);
$ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
foreach ($ways as $way) {
$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.img_object('', 'category').' '.$way.'</li>';
if ($obj->rowid) {
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$c = new Categorie($this->db);
$result = $c->fetch($obj->rowid);
if ($result > 0) {
$ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
foreach ($ways as $way) {
$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . img_object('', 'category') . ' ' . $way . '</li>';
}
}
}
$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
}