add ajaxtooltip on member type

This commit is contained in:
Frédéric FRANCE 2023-02-02 11:03:08 +01:00
parent 2df357c7c2
commit e96cafa952
2 changed files with 40 additions and 4 deletions

View File

@ -688,6 +688,27 @@ class AdherentType extends CommonObject
//return $morphy;
}
/**
* getTooltipContentArray
* @param array $params params to construct tooltip data
* @since v18
* @return array
*/
public function getTooltipContentArray($params)
{
global $conf, $langs, $user;
$datas = [];
$datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("MemberType").'</u> '.$this->getLibStatut(4);
$datas['label'] = '<br>'.$langs->trans("Label").': '.$this->label;
if (isset($this->subscription)) {
$datas['subscription'] = '<br>'.$langs->trans("SubscriptionRequired").': '.yn($this->subscription);
}
return $datas;
}
/**
* Return clicable name (with picto eventually)
*
@ -725,8 +746,16 @@ class AdherentType extends CommonObject
$url .= '&save_lastsearch_values=1';
}
}
$linkstart = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
$params = [
'id' => $this->id,
'objecttype' => $this->element,
'option' => $option,
];
$linkstart = '<a href="'.$url.'" data-params='.json_encode($params).' id="' . uniqid($this->element) . '" title="'.$langs->trans('Loading').'" class="classforajaxtooltip">';
} else {
$linkstart = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
}
$linkend = '</a>';
$result .= $linkstart;
@ -741,7 +770,6 @@ class AdherentType extends CommonObject
return $result;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return label of status (activity, closed)
*
@ -753,6 +781,7 @@ class AdherentType extends CommonObject
return $this->LibStatut($this->status, $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return the label of a given status
*

View File

@ -141,7 +141,6 @@ if ($objecttype == 'facture' || $objecttype == 'invoice') {
// Generic case for $classfile and $classname
$classfile = strtolower($myobject);
$classname = ucfirst($myobject);
// print "objecttype=".$objecttype." module=".$module." subelement=".$subelement." classfile=".$classfile." classname=".$classname." classpath=".$classpath."\n";
if ($objecttype == 'invoice_supplier') {
$classfile = 'fournisseur.facture';
@ -171,9 +170,17 @@ if ($objecttype == 'invoice_supplier') {
$classpath = 'comm/mailing/class';
$classfile = 'mailing';
$classname = 'Mailing';
} elseif ($objecttype == 'adherent_type') {
$langs->load('members');
$classpath = 'adherents/class';
$classfile = 'adherent_type';
$module = 'adherent';
$myobject = 'adherent_type';
$classname = 'AdherentType';
} elseif ($objecttype == 'contact') {
$module = 'societe';
}
// print "objecttype=".$objecttype." module=".$module." subelement=".$subelement." classfile=".$classfile." classname=".$classname." classpath=".$classpath."\n";
if (isModEnabled($module)) {
$res = dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');