mirror of
https://github.com/SuiteCRM/SuiteCRM.git
synced 2026-03-02 19:16:58 -05:00
Global Search in v4 Service Fails for Custom Fields #2831
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#2831
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 @seancunningham on GitHub (Mar 8, 2018).
We are using a third party service called Integromat to facilitate nightly sync's between our service and our SuiteCRM instance using the V4 controller. When trying to execute a global search on a custom variable that has been created, it appears the SQL query has the original module's table name in the where clause for the search.
Expected Behavior
I would expect this search to perform correctly without 500 errors.
Actual Behavior
This search returns a 500 to the service, due to an error with the database query. Relevant log lines are below from both the suitecrm.log and php_error.log files.
Custom Variable Definition:
$dictionary['Accounts']['fields']['voi_c'] = array(
'name' => 'voi_c',
'vname' => 'LBL_VOI',
'labelValue' => 'Organization ID',
'type' => 'varchar',
'len' => 50,
'unified_search' => true,
'source' => 'non-db',
);
SuiteCRM Log:
[FATAL] Error running count query for Account List: Query Failed: SELECT count(*) c FROM accounts LEFT JOIN accounts_cstm ON accounts.id = accounts_cstm.id_c LEFT JOIN users jt0 ON accounts.modified_user_id=jt0.id AND jt0.deleted=0
AND jt0.deleted=0 LEFT JOIN users jt1 ON accounts.created_by=jt1.id AND jt1.deleted=0
AND jt1.deleted=0 LEFT JOIN users jt2 ON accounts.assigned_user_id=jt2.id AND jt2.deleted=0
AND jt2.deleted=0 LEFT JOIN accounts jt3 ON accounts.parent_id=jt3.id AND jt3.deleted=0
AND jt3.deleted=0 LEFT JOIN campaigns jt4 ON accounts.campaign_id=jt4.id AND jt4.deleted=0
AND jt4.deleted=0 where (accounts.voi_c LIKE '%xxx%') AND accounts.deleted=0: MySQL error 1054: Unknown column 'accounts.voi_c' in 'where clause'
PHP Error Log:
PHP Fatal error: Uncaught Exception: Database failure. Please refer to suitecrm.log for details. in /var/www/html/suitecrm/include/utils.php:1773
Stack trace:
#0 /var/www/html/suitecrm/include/database/DBManager.php(353): sugar_die('Database failur...')
#1 /var/www/html/suitecrm/include/database/DBManager.php(328): DBManager->registerError('Error running c...', 'Error running c...', true)
#2 /var/www/html/suitecrm/include/database/MysqliManager.php(167): DBManager->checkError('Error running c...', true)
#3 /var/www/html/suitecrm/data/SugarBean.php(4189): MysqliManager->query(' SELECT count(*...', true, 'Error running c...')
#4 /var/www/html/suitecrm/service/v4/SugarWebServiceUtilv4.php(109): SugarBean->process_list_query(' SELECT accoun...', 0, -1, 20, 'accounts.voi_c ...')
#5 /var/www/html/suitecrm/service/v4/SugarWebServiceImplv4.php(306): SugarWebServiceUtilv4->get_data_list(Object(Account), 'voi_c ASC', 'accounts.voi_c ...', 0, -1, -1, 0, false)
#6 /var/www/html/suitecrm/service/core/REST/SugarRestJSON.php(91): SugarWebS in /var/www/html/suitecrm/include/utils.php on line 1773
Possible Fix
I believe the where clause in the v4 php controller is skipping considering whether the queried field is a custom one or not. Unsure of code fix at the moment.
Steps to Reproduce
Your Environment
@QuickCRM commented on GitHub (Mar 9, 2018):
Hi,
I'm not sure it's an error in the REST API as you have:
'source' => 'non-db',
in your field definition.
@seancunningham commented on GitHub (Mar 9, 2018):
I actually tried with and without the non-db option to see if that was the key.
@QuickCRM commented on GitHub (Mar 10, 2018):
We use custom fields built with Studio
('source' => 'custom_fields’,)
and global_search works perfectly well with v4/v4_1 REST API (even though we have extended it to support Security Suite)
—
support@quickcrm.fr
www.quickcrm.fr/mobile http://www.quickcrm.fr/mobile
Visit our FAQ http://www.quickcrm.fr/mobile/en/content/16-faq
@seancunningham commented on GitHub (Mar 20, 2018):
I changed the source to 'custom_fields' and, unfortunately, continued to experience the issue. I believe there may be some other configuration issue causing this issue.
Could you provide an example of a custom variable configuration for me? As well as confirm you are on the latest release of SuiteCRM? Many thanks
@samus-aran commented on GitHub (Aug 2, 2018):
@seancunningham Has this been resolved?
Can you confirm that the custom field is indeed in the database? Sounds like the vardefs are not being picked up correctly.
Have you done a repair and re-build and the accounts_cstm is definitely there? How are you querying the API itself passing in this custom field?
Some more info would be much appreciated.
@Dillon-Brown commented on GitHub (Apr 10, 2019):
Closed due to inactivity