From ea4054b42e5599dcdcd498a516a573427abe9b7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 12 Mar 2024 22:48:12 +0100 Subject: [PATCH] fix warnings --- htdocs/holiday/card.php | 7 +++++-- htdocs/holiday/class/holiday.class.php | 8 ++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 895d96d6966..bf2ff8f4fe4 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -524,8 +524,11 @@ if (empty($reshook)) { } $typeleaves = $object->getTypes(1, -1); - $labeltoshow = (($typeleaves[$object->fk_type]['code'] && $langs->trans($typeleaves[$object->fk_type]['code']) != $typeleaves[$object->fk_type]['code']) ? $langs->trans($typeleaves[$object->fk_type]['code']) : $typeleaves[$object->fk_type]['label']); - + if (empty($typeleaves[$object->fk_type])) { + $labeltoshow = $langs->trans("TypeWasDisabledOrRemoved", $object->fk_type); + } else { + $labeltoshow = (($typeleaves[$object->fk_type]['code'] && $langs->trans($typeleaves[$object->fk_type]['code']) != $typeleaves[$object->fk_type]['code']) ? $langs->trans($typeleaves[$object->fk_type]['code']) : $typeleaves[$object->fk_type]['label']); + } if ($object->halfday == 2) { $starthalfdaykey = "Afternoon"; $endhalfdaykey = "Morning"; diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index c12032028e6..985bb575f0c 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1366,8 +1366,12 @@ class Holiday extends CommonObject // show type for this record only in ajax to not overload lists if (!$nofetch && !empty($this->fk_type)) { $typeleaves = $this->getTypes(1, -1); - $labeltoshow = (($typeleaves[$this->fk_type]['code'] && $langs->trans($typeleaves[$this->fk_type]['code']) != $typeleaves[$this->fk_type]['code']) ? $langs->trans($typeleaves[$this->fk_type]['code']) : $typeleaves[$this->fk_type]['label']); - $datas['type'] = '
'.$langs->trans("Type") . ': ' . (empty($labeltoshow) ? $langs->trans("TypeWasDisabledOrRemoved", $this->fk_type) : $labeltoshow); + if (empty($typeleaves[$this->fk_type])) { + $labeltoshow = $langs->trans("TypeWasDisabledOrRemoved", $this->fk_type); + } else { + $labeltoshow = (($typeleaves[$this->fk_type]['code'] && $langs->trans($typeleaves[$this->fk_type]['code']) != $typeleaves[$this->fk_type]['code']) ? $langs->trans($typeleaves[$this->fk_type]['code']) : $typeleaves[$this->fk_type]['label']); + } + $datas['type'] = '
'.$langs->trans("Type") . ': ' . $labeltoshow; } if (isset($this->halfday) && !empty($this->date_debut) && !empty($this->date_fin)) { $listhalfday = array(