Multi-lingual: Contact Type label is cached regarless of language
To reproduce:
- Enable multi-lingual
- Add a second language
- View a contact record, switch to the other language, then view the contact record again.
Note that the "Contact Type" will always be the same in both languages.
The root of the bug is in CRM/Contact/Page/View/Summary.php
getAllContactTypes
, the cache does not take language into account:
protected static function getAllContactTypes() {
if (!Civi::cache('contactTypes')->has('all')) {
$contactTypes = (array) ContactType::get(FALSE)
->setSelect(['id', 'name', 'label', 'description', 'is_active', 'is_reserved', 'image_URL', 'parent_id', 'parent_id:name', 'parent_id:label'])
->execute()->indexBy('name');
@eileen Would it make sense to add the language to has('all')
? I'm not too familiar with the cache service, and suspect there will be similar issues in other places.