salesagility / SuiteCRM

SuiteCRM - Open source CRM for the world
https://www.suitecrm.com
GNU Affero General Public License v3.0
4.44k stars 2.08k forks source link

Global search error after upgrade #9516

Closed dtosun61 closed 1 year ago

dtosun61 commented 2 years ago

Issue

After upgrade from 7.10.15 to 7.12.4, global search doesn't work some modules like Contacts. There is an error like this;

Error
An unknown error has occurred while performing the search. Contact an administrator if the problem persists. More information available in the logs.

image

image

If i remove Contacts module from settings, it is working good. When i try to do for new fresh installation, it is working good. May be some files missing in upgrade package?

This is log;

`Tue Feb 22 14:03:42 2022 [2430483][134bd9c7-f8ed-de37-4ab0-4b9de86a2a13][FATAL] [ERROR] [SearchThrowableHandler] An unknown error has occurred while performing the search. Tue Feb 22 14:03:42 2022 [2430483][134bd9c7-f8ed-de37-4ab0-4b9de86a2a13][FATAL] [ERROR] [SearchThrowableHandler] TypeError: Return value of SuiteCRM\Search\SearchResults::getRelatedId() must be of the type string, null returned in /var/www/crm/sractivities/lib/Search/SearchResults.php:227 Stack trace:

0 /var/www/crm/sractivities/lib/Search/SearchResults.php(179): SuiteCRM\Search\SearchResults->getRelatedId()

1 /var/www/crm/sractivities/lib/Search/SearchResults.php(162): SuiteCRM\Search\SearchResults->updateObjLinks()

2 /var/www/crm/sractivities/lib/Search/SearchResults.php(145): SuiteCRM\Search\SearchResults->updateFieldDefLinks()

3 /var/www/crm/sractivities/lib/Search/UI/SearchResultsController.php(132): SuiteCRM\Search\SearchResults->getHitsAsBeans()

4 /var/www/crm/sractivities/lib/Search/SearchEngine.php(102): SuiteCRM\Search\UI\SearchResultsController->display()

5 /var/www/crm/sractivities/lib/Search/SearchEngine.php(78): SuiteCRM\Search\SearchEngine->displayResults()

6 /var/www/crm/sractivities/lib/Search/SearchWrapper.php(94): SuiteCRM\Search\SearchEngine->searchAndDisplay()

7 /var/www/crm/sractivities/modules/Home/Search.php(50): SuiteCRM\Search\SearchWrapper::searchAndDisplay()

8 /var/www/crm/sractivities/modules/Home/UnifiedSearch.php(41): require_once('/var/www/crm/sr...')

9 /var/www/crm/sractivities/include/MVC/View/SugarView.php(823): include_once('/var/www/crm/sr...')

10 /var/www/crm/sractivities/include/MVC/View/views/view.classic.php(72): SugarView->includeClassicFile()

11 /var/www/crm/sractivities/include/MVC/View/SugarView.php(210): ViewClassic->display()

12 /var/www/crm/sractivities/include/MVC/Controller/SugarController.php(432): SugarView->process()

13 /var/www/crm/sractivities/include/MVC/Controller/SugarController.php(363): SugarController->processView()

14 /var/www/crm/sractivities/include/MVC/SugarApplication.php(101): SugarController->execute()

15 /var/www/crm/sractivities/index.php(52): SugarApplication->execute()

16 {main}`

Expected Behavior

It should work for all modules.

Actual Behavior

Possible Fix

Steps to Reproduce

  1. Upgrade your CRM from any version to latest.
  2. Add modules to search settings
  3. Try it with global search
  4. See the result.

Context

Your Environment

johnM2401 commented 2 years ago

Hey @dtosun61

I'm unable to replicate this, i'm afraid

I've upgraded from 7.10.15 to 7.12.4, but I'm still able to search on all modules: image image

Though I have some questions that might help with replicating:

Thanks!

dtosun61 commented 2 years ago

Hello @johnM2401,

These are my answear:

I see you have some custom Modules in the Search Modules Do you know if the Search Functionality works without these custom modules?

Yes i have a custom module but i was tried it with without custom module, same results. It is is working with my custom module. As you see. image

Have you made any customizations to the Contacts Module? (ie: Studio or via Code) If so, there could be something there causing conflict

Yes, i made some customizations to the Contacts Module, but when i delete Contacts module in custom folder, it is same results.

Does your CRM have Elasticsearch enabled? The error messages in your screenshot appear to be associated to the label: LBL_ELASTIC_SEARCH_EXCEPTION_DEFAULT (Though this message very well could be used outside of Elasticsearch, for general error-displaying to users)

No, My CRM have not Elasticsearch enabled. It is already disabled. image

Do you have this searching issue when using strictly non-utf8 data? (for example, Searching "Test" for a contact named "Test Test" )

When i search "test" it doesn't give me any result. But when i search "Şule", it is giving error. "Şule" has Turkish character. But Turkish Character search doesn't work with Contacts. It is working good for others module. image

image

image

Thanks!

dtosun61 commented 2 years ago

Hello,

