salesagility / SuiteCRM-Core

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

Folder Selection for Group Inbound email Folders not working in user Profile #277

Open pstevens71 opened 1 year ago

pstevens71 commented 1 year ago

Issue

There are a bunch of issues surrounding group email accounts. I've proposed some fixes already. First, group email accounts do not get marked as "is_group" = 1 currently. I proposed a fix in 7.12 branch for this that should still be applicable in Core.

Also, when a group email is deleted, the folders do no get marked as "deleted=1". I have proposed a fix for this as well.

However, when group folders are correctly marked in "folders" in the database as is_group =1 they no longer appear on the list of folders in users and admin folder selection in user profile.

When they are NOT marked as "is_group" they go into the JSON array that makes the pick list as "userFolders" like this... "userFolders": [{ "id": "", "name": "--None--", "has_child": 0, "is_group": 0, "selected": false }, { "id": "5d269064-84eb-a6cd-bf75-6478c44c1bea", "name": "INBOX (replypersonal)", "has_child": "1", "is_group": "0", "is_dynamic": "1", "folder_type": "inbound", "created_by": "1", "deleted": "0",................................ When properly marked they go into the JSON like this: "groupFolders": [{ "id": "", "name": "--None--", "has_child": 0, "is_group": 1, "selected": false, "origName": "" }, { "id": "e0e86af8-fac6-8f28-4c90-6478d52d1153", "name": "INBOX (reply2)", "has_child": "1", "is_group": "1", "is_dynamic": "1", "folder_type": "inbound", "created_by": "1",....................... Currently trying to track down exactly which JS is responsible for the list in:

\modules\Emails\javascript\ajax.js

AND

\modules\Emails\javascript\EmailUI.js

Finally, the security group filter is not being properly applied to the list of available folders.

Expected Behavior

A list of both personal and accessible group accounts should appear in the list.

Once they appear in the list, when the list saves it will update the folders_subscriptions table in the database with the user ID and the folder ID to manage subscriptions.

Actual Behavior

Only a list of userFolders appear in the list.

Possible Fix

Modify the JS in settingsFolderRefresh: function (o) and probably another one I haven't found yet, to populate the list initially (which I haven't found yet).

Steps to Reproduce

  1. Create a group email
  2. Make sure it's marked as "is_group" = 1 in the inbound email table in the database 3.Make sure related folders are marked as "is_group"=1 in the folders table in the database
  3. Go to a profile as admin (or user) and try and add the folder to subscriptions. It's not available.

Context

Your Environment

pstevens71 commented 1 year ago

Other related issues I'm working on together with this one...

Update Delete.php to mark group folders as deleted https://github.com/salesagility/SuiteCRM/pull/10084

Update Folders to Mark Group Folders =1 https://github.com/salesagility/SuiteCRM/pull/10059

Update SugarFolders.php Not returning User Accessible inbound accounts (group) https://github.com/salesagility/SuiteCRM-Core/pull/276

pstevens71 commented 1 year ago

Ok, so I've done a bunch of changes to get group folders working properly and allow them to be managed by security groups.

NOTE: This only works completely on 7.13+ because in prior versions security groups are not related to Inbound email accounts.

To get Group Email Working:

In SugarFolders.php – save($addSubscriptions)

Modifications to mark group folders with is_group=1 on creation or edit of the inbound email account.

PR #10059

In SugarFolders.php – retrieveFoldersForProcessing

Changes: 1) Check if folder is already added $groupFolderAdded so that if true will not add folder again. 2) Fixed $isGroup = $item->isgroup ?? ''; should be: $isGroup = $item['is_group'] ?? ''; 3) Test if is user accessible OR if current user is admin so admin can see all: if ($isGroup == 1 && (isset($userAccessibleInboundIds[$item['id']]) || is_admin($user))) { 4) Add logic to prevent duplicate folders from getting added.

PR#281 (core branch)

/includes/SugarFolders/ Sugarfolders.php – getFoldersForSettings

Filter out duplicates and also child folders. Add private function getChildFolders to ID child folders from the array so that they are removed.

PR#281 (core branch)

/includes/SugarFolders/ Sugarfolders.php – getChildFolders Priviate function to get the child folders used in getFoldersForSettings

PR#280 (core branch)

/moldules/Emails/javascript/ EmailUI.js – updateSubscriptions()

Change updateSubscriptions function() this is necessary so that the select function works properly and no need to add the groupfolders twice.

PR#282 (core branch)

/modules/Emails/javascript/ajax.js settingsFolderRefresh: function

This is necessary because the click selection isn’t working properly. This re-written function allows user to select folders and also to deal with groupFolders from the JSON array, also skip the –none—in group folders array so it doesn’t appear twice. Also ensure that the initial state of –None—is always deselected.

PR#282 (core branch)

