function showSuppliersAssociated($type, $canedit, array $options = array())
{
global $CFG_GLPI;
$showsupplierlink = 0;
if (Session::haveRight('contact_enterprise', READ)) {
$showsupplierlink = 2;
}
$suppliericon = self::getActorIcon('supplier', $type);
$supplier = new Supplier();
$linksupplier = new $this->supplierlinkclass();
$itemtype = $this->getType();
$typename = self::getActorFieldNameType($type);
$candelete = true;
$mandatory = '';
// For ticket templates : mandatories
if ($itemtype == 'Ticket' && isset($options['_tickettemplate'])) {
$mandatory = $options['_tickettemplate']->getMandatoryMark("_suppliers_id_" . $typename);
if ($options['_tickettemplate']->isMandatoryField("_suppliers_id_" . $typename) && isset($this->suppliers[$type]) && count($this->suppliers[$type]) == 1) {
$candelete = false;
}
}
if (isset($this->suppliers[$type]) && count($this->suppliers[$type])) {
foreach ($this->suppliers[$type] as $d) {
echo "<div class='actor_row'>";
$k = $d['suppliers_id'];
echo "{$mandatory}{$suppliericon} ";
if ($supplier->getFromDB($k)) {
echo $supplier->getLink(array('comments' => $showsupplierlink));
echo " ";
$tmpname = Dropdown::getDropdownName($supplier->getTable(), $k, 1);
Html::showToolTip($tmpname['comment']);
if ($CFG_GLPI['use_mailing']) {
$text = __('Email followup') . " " . Dropdown::getYesNo($d['use_notification']) . '<br>';
if ($d['use_notification']) {
$supemail = $d['alternative_email'];
if (empty($supemail)) {
$supemail = $supplier->fields['email'];
}
$text .= sprintf(__('%1$s: %2$s'), __('Email'), $supemail);
}
echo " ";
if ($canedit) {
$opt = array('img' => $CFG_GLPI['root_doc'] . '/pics/edit.png', 'popup' => $linksupplier->getFormURL() . "?id=" . $d['id']);
Html::showToolTip($text, $opt);
}
}
}
if ($canedit && $candelete) {
echo " ";
Html::showSimpleForm($linksupplier->getFormURL(), 'delete', _x('button', 'Delete permanently'), array('id' => $d['id']), $CFG_GLPI["root_doc"] . "/pics/delete.png");
}
echo '</div>';
}
}
}