Fix undef vars 3

To remove PHP8 warnings
This commit is contained in:
GurvanKervern 2021-08-25 18:02:57 +08:00
parent 07dd9d90f5
commit d34e44e55c

View File

@ -470,6 +470,9 @@ $newcardbutton = '';
if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) {
$tmpforcreatebutton = dol_getdate(dol_now(), true);
if(empty($newparam)) {
$newparam = '';
}
$newparam .= '&month='.urlencode(str_pad($month, 2, "0", STR_PAD_LEFT)).'&year='.urlencode($tmpforcreatebutton['year']);
if ($begin_h !== '') {
$newparam .= '&begin_h='.urlencode($begin_h);
@ -489,6 +492,9 @@ if ($user->rights->agenda->myactions->create || $user->rights->agenda->allaction
$newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')));
}
if(empty($num)) {
$num = '';
}
print_barre_liste($langs->trans("Agenda"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, -1, 'object_action', 0, $nav.'<span class="marginleftonly"></span>'.$newcardbutton, '', $limit, 1, 0, 1, $viewmode);
$link = '';
@ -505,6 +511,9 @@ $s = $newtitle;
print $s;
print '<div class="liste_titre liste_titre_bydiv centpercent">';
if(empty($search_status)) {
$search_status = '';
}
print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid);
print '</div>';
@ -1378,10 +1387,10 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
$ids1 = '';
$ids2 = '';
if (is_array($cases1[$h]) && count($cases1[$h]) && array_keys($cases1[$h])) {
if (!empty($cases1[$h]) && is_array($cases1[$h]) && count($cases1[$h]) && array_keys($cases1[$h])) {
$ids1 = join(',', array_keys($cases1[$h]));
}
if (is_array($cases2[$h]) && count($cases2[$h]) && array_keys($cases2[$h])) {
if (!empty($cases2[$h]) && is_array($cases2[$h]) && count($cases2[$h]) && array_keys($cases2[$h])) {
$ids2 = join(',', array_keys($cases2[$h]));
}
@ -1390,7 +1399,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
} else {
echo '<td class="'.$style.' cal_peruser'.($var ? ' cal_impair '.$style.'_impair' : '').'">';
}
if (is_array($cases1[$h]) && count($cases1[$h]) == 1) { // only 1 event
if (!empty($cases1[$h]) && is_array($cases1[$h]) && count($cases1[$h]) == 1) { // only 1 event
$output = array_slice($cases1[$h], 0, 1);
$title1 = $langs->trans("Ref").' '.$ids1.($title1 ? ' - '.$title1 : '');
if ($output[0]['string']) {
@ -1399,12 +1408,12 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
if ($output[0]['color']) {
$color1 = $output[0]['color'];
}
} elseif (is_array($cases1[$h]) && count($cases1[$h]) > 1) {
} elseif (!empty($cases1[$h]) && is_array($cases1[$h]) && count($cases1[$h]) > 1) {
$title1 = $langs->trans("Ref").' '.$ids1.($title1 ? ' - '.$title1 : '');
$color1 = '222222';
}
if (is_array($cases2[$h]) && count($cases2[$h]) == 1) { // only 1 event
if (!empty($cases2[$h]) && is_array($cases2[$h]) && count($cases2[$h]) == 1) { // only 1 event
$output = array_slice($cases2[$h], 0, 1);
$title2 = $langs->trans("Ref").' '.$ids2.($title2 ? ' - '.$title2 : '');
if ($output[0]['string']) {
@ -1413,7 +1422,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
if ($output[0]['color']) {
$color2 = $output[0]['color'];
}
} elseif (is_array($cases2[$h]) && count($cases2[$h]) > 1) {
} elseif (!empty($cases2[$h]) && is_array($cases2[$h]) && count($cases2[$h]) > 1) {
$title2 = $langs->trans("Ref").' '.$ids2.($title2 ? ' - '.$title2 : '');
$color2 = '222222';
}