FIX: Show sellist type of extrafield when none category selected

This commit is contained in:
kamel 2022-05-25 18:02:18 +02:00
parent 3ce58c2337
commit f1914ff66f

View File

@ -1766,16 +1766,19 @@ class ExtraFields
} }
} }
} else { } else {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$toprint = array(); $toprint = array();
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
if ($obj->rowid) {
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$c = new Categorie($this->db); $c = new Categorie($this->db);
$c->fetch($obj->rowid); $result = $c->fetch($obj->rowid);
if ($result > 0) {
$ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
foreach ($ways as $way) { 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>'; $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>'; $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
} }
} else { } else {