ajax tooltip on contact
This commit is contained in:
parent
8d71b81013
commit
11e3dbb2fb
@ -1404,6 +1404,52 @@ class Contact extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getTooltipContentArray
|
||||||
|
* @param array $params params to construct tooltip data
|
||||||
|
* @since v18
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getTooltipContentArray($params)
|
||||||
|
{
|
||||||
|
global $conf, $langs, $user;
|
||||||
|
|
||||||
|
$datas = [];
|
||||||
|
|
||||||
|
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||||
|
return ['optimize' => $langs->trans("ShowContact")];
|
||||||
|
}
|
||||||
|
if (!empty($this->photo) && class_exists('Form')) {
|
||||||
|
$photo = '<div class="photointooltip floatright">';
|
||||||
|
$photo .= Form::showphoto('contact', $this, 0, 40, 0, 'photoref', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip.
|
||||||
|
$photo .= '</div>';
|
||||||
|
$datas['photo'] = $photo;
|
||||||
|
}
|
||||||
|
|
||||||
|
$datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Contact").'</u> ' . $this->getLibStatut(4);
|
||||||
|
$datas['name'] = '<br><b>'.$langs->trans("Name").':</b> '.$this->getFullName($langs);
|
||||||
|
// if ($this->civility_id) $datas['civility'] = '<br><b>' . $langs->trans("Civility") . ':</b> '.$this->civility_id; // TODO Translate civilty_id code
|
||||||
|
if (!empty($this->poste)) {
|
||||||
|
$datas['job'] = '<br><b>'.$langs->trans("Poste").':</b> '.$this->poste;
|
||||||
|
}
|
||||||
|
$datas['email'] = '<br><b>'.$langs->trans("EMail").':</b> '.$this->email;
|
||||||
|
$phonelist = array();
|
||||||
|
$country_code = empty($this->country_code) ? '': $this->country_code;
|
||||||
|
if ($this->phone_pro) {
|
||||||
|
$phonelist[] = dol_print_phone($this->phone_pro, $country_code, $this->id, 0, '', ' ', 'phone');
|
||||||
|
}
|
||||||
|
if ($this->phone_mobile) {
|
||||||
|
$phonelist[] = dol_print_phone($this->phone_mobile, $country_code, $this->id, 0, '', ' ', 'mobile');
|
||||||
|
}
|
||||||
|
if ($this->phone_perso) {
|
||||||
|
$phonelist[] = dol_print_phone($this->phone_perso, $country_code, $this->id, 0, '', ' ', 'phone');
|
||||||
|
}
|
||||||
|
$datas['phonelist'] = '<br><b>'.$langs->trans("Phone").':</b> '.implode(' ', $phonelist);
|
||||||
|
$datas['address'] = '<br><b>'.$langs->trans("Address").':</b> '.dol_format_address($this, 1, ' ', $langs);
|
||||||
|
|
||||||
|
return $datas;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return name of contact with link (and eventually picto)
|
* Return name of contact with link (and eventually picto)
|
||||||
* Use $this->id, $this->lastname, $this->firstname, this->civility_id
|
* Use $this->id, $this->lastname, $this->firstname, this->civility_id
|
||||||
@ -1421,7 +1467,8 @@ class Contact extends CommonObject
|
|||||||
{
|
{
|
||||||
global $conf, $langs, $hookmanager;
|
global $conf, $langs, $hookmanager;
|
||||||
|
|
||||||
$result = ''; $label = '';
|
$result = '';
|
||||||
|
$label = '';
|
||||||
if (!empty($this->photo) && class_exists('Form')) {
|
if (!empty($this->photo) && class_exists('Form')) {
|
||||||
$label .= '<div class="photointooltip floatright">';
|
$label .= '<div class="photointooltip floatright">';
|
||||||
$label .= Form::showphoto('contact', $this, 0, 40, 0, 'photoref', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip.
|
$label .= Form::showphoto('contact', $this, 0, 40, 0, 'photoref', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip.
|
||||||
@ -1472,8 +1519,18 @@ class Contact extends CommonObject
|
|||||||
$label = $langs->trans("ShowContact");
|
$label = $langs->trans("ShowContact");
|
||||||
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||||
}
|
}
|
||||||
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
|
||||||
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
$params = [
|
||||||
|
'id' => $this->id,
|
||||||
|
'objecttype' => $this->element,
|
||||||
|
'option' => $option,
|
||||||
|
];
|
||||||
|
$linkclose .= ' data-params='.json_encode($params).' id="contact-' . uniqid() . '" title="' . $langs->trans('Loading') . '"';
|
||||||
|
$linkclose .= ' class="classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"';
|
||||||
|
} else {
|
||||||
|
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
|
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$linkstart = '<a href="'.$url.'"';
|
$linkstart = '<a href="'.$url.'"';
|
||||||
|
|||||||
@ -141,7 +141,7 @@ if ($objecttype == 'facture' || $objecttype == 'invoice') {
|
|||||||
// Generic case for $classfile and $classname
|
// Generic case for $classfile and $classname
|
||||||
$classfile = strtolower($myobject);
|
$classfile = strtolower($myobject);
|
||||||
$classname = ucfirst($myobject);
|
$classname = ucfirst($myobject);
|
||||||
//print "objecttype=".$objecttype." module=".$module." subelement=".$subelement." classfile=".$classfile." classname=".$classname." classpath=".$classpath;
|
// print "objecttype=".$objecttype." module=".$module." subelement=".$subelement." classfile=".$classfile." classname=".$classname." classpath=".$classpath."\n";
|
||||||
|
|
||||||
if ($objecttype == 'invoice_supplier') {
|
if ($objecttype == 'invoice_supplier') {
|
||||||
$classfile = 'fournisseur.facture';
|
$classfile = 'fournisseur.facture';
|
||||||
@ -171,6 +171,8 @@ if ($objecttype == 'invoice_supplier') {
|
|||||||
$classpath = 'comm/mailing/class';
|
$classpath = 'comm/mailing/class';
|
||||||
$classfile = 'mailing';
|
$classfile = 'mailing';
|
||||||
$classname = 'Mailing';
|
$classname = 'Mailing';
|
||||||
|
} elseif ($objecttype == 'contact') {
|
||||||
|
$module = 'societe';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isModEnabled($module)) {
|
if (isModEnabled($module)) {
|
||||||
@ -186,6 +188,7 @@ if (isModEnabled($module)) {
|
|||||||
}
|
}
|
||||||
unset($object);
|
unset($object);
|
||||||
} else {
|
} else {
|
||||||
|
print "Class with classname ".$classname." is unknown even after the include";
|
||||||
dol_syslog("Class with classname ".$classname." is unknown even after the include", LOG_ERR);
|
dol_syslog("Class with classname ".$classname." is unknown even after the include", LOG_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user