forked from Wavyzz/dolibarr
Merge pull request #32425 from hregis/fix_19_cannot_convert_if_prov
FIX backport from develop to avoid php warning
This commit is contained in:
@@ -34,23 +34,40 @@ if (!defined('NOREQUIREHTML')) {
|
||||
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.')');
|
||||
}
|
||||
@@ -78,10 +95,11 @@ top_httphead();
|
||||
$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);
|
||||
|
||||
Reference in New Issue
Block a user