Squashed 'public/legacy/' changes from 5a66316965..b065977c61

b065977c61 SuiteCRM 7.12.5 Release
fd07950be0 Fix #8366 - V8 API Filtering W/ OR Operator Chained Conditions
f8504d0a42 Fix #9445 - More than 10 tabs in a views creates a loop
ec3c758b49 Fix #9451 - Missing duplicate merge filter options in Studio
3739e28428 Fix #9468 - Adding Security Suite subpanels to new custom modules
0742615e61 Fix #9427 - Adding missing help popup help strings in Studio
c79a3a6109 Add accessors for the Results, Query fields in SearchResultsController
a507575097 Fix #4075 - No way to add email signature after adding email template
9b8f5b46b2 Fix #9480 - Slow to load imap mailbox with a million email records
8184b82060 Fixed #2857 - No dynamic refreshing in dashboard
ece5919449 Fix #9508 - Legacy search fields are incorrect size
5699ad47ff Fix #9478 - Update GitHub Templates
37d54ca1ab SuiteCRM 7.12.4 Release
5a7f66f1fc Fix #9482 - Update list of modules to normalize
1807751e16 Fix #9482 - Only save update fields on utf encoding repair
08c5a32e07 Fix #9482 - Add partial bean save
a25efff51f Fix #7842 - Do not reset email addresses list upon saving
4e5b509a30 Add ExtensionManager with static method to compile ext files
77b2940fd9 Fix #9061 - Custom Labels can't be overwritten in Studio
2f40449702 Fix #9496 - Cannot save dropdown values
32c6e4a04b Merge next into suite 8
2812bd315a [Legacy] Fix user wizard finish screen re-direction
9dc1a2f017 [Legacy] User Wizard Styling Fixes
0b91cb9a53 [Legacy] Event Delegates Selector Box Styling Fixes
32d7408e93 [Legacy] Add New Task Modal Styling Fixes
e121b602da [Legacy] Workflow Styling Fixes
86ef0fae66 [Legacy] Projects Resource Panel Styling Fixes
56eb694629 [Legacy] map legacy to front-end user action called wizard
4c7ff07fcc [Legacy] Rescheduler Popup Styling Fixes
1b76260971 [Legacy] Project Gantt Chart Delete Button Styling Fixes
09959f1078 [Legacy] Configuration Settings Styling Fixes
711ded6a70 [Legacy] Notes modules styling fixes
a0aa6affc8 [Legacy] Calls Module Styling Fixes
a468cede8b [Legacy] AdminPanel Border Radius Styling Fixes
bfc8a443b7 [Legacy] Bump version to 8.0.1

git-subtree-dir: public/legacy
git-subtree-split: b065977c6116e68cea907dc099205d0b32ac99f4
This commit is contained in:
Clemente Raposo 2022-03-01 14:37:14 +00:00
parent 588534d022
commit 5fa70e2794
99 changed files with 2083 additions and 288 deletions

View file

