fix: office tip labels no longer warn when the author was deleted

21 of 53 office tips still point to team members who have left (deleted
records), so the backend label read 'name' from null: "Trying to access
array offset on null" in production. TYPO3 10 on PHP 7.4 printed an empty
name silently. The label is now the tip's text, with the author in brackets
only when the team member still exists; a tip record that cannot be found
(e.g. a new one) gives an empty title instead of a warning.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
frommeandClaude Opus 5.5 committed 2026-10-22 15:46:04 +02:00
1 parent 48e049671e
commit ebc9925304
1 file changed
+6 -2
@@ -78,8 +78,12 @@ class LabelService
public function getOfficetipLabel(&$parameters, $parentObject)
{
$officetip = BackendUtility::getRecord('tx_epproducts_domain_model_officetip', $parameters['row']['uid']);
$author = BackendUtility::getRecord('tx_epproducts_domain_model_teammember', $officetip['author']);
$parameters['title'] = sprintf('%s (%s)', substr($officetip['label'], 0, 30), $author['name']);
// Many tips still point to team members who have left (deleted records)
$author = BackendUtility::getRecord('tx_epproducts_domain_model_teammember', (int)($officetip['author'] ?? 0));
$parameters['title'] = substr($officetip['label'] ?? '', 0, 30);
if (!empty($author['name'])) {
$parameters['title'] .= ' (' . $author['name'] . ')';
}
}
/**