/modules/InboundEmail/Delete.php –add additional code

Add code to call the delete() fuction in Sugarfolders.php so that folders of deleted inbound accounts are marked as deleted=1

PR#10084

Other notes:

1) Inbound email accounts must be re-saved so folders get marked as “is_group=1” (as they should) for all of this to work. 2) Users need to be added to a security group that inbound email is also added to. 3) Users need to logout and log back in to ensure they are in the new security group.

pstevens71 commented 1 year ago

Here's a video walkthrough of the changes working:

https://vimeo.com/834135799

pstevens71 commented 1 year ago

Ok so still have some work to do. These mods work perfectly on 7.13 but not on 8.

I've got some more troubleshooting to do.

pstevens71 commented 1 year ago

So I've troubleshooted why it doesn't work in Version 8. The php is all fine, the JSON array it outputs is all fine the problem is with the JS. In 7 \public\legacy\modules\Emails\javascript\ajax.js function: settingsFolderRefresh populates the selection window for folders. However, in 8 this doesn't seem to be used. I've done some logging to output to console and it doesn't seem to be getting executed. Not sure if it's a cache issue or there is other JS that is populating this select table in version 8 Anyone have any ideas?

pstevens71 commented 1 year ago

Ok good news. The changes work in SuiteCRM 8. I was a cache issue. Had to put in developer mode and rebuild all the JS stuff for it to work. Anyone got a better way of flushing all the JS caches?

brendan-pike commented 1 year ago

Hi @pstevens71 Thanks for all your hard work on group emails. It's difficult to understand why this has had no love for so long when it seems so critical. Anyway... I'm running v8.3.1 so not all commits lined up with this release, but I manually applied all of them then resaved the incoming group email, added the correct user group to the incoming email then logged the user out/in.

Unfortunately its still not working for me, when the user goes to their profile and in email setting Folder Management it only shows --None-- and when clicked I get this: [ERROR] SugarFolder::retrieveFoldersForProcessing() Cannot Retrieve Folders - Please check the users inbound email settings. I am using v8 so maybe this is a cache issue, I tried ./bin/console cache:clear but the issue persists. Can you better explain how you flushed the JS caches? In my .env I put APP_ENV=developer, then ran ./bin/console assets:install and ./bin/console cache:clear but it hasn't helped, what did you do specifically? I should mention the user also gets this in logs when the user visits their profile page, probably unrelated however:

