Skip to content

Commit

Permalink
Merge pull request Dolibarr#32425 from hregis/fix_19_cannot_convert_i…
Browse files Browse the repository at this point in the history
…f_prov

FIX backport from develop to avoid php warning
  • Loading branch information
eldy authored Dec 19, 2024
2 parents 7185da6 + 0da6e25 commit 8991dcb
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions htdocs/core/ajax/ajaxtooltip.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,40 @@
if (!defined('NOREQUIREAJAX')) {
define('NOREQUIREAJAX', '1');
}
if (!defined('NOHEADERNOFOOTER')) {
define('NOHEADERNOFOOTER', '1');
}

include '../../main.inc.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';

/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/

$id = GETPOST('id', 'aZ09');
$objecttype = GETPOST('objecttype', 'aZ09arobase'); // 'module' or 'myobject@mymodule', 'mymodule_myobject'

$params = array('fromajaxtooltip' => 1);
if (GETPOSTISSET('infologin')) {
$params['infologin'] = GETPOST('infologin', 'int');
$params['infologin'] = GETPOSTINT('infologin');
}
if (GETPOSTISSET('option')) {
$params['option'] = GETPOST('option', 'restricthtml');
}

$element_ref = '';
if (is_numeric($id)) {
$id = (int) $id;
} else {
$element_ref = $id;
$id = 0;
}
// Load object according to $element
$object = fetchObjectByElement($id, $objecttype);
$object = fetchObjectByElement($id, $objecttype, $element_ref);
if (empty($object->element)) {
httponly_accessforbidden('Failed to get object with fetchObjectByElement(id='.$id.', objecttype='.$objecttype.')');
}
Expand Down Expand Up @@ -78,10 +95,11 @@
$html = '';

if (is_object($object)) {
'@phan-var-force CommonObject $object';
if ($object->id > 0 || !empty($object->ref)) {
/** @var CommonObject $object */
$html = $object->getTooltipContent($params);
} elseif ($res == 0) {
} elseif ($id > 0) {
$html = $langs->trans('Deleted');
}
unset($object);
Expand Down

0 comments on commit 8991dcb

Please sign in to comment.