Skip to content

Commit

Permalink
Merge pull request #32464 from FHenry/20_fix_php8_warning
Browse files Browse the repository at this point in the history
FIX: warning in agenda when user have no color and AGENDA_NO_TRANSPARENT_ON_NOT_BUSY=1
  • Loading branch information
eldy authored Dec 26, 2024
2 parents 885235d + 3571e64 commit 5cc44e3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions htdocs/comm/action/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
// Load object
if ($id > 0 && $action != 'add') {
$ret = $object->fetch($id);
$ret1 = 0;
if ($ret > 0) {
$ret = $object->fetch_optionals();
$ret1 = $object->fetch_userassigned();
Expand Down
13 changes: 9 additions & 4 deletions htdocs/comm/action/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -1965,9 +1965,14 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$nextindextouse++; // Prepare to use next color
}
}
//print '|'.($color).'='.($idusertouse?$idusertouse:0).'='.$colorindex.'<br>';
// Define color // @suppress-next-line PhanPluginPrintfIncompatibleArgumentType
$color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
if (isset($theme_datacolor[$colorindex])) {
$color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
} elseif (getDolGlobalString('THEME_ELDY_BACKBODY')) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$color = colorArrayToHex(explode(',', getDolGlobalString('THEME_ELDY_BACKBODY')));
} else {
$color = "ffffff";
}
}
$cssclass = $cssclass.' eventday_'.$ymd;

Expand Down Expand Up @@ -2339,7 +2344,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
function dol_color_minus($color, $minus, $minusunit = 16)
{
$newcolor = $color;
if ($minusunit == 16) {
if ($minusunit == 16 && is_array($newcolor)) {
$newcolor[0] = dechex(max(min(hexdec($newcolor[0]) - $minus, 15), 0));
$newcolor[2] = dechex(max(min(hexdec($newcolor[2]) - $minus, 15), 0));
$newcolor[4] = dechex(max(min(hexdec($newcolor[4]) - $minus, 15), 0));
Expand Down

0 comments on commit 5cc44e3

Please sign in to comment.