fix phpstan branch 21

This commit is contained in:
Frédéric France 2025-01-25 09:04:43 +01:00
parent 2efc4a7a49
commit 45042afe4b
No known key found for this signature in database
GPG Key ID: CE25B0B7B53B9177
3 changed files with 24 additions and 21 deletions

View File

@ -7,7 +7,7 @@
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Open-DSI <support@open-dsi.fr>
* Copyright (C) 2021-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2021-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@ -798,7 +798,7 @@ if (!empty($actioncode)) {
$sql .= " AND ca.type != 'systemauto'";
} elseif ($actioncode == 'AC_ALL_AUTO') {
$sql .= " AND ca.type = 'systemauto'";
} elseif (!empty($actioncode) && $actioncode !== '-1') {
} elseif (/* !empty($actioncode) && */ $actioncode !== '-1') {
if (is_array($actioncode)) {
$sql .= " AND ca.code IN (".$db->sanitize("'".implode("','", $actioncode)."'", 1).")";
} else {

View File

@ -5,7 +5,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2023 Florian HENRY <florian.henry@scopen.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
@ -60,7 +60,7 @@ $filtert = GETPOSTINT("search_filtert", 3) ? GETPOSTINT("search_filtert", 3) : G
$usergroup = GETPOSTINT("search_usergroup", 3) ? GETPOSTINT("search_usergroup", 3) : GETPOSTINT("usergroup", 3);
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
//$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
$showbirthday = 0;
$showbirthday = getDolGlobalInt('AGENDA_ENABLE_SHOW_BIRTHDAY_PER_USER'); // disabled by default
// If no choice done on calendar owner (like on left menu link "Agenda"), we filter on current user by default.
/*if (empty($filtert) && !getDolGlobalString('AGENDA_ALL_CALENDARS')) {
@ -465,31 +465,31 @@ $massactionbutton = '';
$viewmode = '<div class="navmode inline-block">';
$viewmode .= '<a class="btnTitle'.($mode == 'list' ? ' btnTitleSelected' : '').' reposition" href="'.DOL_URL_ROOT.'/comm/action/list.php?mode=show_list&restore_lastsearch_values=1'.$paramnoactionodate.'">';
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/list.php?mode=show_list&restore_lastsearch_values=1'.$paramnoactionodate.'">';
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
$viewmode .= img_picto($langs->trans("List"), 'object_calendarlist', 'class="imgforviewmode pictoactionview block"');
//$viewmode .= '</span>';
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans("ViewList").'</span></a>';
$viewmode .= '<a class="btnTitle'.($mode == 'show_month' ? ' btnTitleSelected' : '').' reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_month&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_month&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
$viewmode .= img_picto($langs->trans("ViewCal"), 'object_calendarmonth', 'class="pictoactionview block"');
//$viewmode .= '</span>';
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans("ViewCal").'</span></a>';
$viewmode .= '<a class="btnTitle'.($mode == 'show_week' ? ' btnTitleSelected' : '').' reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_week&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_week&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
$viewmode .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview block"');
//$viewmode .= '</span>';
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans("ViewWeek").'</span></a>';
$viewmode .= '<a class="btnTitle'.($mode == 'show_day' ? ' btnTitleSelected' : '').' reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_day&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_day&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
$viewmode .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview block"');
//$viewmode .= '</span>';
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans("ViewDay").'</span></a>';
$viewmode .= '<a class="btnTitle'.($mode == 'show_peruser' ? ' btnTitleSelected' : '').' reposition marginrightonly" href="'.DOL_URL_ROOT.'/comm/action/peruser.php?mode=show_peruser&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
$viewmode .= '<a class="btnTitle btnTitleSelected reposition marginrightonly" href="'.DOL_URL_ROOT.'/comm/action/peruser.php?mode=show_peruser&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
$viewmode .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview block"');
//$viewmode .= '</span>';
@ -531,7 +531,7 @@ if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda'
$urltocreateaction = DOL_URL_ROOT.'/comm/action/card.php?action=create';
$urltocreateaction .= '&apyear='.$tmpforcreatebutton['year'].'&apmonth='.$tmpforcreatebutton['mon'].'&apday='.$tmpforcreatebutton['mday'].'&aphour='.$tmpforcreatebutton['hours'].'&apmin='.$tmpforcreatebutton['minutes'];
$urltocreateaction .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : ''));
$urltocreateaction .= '&backtopage='.urlencode($_SERVER["PHP_SELF"] . $newparam);
$newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', $urltocreateaction);
}
@ -602,7 +602,7 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on
}
// External calendars
if (is_array($showextcals) && count($showextcals) > 0) {
if (count($showextcals) > 0) {
foreach ($showextcals as $val) {
$htmlname = md5($val['name']); // not used for security purpose, only to get a string with no special char
@ -726,7 +726,7 @@ if (!empty($actioncode)) {
$sql .= " AND ca.type != 'systemauto'";
} elseif ($actioncode == 'AC_ALL_AUTO') {
$sql .= " AND ca.type = 'systemauto'";
} elseif (!empty($actioncode) && $actioncode !== '-1') {
} elseif (/* !empty($actioncode) && */ $actioncode !== '-1') {
if (is_array($actioncode)) {
$sql .= " AND ca.code IN (".$db->sanitize("'".implode("','", $actioncode)."'", 1).")";
} else {
@ -1197,9 +1197,9 @@ if (count($listofextcals)) {
$datecurstart = dol_stringtotime($icalevent['DTSTART;VALUE=DATE'], 1);
$datecurend = dol_stringtotime($icalevent['DTEND;VALUE=DATE'], 1) - 1; // We remove one second to get last second of day
} elseif (is_array($icalevent['DTSTART']) && !empty($icalevent['DTSTART']['unixtime'])) {
$datecurstart = $icalevent['DTSTART']['unixtime'];
$datecurstart = $icalevent['DTSTART']['unixtime']; // can't be empty
$datecurend = $icalevent['DTEND']['unixtime'];
if (!empty($ical->cal['DAYLIGHT']['DTSTART']) && $datecurstart) {
if (!empty($ical->cal['DAYLIGHT']['DTSTART']) /* && $datecurstart */) {
//var_dump($ical->cal);
$tmpcurstart = $datecurstart;
$tmpcurend = $datecurend;
@ -1292,6 +1292,8 @@ if (count($listofextcals)) {
// Create a new object action
$event = new ActionComm($db);
$addevent = false;
$datestart = null;
$dateend = null;
if (isset($icalevent['DTSTART;VALUE=DATE'])) { // fullday event
// For full day events, date are also GMT but they won't but converted using tz during output
$datestart = dol_stringtotime($icalevent['DTSTART;VALUE=DATE'], 1);
@ -1343,6 +1345,7 @@ if (count($listofextcals)) {
if ($addevent) {
$event->id = $icalevent['UID'];
$event->ref = $event->id;
$userstatic = new User($db);
$userId = $userstatic->findUserIdByEmail($namecal);
if (!empty($userId) && $userId > 0) {
$event->userassigned[$userId] = $userId;
@ -1754,7 +1757,7 @@ if (getDolGlobalString('AGENDA_USE_EVENT_TYPE') && getDolGlobalString('AGENDA_US
print '<br>'.$langs->trans("Legend").': <br>';
foreach ($colorsbytype as $code => $color) {
if ($color) {
print '<div style="float: left; padding: 2px; margin-right: 6px;"><div style="'.($color ? 'background: #'.$color.';' : '').'width:16px; float: left; margin-right: 4px;">&nbsp;</div>';
print '<div style="float: left; padding: 2px; margin-right: 6px;"><div style="background: #'.$color.'; width:16px; float: left; margin-right: 4px;">&nbsp;</div>';
print $langs->trans("Action".$code) != "Action".$code ? $langs->trans("Action".$code) : $labelbytype[$code];
//print $code;
print '</div>';
@ -2405,7 +2408,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
if ($style1 == 'peruser_notbusy') {
print 'style="border: 1px solid #'.($color1 ? $color1 : "888").' !important" ';
} elseif ($color1) {
print($color1 ? 'style="background: #'.$color1.';"' : '');
print 'style="background: #'.$color1.'; "';
}
print 'class="';
print($style1 ? $style1.' ' : '');
@ -2417,7 +2420,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
if ($style2 == 'peruser_notbusy') {
print 'style="border: 1px solid #'.($color2 ? $color2 : "888").' !important" ';
} elseif ($color2) {
print($color2 ? 'style="background: #'.$color2.';"' : '');
print 'style="background: #'.$color2.'; "';
}
print 'class="';
print($style2 ? $style2.' ' : '');
@ -2429,7 +2432,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
if ($style3 == 'peruser_notbusy') {
print 'style="border: 1px solid #'.($color3 ? $color3 : "888").' !important" ';
} elseif ($color3) {
print($color3 ? 'style="background: #'.$color3.';"' : '');
print 'style="background: #'.$color3.'; "';
}
print 'class="';
print($style3 ? $style3.' ' : '');
@ -2441,7 +2444,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
if ($style4 == 'peruser_notbusy') {
print 'style="border: 1px solid #'.($color4 ? $color4 : "888").' !important" ';
} elseif ($color4) {
print($color4 ? 'style="background: #'.$color4.';"' : '');
print 'style="background: #'.$color4.'; "';
}
print 'class="';
print($style4 ? $style4.' ' : '');

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2022-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2022-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@ -31,7 +31,7 @@
*
* @param Form $form Form object
* @param int $canedit Can edit filter fields
* @param int $status Status
* @param string $status Status see FormActions::form_select_status_action
* @param int $year Year
* @param int $month Month
* @param int $day Day