@ -43,8 +43,8 @@ if (!defined('sugarEntry') || !sugarEntry) {
die('Not A Valid Entry Point');
}
require_once __DIR__ .'/../../../modules/SchedulersJobs/SchedulersJob.php';
require_once __DIR__ .'/../Batch/BatchJob.php';
require_once __DIR__ . '/../../../modules/SchedulersJobs/SchedulersJob.php';
require_once __DIR__ . '/../Batch/BatchJob.php';
class NormalizeRecords extends BatchJob
@ -110,6 +110,9 @@ class NormalizeRecords extends BatchJob
if (empty($ids)) {
$this->debugLog("No ids found for module $type");
$this->echoOutput($echo, "No ids found for module $type");
$this->echoOutput($echo, "$type 0 records normalized");
$messages[] = "$type 0 records normalized";
$this->debugLog("$type 0 records normalized");
continue;
}
@ -291,17 +294,13 @@ class NormalizeRecords extends BatchJob
protected function setupTracking(): array
{
// Populate the $moduleList variable to target only specific modules
$moduleList = [];
if (empty($moduleList)) {
$moduleList = $GLOBALS["moduleList"];
$moduleList[] = 'Users';
}
$moduleList = $this->getModulesToNormalize();
$tracking = [];
foreach ($moduleList as $module) {
if (empty($GLOBALS["beanList"][$module])){
if (empty($GLOBALS["beanList"][$module])) {
continue;
}
@ -406,8 +405,8 @@ class NormalizeRecords extends BatchJob
$records = $this->getRecordChunk($ids, $type);
foreach ($records as $row) {
$normalized = $this->repairStringValues($row, $fieldList);
if (!$normalized) {
$normalized = $this->repairStringValues($type, $row, $fieldList);
if (empty($normalized)) {
continue;
}
@ -417,7 +416,7 @@ class NormalizeRecords extends BatchJob
$bean->update_modified_by = false;
$bean->processed = true;
$bean->notify_inworkflow = false;
$bean->save(false);
$bean->saveFields($normalized);
$this->debugLog("$type - " . $bean->id . " normalized");
++$i;
if ($i % 100 === 0) {
@ -425,7 +424,7 @@ class NormalizeRecords extends BatchJob
}
}
$messages[] = "$type " . $i . " records normalized";
$result['normalize_count'] = $i;
$result['normalize_count'] = $i;
$this->debugLog("$type " . $i . " records normalized");
$result['messages'] = $messages;
@ -437,14 +436,29 @@ class NormalizeRecords extends BatchJob
* Check and Normalize values from database row
* which exist in the $fieldList array
*
* @param $row
* @param string $type
* @param array $row
* @param array $fieldList
* @return bool
* @return array
*/
protected function repairStringValues(&$row, array $fieldList): bool
protected function repairStringValues(string $type, &$row, array $fieldList): array
{
$normalized = false;
$fieldsToExclude = [
'Users' => [
'user_hash' => true
],
];
$normalized = [];
foreach ($fieldList as $fieldName) {
$exclude = $fieldsToExclude[$type][$fieldName] ?? false;
if ($exclude === true) {
$this->debugLog("Excluded $fieldName");
continue;
}
if (!empty($row[$fieldName])) {
// Check if normalization is required
@ -455,7 +469,7 @@ class NormalizeRecords extends BatchJob
//debugLog("Pre : $row[$fieldName]");
$row[$fieldName] = Normalizer::normalize($row[$fieldName], Normalizer::FORM_C);
//debugLog("Post: $row[$fieldName]");
$normalized = true;
$normalized[] = $fieldName;
}
}
@ -479,6 +493,10 @@ class NormalizeRecords extends BatchJob
$repairableTypes = ['enum', 'longtext', 'name', 'text', 'varchar'];
$varDefFields = $bean->getFieldDefinitions();
if ($type === 'Users') {
$repairableTypes[] = 'user_name';
}
$fieldList = array();
foreach ($varDefFields as $field) {
if (in_array($field['type'], $repairableTypes, true)) {
@ -532,7 +550,7 @@ class NormalizeRecords extends BatchJob
{
global $log;
$log->info("[utf-normalize]" . $string);
$log->info("[utf-normalize] " . $string);
}
/**
@ -542,13 +560,105 @@ class NormalizeRecords extends BatchJob
*/
protected function echoOutput(bool $echo, string $string): void
{
if (empty($echo)){
if (empty($echo)) {
return;
}
echo '<div>' . $string. '</div>';
echo '<div>' . $string . '</div>';
ob_flush();
flush();
}
/**
* @return array|mixed
*/
protected function getModulesToNormalize()
{
$moduleList = [];
if (empty($moduleList)) {
$moduleList = $GLOBALS["moduleList"];
$moduleList[] = 'Users';
}
$modInvisList = $GLOBALS["modInvisList"] ?? [];
$toExlude = [
'Calendar',
'Administration',
'CustomFields',
'Connectors',
'Dropdown',
'Dynamic',
'DynamicFields',
'DynamicLayout',
'EditCustomFields',
'Help',
'Import',
'MySettings',
'EditCustomFields',
'FieldsMetaData',
'UpgradeWizard',
'Trackers',
'Connectors',
'Employees',
'Calendar',
'Sync',
'Versions',
'LabelEditor',
'Roles',
'EmailMarketing',
'OptimisticLock',
'TeamMemberships',
'TeamSets',
'TeamSetModule',
'Audit',
'MailMerge',
'MergeRecords',
'EmailText',
'Schedulers',
'Schedulers_jobs',
'CampaignTrackers',
'CampaignLog',
'EmailMan',
'Groups',
'InboundEmail',
'ACLActions',
'ACLRoles',
'DocumentRevisions',
'ModuleBuilder',
'Alert',
'ResourceCalendar',
'ACL',
'Configurator',
'UserPreferences',
'SavedSearch',
'Studio',
'Connectors',
'SugarFeed',
'EAPM',
'OAuthKeys',
'OAuthTokens',
'AM_TaskTemplates',
'Reminders',
'Reminders_Invitees',
'AOD_IndexEvent',
'AOD_Index',
'AOR_Fields',
'AOR_Charts',
'AOR_Conditions',
'AOS_Line_Item_Groups',
'AOW_Processed',
'Calls_Reschedule',
'OutboundEmailAccounts',
'TemplateSectionLine',
'OAuth2Tokens',
'OAuth2Clients',
];
$modInvisList = array_diff($modInvisList, $toExlude);
$moduleList = array_merge($moduleList, $modInvisList);
return $moduleList;
}
}