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(