add ajax tooltip on categories
This commit is contained in:
parent
ba2f87d307
commit
ffa9e1e52f
@ -10,7 +10,7 @@
|
|||||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||||
* Copyright (C) 2018-2022 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2018-2023 Frédéric France <frederic.france@netlogic.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -1597,6 +1597,23 @@ class Categorie extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getTooltipContentArray
|
||||||
|
* @param array $params params to construct tooltip data
|
||||||
|
* @since v18
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getTooltipContentArray($params)
|
||||||
|
{
|
||||||
|
global $conf, $langs, $user;
|
||||||
|
|
||||||
|
$datas = [];
|
||||||
|
|
||||||
|
$datas['label'] = $langs->trans("ShowCategory").': '.($this->ref ? $this->ref : $this->label);
|
||||||
|
|
||||||
|
return $datas;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return name and link of category (with picto)
|
* Return name and link of category (with picto)
|
||||||
* Use ->id, ->ref, ->label, ->color
|
* Use ->id, ->ref, ->label, ->color
|
||||||
@ -1622,7 +1639,22 @@ class Categorie extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.$moreparam.'&backtopage='.urlencode($_SERVER['PHP_SELF'].($moreparam ? '?'.$moreparam : '')).'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip '.$forced_color.'">';
|
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.$moreparam.'&backtopage='.urlencode($_SERVER['PHP_SELF'].($moreparam ? '?'.$moreparam : ''));
|
||||||
|
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
|
||||||
|
$params = [
|
||||||
|
'id' => $this->id,
|
||||||
|
'objecttype' => $this->element,
|
||||||
|
'option' => $option,
|
||||||
|
];
|
||||||
|
$link2 = $link;
|
||||||
|
$link .= '" data-params='.json_encode($params).' id="' . uniqid('category') . '" title="' . $langs->trans('Loading') . '"';
|
||||||
|
$link .= ' class="classforajaxtooltip '.$forced_color.'">';
|
||||||
|
$link2 .= '" data-params='.json_encode($params).' id="' . uniqid('category') . '" title="' . $langs->trans('Loading') . '"';
|
||||||
|
$link2 .= ' class="classforajaxtooltip '.$forced_color.'">';
|
||||||
|
} else {
|
||||||
|
$link .= '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip '.$forced_color.'">';
|
||||||
|
$link2 = $link;
|
||||||
|
}
|
||||||
$linkend = '</a>';
|
$linkend = '</a>';
|
||||||
|
|
||||||
$picto = 'category';
|
$picto = 'category';
|
||||||
@ -1635,7 +1667,7 @@ class Categorie extends CommonObject
|
|||||||
$result .= ' ';
|
$result .= ' ';
|
||||||
}
|
}
|
||||||
if ($withpicto != 2) {
|
if ($withpicto != 2) {
|
||||||
$result .= $link.dol_trunc(($this->ref ? $this->ref : $this->label), $maxlength).$linkend;
|
$result .= $link2.dol_trunc(($this->ref ? $this->ref : $this->label), $maxlength).$linkend;
|
||||||
}
|
}
|
||||||
global $action;
|
global $action;
|
||||||
$hookmanager->initHooks(array($this->element . 'dao'));
|
$hookmanager->initHooks(array($this->element . 'dao'));
|
||||||
|
|||||||
@ -75,11 +75,16 @@ if ($objecttype == 'facture' || $objecttype == 'invoice') {
|
|||||||
$classpath = 'compta/facture/class';
|
$classpath = 'compta/facture/class';
|
||||||
$module = 'facture';
|
$module = 'facture';
|
||||||
$myobject = 'facture';
|
$myobject = 'facture';
|
||||||
} elseif ($objecttype == 'bank_account') {
|
} elseif ($objecttype == 'bank_accoun') {
|
||||||
$langs->loadLangs(['banks', 'compta']);
|
$langs->loadLangs(['banks', 'compta']);
|
||||||
$classpath = 'compta/bank/class';
|
$classpath = 'compta/bank/class';
|
||||||
$module = 'banque';
|
$module = 'banque';
|
||||||
$myobject = 'account';
|
$myobject = 'account';
|
||||||
|
} elseif ($objecttype == 'category') {
|
||||||
|
$langs->loadLangs(['categories']);
|
||||||
|
$classpath = 'categories/class';
|
||||||
|
$module = 'categorie';
|
||||||
|
$myobject = 'categorie';
|
||||||
} elseif ($objecttype == 'commande' || $objecttype == 'order') {
|
} elseif ($objecttype == 'commande' || $objecttype == 'order') {
|
||||||
$langs->load('orders');
|
$langs->load('orders');
|
||||||
$classpath = 'commande/class';
|
$classpath = 'commande/class';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user