fix warnings

This commit is contained in:
Frédéric France 2024-03-13 21:33:51 +01:00
parent 345edd56fb
commit 93d2cad7fe

View File

@ -6,6 +6,7 @@
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -50,6 +51,8 @@ if (GETPOST('actioncode', 'array')) {
$actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
}
$id = GETPOSTINT('userid') ? GETPOSTINT('userid') : GETPOSTINT('id');
$ref = GETPOST('ref', 'alpha');
$search_rowid = GETPOST('search_rowid');
$search_agenda_label = GETPOST('search_agenda_label');
@ -74,6 +77,9 @@ if (!$sortorder) {
$object = new User($db);
if ($id > 0 || !empty($ref)) {
$result = $object->fetch($id, $ref, '', 1);
if ($result <= 0) {
accessforbidden('User not found');
}
$object->getrights();
}
@ -81,18 +87,17 @@ if ($id > 0 || !empty($ref)) {
$hookmanager->initHooks(array('agendathirdparty', 'globalcard'));
// Security check
$userid = GETPOSTINT('userid') ? GETPOSTINT('userid') : GETPOSTINT('id');
if ($user->id) {
$userId = $user->id;
$id = $user->id;
}
$result = $object->fetch($userid);
if ($result <= 0) {
accessforbidden('User not found');
// Security check
$socid = 0;
if ($user->socid > 0) {
$socid = $user->socid;
}
$result = restrictedArea($user, 'user', $userId, '&user');
$feature2 = (($socid && $user->hasRight('user', 'self', 'creer')) ? '' : 'user');
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
/*
@ -153,7 +158,7 @@ $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->tra
dol_banner_tab($object, 'id', $linkback, $user->hasRight('user', 'user', 'lire') || $user->admin, 'rowid', 'ref', $morehtmlref);
$object->info($userid);
$object->info($id);
print '<div class="fichecenter">';
@ -196,7 +201,7 @@ if (isModEnabled('agenda')) {
if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allaactions', 'read'))) {
print '<br>';
$param = '&userid='.urlencode((string) ($userid));
$param = '&userid='.urlencode((string) ($id));
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
@ -208,7 +213,7 @@ if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') ||
// Try to know count of actioncomm from cache
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
$cachekey = 'count_events_user_'.$object->id;
//$nbEvent = dol_getcache($cachekey); // TODO Add nb into badge in menu so we can get it from cache also here
$nbEvent = dol_getcache($cachekey); // TODO Add nb into badge in menu so we can get it from cache also here
$titlelist = $langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>' : '');
if (!empty($conf->dol_optimize_smallscreen)) {