Skip to content

Commit

Permalink
Merge pull request #1 from Net-Logic/dev
Browse files Browse the repository at this point in the history
add some objects that can have an underscore
  • Loading branch information
frederic34 authored Nov 3, 2023
2 parents e4424d0 + a10faf9 commit 4e87965
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion admin/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
);
}
$selected = !empty($module) ? $module : '%';
$sql = 'SELECT rowid, name, value FROM ' . MAIN_DB_PREFIX . 'const WHERE name LIKE "EASYTOOLTIP_' . $selected . '_' . $conf->entity . '%" ORDER by name';
$sql = 'SELECT rowid, name, value FROM ' . MAIN_DB_PREFIX . 'const WHERE name LIKE "EASYTOOLTIP_' . $selected . '_' . $conf->entity . '_%" ORDER by name';

$resql = $db->query($sql);
$modules = [];
Expand Down
12 changes: 12 additions & 0 deletions class/actions_easytooltip.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,18 @@ public function getTooltipContent($parameters, &$object, &$action, $hookmanager)
} elseif (in_array('userdao', $contexts)) {
/** @var User $object */
$found = true;
} elseif (in_array('bank_accountdao', $contexts)) {
/** @var Account $object */
$found = true;
} elseif (in_array('memberdao', $contexts)) {
/** @var Adherent $object */
$found = true;
} elseif (in_array('adherent_typedao', $contexts)) {
/** @var AdherentType $object */
$found = true;
} elseif (in_array('ticketdao', $contexts)) {
/** @var Ticket $object */
$found = true;
} elseif (in_array('projectdao', $contexts)) {
/** @var Project $object */
$found = true;
Expand Down
11 changes: 6 additions & 5 deletions lib/easytooltip.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,17 @@ function easytooltipAdminPrepareHead()
$head[$h][1] = $langs->trans("Settings");
$head[$h][2] = 'settings';
$h++;
$sql = 'SELECT rowid, name, value FROM ' . MAIN_DB_PREFIX . 'const WHERE name LIKE "EASYTOOLTIP_%_' . $conf->entity . '%" ORDER by name';
$sql = 'SELECT rowid, name, value FROM ' . MAIN_DB_PREFIX . 'const WHERE name LIKE "EASYTOOLTIP_%_' . $conf->entity . '_%" ORDER by name';

$resql = $db->query($sql);
$modules = [];
while ($resql && $obj = $db->fetch_object($resql)) {
$names = explode('_', $obj->name);
if (!isset($modules[$names[1]])) {
$modules[$names[1]] = 0;
$names = explode('_' . $conf->entity . '_', $obj->name);
$name = str_replace('EASYTOOLTIP_', '', $names[0]);
if (!isset($modules[$name])) {
$modules[$name] = 0;
}
$modules[$names[1]]++;
$modules[$name]++;
}
foreach ($modules as $key => $value) {
$head[$h][0] = dol_buildpath("/easytooltip/admin/setup.php?module=" . $key, 1);
Expand Down

0 comments on commit 4e87965

Please sign in to comment.