Fri Aug  4 15:19:51 2023 [809207][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_users_resources
Fri Aug  4 15:19:51 2023 [809207][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship am_projecttemplates_users_resources
Fri Aug  4 15:19:51 2023 [809439][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_users_resources
Fri Aug  4 15:19:51 2023 [809439][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship am_projecttemplates_users_resources
Fri Aug  4 15:19:51 2023 [809439][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_users_resources
Fri Aug  4 15:19:51 2023 [809439][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship am_projecttemplates_users_resources
Fri Aug  4 15:19:51 2023 [809439][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:51 2023 [809439][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:51 2023 [809439][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_users_resources
Fri Aug  4 15:19:51 2023 [809439][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship am_projecttemplates_users_resources
Fri Aug  4 15:19:51 2023 [809439][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_users_resources
Fri Aug  4 15:19:51 2023 [809439][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship am_projecttemplates_users_resources
Fri Aug  4 15:19:51 2023 [809439][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:51 2023 [809439][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_contacts_resources
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship am_projecttemplates_contacts_resources
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_quotes
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_contacts_resources
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship am_projecttemplates_contacts_resources
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_quotes
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_contacts_resources
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship am_projecttemplates_contacts_resources
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_contacts_resources
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship am_projecttemplates_contacts_resources
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_contacts_resources
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship am_projecttemplates_contacts_resources
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_quotes
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_contacts_resources
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship am_projecttemplates_contacts_resources
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_contacts_resources
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship am_projecttemplates_contacts_resources
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_quotes
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_contacts_resources
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship am_projecttemplates_contacts_resources
Fri Aug  4 15:19:52 2023 [809207][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] error: no ieID
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_contacts_resources
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship am_projecttemplates_contacts_resources
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_quotes
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_contacts_resources
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship am_projecttemplates_contacts_resources
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_quotes
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809207][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR]  SugarFolder::retrieveFoldersForProcessing() Cannot Retrieve Folders - Please check the users inbound email settings.
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_contacts_resources
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship am_projecttemplates_contacts_resources
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_users_resources
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship am_projecttemplates_users_resources
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_quotes
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_contacts_resources
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship am_projecttemplates_contacts_resources
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_quotes
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:52 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:53 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:53 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:53 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_contacts_resources
Fri Aug  4 15:19:53 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship am_projecttemplates_contacts_resources
Fri Aug  4 15:19:53 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_users_resources
Fri Aug  4 15:19:53 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship am_projecttemplates_users_resources
Fri Aug  4 15:19:53 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:53 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:53 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:53 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:53 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_contacts_resources
Fri Aug  4 15:19:53 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship am_projecttemplates_contacts_resources
Fri Aug  4 15:19:53 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_quotes
Fri Aug  4 15:19:53 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_contacts_resources
Fri Aug  4 15:19:53 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship am_projecttemplates_contacts_resources
Fri Aug  4 15:19:53 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_quotes
Fri Aug  4 15:19:53 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:53 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:53 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_contacts_resources
Fri Aug  4 15:19:53 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship am_projecttemplates_contacts_resources
Fri Aug  4 15:19:53 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_users_resources
Fri Aug  4 15:19:53 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship am_projecttemplates_users_resources
Fri Aug  4 15:19:53 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship projects_contacts_resources
Fri Aug  4 15:19:53 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship am_projecttemplates_contacts_resources
Fri Aug  4 15:19:53 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:53 2023 [809716][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] Unable to find relationship emails_email_templates
Fri Aug  4 15:19:57 2023 [809207][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR] error: no ieID
Fri Aug  4 15:19:57 2023 [809439][b5394442-59ef-95e7-396d-4f1e33b10f09][ERROR]  SugarFolder::retrieveFoldersForProcessing() Cannot Retrieve Folders - Please check the users inbound email settings.
Fri Aug  4 15:20:02 2023 [809780][1][FATAL] ImapHandler trying to use a non valid resource stream.
Fri Aug  4 15:20:02 2023 [809780][1][FATAL] ImapHandler trying to use a non valid resource stream.`
pstevens71 commented 1 year ago

I have tested this fix 7.12, 7.13 and 8. something (can't remember). It does work in every case so far. To flush the cache you need to shift F5 numerous times after doing all the JS rebuild items in R&R. Shift F5 when user loads, shift F5 when popup comes up. Also, its key you assign the account to a security group and that the user is in the same security group. If it still doesn't work, double check you have implemented all the changes (they are numerous). Also, from looking at your FATAL looks like your inbound email account is not setup correctly and not connecting. Check your credentials.

brendan-pike commented 1 year ago

Thanks for that. It now works after I did the full js rebuilds and cleared the browser cache.

I'm unable to delete emails from IMAP but its probably an unrelated issue. I'll search and report is seperately.

brendan-pike commented 1 year ago

Just a new update, one of my employees has nothing appearing in the inbox, but another does and my admin account also does. The only difference I can see between these two employees is that one reports to the other and the one that does not work has 3 email address set, where as the one that works only has one set.

When I watch the logs the only difference in the output is that the one that does not work shows this: [ERROR] SugarFolder::retrieveFoldersForProcessing() Cannot Retrieve Folders - Please check the users inbound email settings. Can you help me debug this please?

pstevens71 commented 1 year ago

Sounds like the user isn't subscribed to the folder or isn't in the security group.

brendan-pike commented 1 year ago

Agreed however user is definitely in the security group and is unable to subscribe to any folders because nothing appears in the list. On each refresh attempt that's where the error get restated.

pstevens71 commented 1 year ago

User needs to have at least one email account before being able to subscribe to group folders. That's one quirk I haven't been able to delve into yet.

chris001 commented 1 year ago

"User needs to have at least one email account before being able to subscribe to group folders."

@pstevens71 Would it be possible to display that error message on the page. So they'll instantly understand the user must add at least one email account.

pstevens71 commented 1 year ago

Hey @chris001 the challenge is to figure out where in all the code the problem is. Once I do that, I may as well just fix it rather than changing the error message. Another quirk I found is if you "bulk delete" an inbound email account rather than delete one from inside the account, it doesn't call the delete function to clean up the subscribed folders (which I just recently fixed). It seems like every fix leads to 2 more! LOL.

chris001 commented 10 months ago

Would it be doable to make this into a single PR, with all commits squashed into a single commit? If so, it might be more palatable for SA to merge it into 7.x if they haven't already. From there the 7.x changes should get automatically get used in 8.x thru /legacy/, if not mistaken.

brendan-pike commented 9 months ago

Just some feedback, I upgraded to 7.14.2 and I can't get groups emails to work, I even promoted one effected user to system administrator and it she still couldn't see group emails. So maybe this no longer works for the latest 7.x release. I'm having to roll back and this is extremely frustrating, the longer this remains unmerged the less likely it will ever be merged since it will drift. If anyone actually does have a working 7.14.2 install could you please provide a copy of all amended files for easy comparison?

pstevens71 commented 9 months ago

It's key that you add group users to a security group that also contains the email. I just upgraded my dev to 7.14.2. I'll give the patch another try and see if it still works. Another tip us do all the JS rebuild stuff after you apply ghe changes.

brendan-pike commented 9 months ago

Thanks for the reply, I logged in as that user and edited their profile, then I was able to select the email from there and now it does work!
For the love of all things I hope they merge soon

pstevens71 commented 9 months ago

I posted a video on the SuiteCRM community forum of how it all works. Worth a watch.

chris001 commented 9 months ago

Today I'm combining your Group Inbound PRs into one, and will submit them to your 7.14.2 (hotfix) repo @pstevens71 Then, you should turn around and submit them to the SA repo as one PR for 7.14.2, and you'll get the credit for your work. SA will take your improvements from 7.x and they will become automatically part of 8.x Users will be able to easily run a few commands to download and apply the fix on their own 7.14.2 and provide valuable feedback about how well it works for them.

pstevens71 commented 9 months ago

Thanks @chris001 I've done a lot of testing with version 7 and installed it in about half a dozen installation and so has a bunch of people in the forums who have tried it with success. However, I've haven't really thoroughly tested it on 8 yet.

brendan-pike commented 9 months ago

I have a problem where if I reply to an email all previous email thread is deleted and only my signature is shown, similarly if I select an email template when switching signatures/accounts I loose all or sometimes part of the template content. Before I report this I just wanted to make sure it wasn't caused by these patches in 7.14.2. Can anyone share their experience please.

chris001 commented 9 months ago

@brendan-pike Can you list the PR's you applied to your server? To know which PR's are involved in your issue.

brendan-pike commented 9 months ago

I followed the instructions in comment #issuecomment-1581126038 so: PR #10059 PR#281 PR#280 PR#282 PR#10084

pstevens71 commented 9 months ago

hey @brendan-pike did your problems come only after you applied the patches?

pstevens71 commented 9 months ago

@brendan-pike just did some testing in 8.5 (I'll have to upgrade my 7 version to current for testing later). Everything works as expected. When I reply in a group account, I absolutely lose my personal signature because I am replying from the group account. The behavior as a user, or admin is exactly the same. There are no other options to reply from but the group account. This is the way it is, the changes do not affect this behaviour. It would be good though to be able to reply from any of your email addresses. I did not lose any of the email content when replying to a group account email either as Admin or as a user.

I'll test version 7 later tonight when I get a chance to upgrade my dev. But I'd be surprised if the changes above affected what appears in the body of the reply window.

What happens if you add the email account as a "personal" account and then reply to?

pstevens71 commented 9 months ago

Ok just tested in 7.14.2 WITHOUT the group email patch. And I'm experiencing what you describe.

When I reply and the switch to a different reply account, all the content in the body of the email disappears.

When I apply a template, then switch to a different email address, all content in the body of the email disappears.

I can't remember if it always worked this way. In normally pick my address first and template second, so I never really noticed this before.

I remember recently there was a patch that had to do with automatically adding the signature. I think what was happening from memory was that when you switched it added a second signature and the patch was supposed to wipe out the signature in the body content and so when the new one was added, you didn't get two. I would bet this is the cause of the issue. I bet it wipes out the whole body content and didn't consider a reply to. (just a guess, if I get some time on the weekend I'll try and chase that one down).

chris001 commented 9 months ago

Anyone got a better way of flushing all the JS caches?

Yes. It's possible to flush the JS caches with code.

chris001 commented 9 months ago

I followed the instructions in comment #issuecomment-1581126038 so: PR #10059 PR#281 PR#280 PR#282 PR#10084

You're missing one to complete this fix: 276. Not that it would make a difference with your issue of the disappearing email content, that's something else.

brendan-pike commented 9 months ago

@pstevens71 Thanks for following that through, perhaps it was this PR: 9518 - Fix 4075 - No way to add Email Signature after adding Email Template which is from 7.12.4 https://docs.suitecrm.com/admin/releases/7.12.x/ It definately was not happening in 7.12.2 and it has my office person pulling their hair out. I can't believe no one negatively effected by this.

Also thank you for pointing out I missed fix 276, its very easy to miss things when done this way :)

pstevens71 commented 9 months ago

@brendan-pike yes! That's the one I was thinking of. I even started the thread about it. That must be why it sticks in my mind. Thought it was more recent than that! Time flies!

pstevens71 commented 9 months ago

I can confirm on 7.12.8, this does not happen, just tested. It does happen in my version 8 and my latest 7.14.2 Probably best to open another issue on this rather than continue in this thread. I believe it's an unrelated problem.

brendan-pike commented 9 months ago

Okay thank you, I'll open a new thread now. Reported https://github.com/salesagility/SuiteCRM-Core/issues/428

ViralAgency commented 2 months ago

Hi there, problem is still present on version 8.6.1. I'm checking if it can be solved. So, i don't understand why previous fixes were not merged with the core. Problem remain.