Skip to content

Commit

Permalink
fix: warning in monthly agenda when user have no color and AGENDA_NO_…
Browse files Browse the repository at this point in the history
…TRANSPARENT_ON_NOT_BUSY=1
  • Loading branch information
FHenry committed Dec 24, 2024
1 parent 885235d commit d4edb47
Showing 1 changed file with 9 additions and 4 deletions.
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 (!empty(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 d4edb47

Please sign in to comment.