mirror of
https://github.com/SuiteCRM/SuiteCRM.git
synced 2026-03-02 19:16:58 -05:00
Case Vardefs incomplete during Elasticsearch index process #4955
Labels
No labels
Area: API
Area: Campaigns
Area: Cases
Area: Clean Up
Area: Clean Up: Performance
Area: Dashlets
Area: Databases
Area: Developer Tools
Area: Elasticsearch
Area: Elasticsearch
Area: Emails
Area: Emails:Campaigns
Area: Emails:Cases
Area: Emails:Compose
Area: Emails:Config
Area: Emails:Templates
Area: Environment
Area: Installation
Area: Language
Area: Mobile
Area: Module
Area: PDFs
Area: PHP8
Area: Reports
Area: Studio
Area: Styling
Area: Upgrading
Area: Workflow
Area:Activity Stream
Area:Calls
Area:Import
Area:Projects
Area:Search
Area:Surveys
Area:Themes
Area:Users
Branch:Hotfix
Good First Issue
Hacktoberfest
Help Wanted
PR:Community Contribution
PR:Type:Enhancement
Priority:Critical
Priority:Important
Priority:Moderate
Severity: Major
Severity: Minor
Severity: Moderate
Status: Requires Code Review
Status: Requires Updates
Status: Stale
Status: Team Investigating
Status:Assessed
Status:Fix Proposed
Status:Needs Assessed
Status:Requires Automated Tests
Type: Bug
Type:Deprecated
Type:Discussion
Type:Duplicate
Type:Invalid
Type:Question
Type:Suggestion
Type:Suggestion
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/SuiteCRM-SuiteCRM#4955
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @simonr44 on GitHub (Feb 16, 2023).
Issue
During the Elasticsearch indexing process, the enabled modules are looped through and when Cases are enabled, errors are generated such as undefined "type" when building the where query for relations that are stored in the database
fields_meta_datatable by default: e.g.jjwg_maps_geocode_status_cExpected Behavior
Case vardef's should be consistent, however loaded.
Actual Behavior
When the Case field definitions are first loaded the object name is set to "Case"
SugarBean.php Line 457
This loads the vardefs from the following file:
cache/modules/Cases/Casevardefs.phpWhen subsequent calls are made to
VardefManager.php, originating from a relationship field, the object name is set to "aCase"The "aCase" value comes from a call to
getBeanNamefunction in theBeanFactoryas this returns the value fromglobal $beanListThis tries and fails to load the following file:
cache/modules/Cases/aCasevardefs.phpAs the above fails
VardefManager::refreshVardefsis called using the incorrect object name.This ultimately leads to a new set of Vardefs being built and used. These are complete from a file perspective but do not contain the field definitions from the "fields_meta_data" table.
Possible Fix
There is some code in VardefManager.php around lines 288:293 which tries to load the object name from the Bean. But this is returning the true object name, rather than the one defined in the Case Bean file.
One option would be to ensure the correct name is used specifically for vardefs:
That's not an especially great fix and it may be worth further investigation into the different scenarios around "Case" and "aCase" and how they tie back to the Case bean defined object name.
Calls through the UI seem to use "Case" as the object name, retrieved from the
global $objectListbut this is empty in the above scenarioSteps to Reproduce
Your Environment
@SuiteBot commented on GitHub (Feb 16, 2023):
This issue has been mentioned on SuiteCRM. There might be relevant details there:
https://community.suitecrm.com/t/improved-elasticsearch-query-building/87273/6