add ajax tooltip on bom
This commit is contained in:
parent
a367fd24b7
commit
a5b1f8c20e
@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file bom/class/bom.class.php
|
||||
* \file htdocs/bom/class/bom.class.php
|
||||
* \ingroup bom
|
||||
* \brief This file is a CRUD class file for BOM (Create/Read/Update/Delete)
|
||||
*/
|
||||
@ -1064,6 +1064,43 @@ class BOM extends CommonObject
|
||||
return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'BOM_REOPEN');
|
||||
}
|
||||
|
||||
/**
|
||||
* getTooltipContentArray
|
||||
* @param array $params params to construct tooltip data
|
||||
* @since v18
|
||||
* @return array
|
||||
*/
|
||||
public function getTooltipContentArray($params)
|
||||
{
|
||||
global $conf, $langs, $user;
|
||||
|
||||
$langs->load('mrp');
|
||||
|
||||
$datas = [];
|
||||
|
||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||
return ['optimize' => $langs->trans("ShowBillOfMaterials")];
|
||||
}
|
||||
$picto = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("BillOfMaterials").'</u>';
|
||||
if (isset($this->status)) {
|
||||
$picto .= ' '.$this->getLibStatut(5);
|
||||
}
|
||||
$datas['picto'] = $picto;
|
||||
$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
if (isset($this->label)) {
|
||||
$datas['label'] = '<br><b>'.$langs->trans('Label').':</b> '.$this->label;
|
||||
}
|
||||
if (!empty($this->fk_product) && $this->fk_product > 0) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
$product = new Product($this->db);
|
||||
$resultFetch = $product->fetch($this->fk_product);
|
||||
if ($resultFetch > 0) {
|
||||
$datas['product'] = "<br><b>".$langs->trans("Product").'</b>: '.$product->ref.' - '.$product->label;
|
||||
}
|
||||
}
|
||||
|
||||
return $datas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a link to the object card (with optionaly the picto)
|
||||
@ -1123,8 +1160,18 @@ class BOM extends CommonObject
|
||||
$label = $langs->trans("ShowBillOfMaterials");
|
||||
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
||||
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
|
||||
$params = [
|
||||
'id' => $this->id,
|
||||
'objecttype' => $this->element,
|
||||
'option' => $option,
|
||||
];
|
||||
$linkclose .= ' data-params='.json_encode($params).' id="' . uniqid('bom') . '" title="' . $langs->trans('Loading') . '"';
|
||||
$linkclose .= ' class="classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"';
|
||||
} else {
|
||||
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
||||
}
|
||||
} else {
|
||||
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user