I controlled my Contacts module for customization, i added two custom fields in vardefs.php. But it was working good before update :( Removed them and tried again, same results.

johnM2401 commented 2 years ago

Hey @dtosun61

Thank you for your responses!



The custom changes very well could still have been on the CRM instance, in auto-generated/cache files, which should be updated by a Quick R&R

It may be worth trying this, if you hadn't performed this initially



"Quick Repair and Rebuild"

AND

"Repair UTF Encoding"

Found in Admin->Repair?

If not, I would recommend running these

(However, as the Repair UTF Encoding will make changes to UTF8-data, I would recommend taking a backup of your DB just incase you wish to revert the change)



Is it the Standard Firstname/Lastname fields?

Or are these custom fields that contain Turkish characters?

Thank you again!

dtosun61 commented 2 years ago

Hello @johnM2401,

Thank you for your support. My filters are working good. I have issue just for global search :(

image

image image image

johnM2401 commented 2 years ago

Hey @dtosun61

Thank you again for your response!

hmmmm I'm still not sure what the issue may be, i'm afraid

We typically recommend:

sudo chmod -R 755 .
sudo chmod -R 775 cache custom modules themes data upload config_override.php
sudo chown -R www-data:www-data 

image

If you could Download & Send that .zip to us, that might help us see if any files are not as they should be

dtosun61 commented 2 years ago

Hello @johnM2401,

Thank you for your support and patience.

johnM2401 commented 2 years ago

Hey @dtosun61

Thank you for your response!



I've unfortunately not yet been able to replicate

However, I did go through a 7.10.15 -> 7.12.4 process, and have grabbed the MD5 generated there c7141e42-ba04-d8c0-c730-622f4cebfa13.zip

This one, from a vanilla 7.10.15->7.12.4 is ~2376 lines, whereas the one from your instance is ~4627 lines

So, I'm curious if there was an issue with the upgrade, given the vast amount of custom changes on your instance

Perhaps there was a conflict somewhere?



First thing to check, Would you be able to run the "Rebuild JS Grouping Files" action in Admin->Repair

And let me know if this resolves any issues?



Then, it would be worth checking if any PHP errors display on-screen, when Global Searching on Contacts

You could do this by either enabling it in your php.ini

Or, adding:

ini_set('display_errors',1);
error_reporting(E_ALL ^ E_STRICT ^ E_NOTICE);

To the index.php file, below the <php tag, and clearing your browser cache

ie:

image

This should display any Errors on-screen, that are not Notices/Strict Standards.

With this enabled, do you see any errors on-screen when Globally Searching with Contacts Enabled?



If not, would it be possible to check the Searching functionality on a fresh 7.12.5, with the same dataset?

This would allow us to narrow down whether or not your issues stem from the Dataset (As there were issues with Searching on UTF8 characters, that were largely resolved as of 7.12.4, this would be good to confirm)

If all is well, you could try adding your Custom Changes to this instance, to see if issues then start to appear



Thank you again for your time and Patience on this!

dtosun61 commented 2 years ago

Hello @johnM2401,

Thank you for your support and patience.

First thing to check, Would you be able to run the "Rebuild JS Grouping Files" action in Admin->Repair And let me know if this resolves any issues?

Yes i did it. But the problem is continue.

With this enabled, do you see any errors on-screen when Globally Searching with Contacts Enabled?

There is an fatal error and warning.

image

When i check the Searching functionality on a fresh 7.12.5, with the same dataset, it is working good.

Can i replace Search functionality files with working ones? If yes, which files should i replace. Let me know please.

dtosun61 commented 2 years ago

The problem was fixed after recheck and improve my custom folder.

dtosun61 commented 2 years ago

Hello,

I found the problem. When add target list filter to Contacts module, it is occurring.

image

When i remove it, it is working good.

Adding filter like this;

Add the file:

custom/Extension/modules/Contacts/Ext/Vardefs/targetlistfilter.php with content:

<?php
$dictionary['Contact']['fields']['prospect_list_name'] = array (
    'name' => 'prospect_list_name',
    'rname' => 'name',
    'id_name' => 'prospect_list_id',
    'vname' => 'LBL_PROSPECTLIST_NAME',
    'type' => 'relate',
    'link' => 'prospect_lists',
    'table' => 'prospect_lists',
    'isnull' => 'true',
    'module' => 'ProspectLists',
    'dbType' => 'char',
    'len' => '255',
    'source' => 'non-db',
    'duplicate_merge'=> 'disabled',
);

Add the file:

custom/Extension/modules/Contacts/Ext/Language/en_us.targetlistfilter.php with content:

<?php
$mod_strings['LBL_PROSPECTLIST_NAME'] = 'Target List:';

Afterwards, do a Admin / Repair / Quick Repair and Rebuild

Open Studio, module Contacts / Layouts / Filter The filter field Target List is now available in the Hidden list and can be added to the Quick Filter and the Advance Filter layout.

rj2Skipper commented 2 years ago

I do confirm this issue.

I tested with 3 installations:

Global-Search Test results:

ciao Ralf

johnM2401 commented 2 years ago

Hey @dtosun61, @rj2Skipper

Thank you both for your additional info here, I've given this another try by making the suggested customization on 7.11.10, and upgrading to 7.12.5

I was able to search without issues on 7.11.10, but the global search fails on 7.12.5

I've marked this as a bug now

Thank you again for your assistance!