Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #471 - accented characters not displayed correctly #514

Merged
merged 6 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/backend/Data/LegacyHandler/RecordMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public function mapRecords(array $listData, ?array $pageData = []): array

$moduleName = $data['module_name'] ?? '';
$id = $data['id'] ?? '';
$data['name'] = html_entity_decode($data['name'] ?? '', ENT_QUOTES);
if (!empty($moduleName)) {
$moduleName = $this->moduleNameMapper->toFrontEnd($moduleName);
}
Expand Down
13 changes: 13 additions & 0 deletions core/backend/Languages/LegacyHandler/AppListStringsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public function getAppListStrings(string $language): ?AppListStrings
}

$appListStringsArray = return_app_list_strings_language($language);
$appListStringsArray = $this->decodeLabels($appListStringsArray);

if (empty($appListStringsArray)) {
throw new ItemNotFoundException(self::MSG_LANGUAGE_NOT_FOUND . "'$language'");
Expand All @@ -79,4 +80,16 @@ public function getAppListStrings(string $language): ?AppListStrings

return $appListStrings;
}

protected function decodeLabels(array $appListStringsArray): array
{
foreach($appListStringsArray as $key => $string){
if (!is_array($string)) {
$string = html_entity_decode($string ?? '', ENT_QUOTES);
}
$appListStringsArray[$key] = $string;
}

return $appListStringsArray;
}
}
15 changes: 15 additions & 0 deletions core/backend/Languages/LegacyHandler/AppStringsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ public function getAppStrings(string $language): ?AppStrings

$appStringsArray = return_application_language($language);

$appStringsArray = $this->decodeLabels($appStringsArray);

if (empty($appStringsArray)) {
throw new ItemNotFoundException(self::MSG_LANGUAGE_NOT_FOUND . "'$language'");
}
Expand Down Expand Up @@ -268,4 +270,17 @@ protected function injectLicense(array &$appStringsArray): void
$appStringsArray['SUITE8_LICENSE_CONTENT'] = '<pre>' . $license . '</pre>';
}
}


protected function decodeLabels(array $appStringsArray): array
{
foreach($appStringsArray as $key => $string){
if (!is_array($string)) {
$string = html_entity_decode($string ?? '', ENT_QUOTES);
}
$appStringsArray[$key] = $string;
}

return $appStringsArray;
}
}
15 changes: 14 additions & 1 deletion core/backend/Languages/LegacyHandler/ModStringsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ public function getModStrings(string $language): ?ModStrings
$allModStringsArray = [];
foreach ($modules as $module) {
$frontendName = $this->moduleNameMapper->toFrontEnd($module);
$moduleStrings = return_module_language($language, $module);
$moduleStrings = return_module_language($language, $module) ?? [];
$moduleStrings = $this->decodeLabels($moduleStrings);
if (!empty($moduleStrings)) {
$moduleStrings = $this->removeEndingColon($moduleStrings);
}
Expand Down Expand Up @@ -156,4 +157,16 @@ protected function removeEndingColon(array $stringArray): array

return $stringArray;
}

protected function decodeLabels(array $moduleStrings): array
{
foreach($moduleStrings as $key => $string){
if (!is_array($string)) {
$string = html_entity_decode($string ?? '', ENT_QUOTES);
}
$moduleStrings[$key] = $string;
}

return $moduleStrings;
}
}
2 changes: 1 addition & 1 deletion core/backend/Navbar/LegacyHandler/NavbarHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ protected function setLinks(array $legacyArray): array

$mappedLink = [
'name' => $link[0] ?? '',
'labelKey' => $link[1] ?? '',
'labelKey' => html_entity_decode($link[1] ?? '', ENT_QUOTES),
'actionLabelKey' => '',
'url' => $path,
'icon' => '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,6 @@ public function toBean(SugarBean $bean, array &$container, string $name, string
$container[$idFieldName] = $id;
}

$container[$name] = $value;
$container[$name] = html_entity_decode($value, ENT_QUOTES);
}
}