Undefined variable in custom default.php and query doesn't work

When i edit an existing company i get this notice