Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email module - can't sort email by Date Sent/Received #9891

Open
pabaillon opened this issue Jan 9, 2023 · 7 comments
Open

Email module - can't sort email by Date Sent/Received #9891

pabaillon opened this issue Jan 9, 2023 · 7 comments
Labels
Area: Emails Issues & PRs related to all things regarding emails & email module Priority:Moderate Issues & PRs that are minor; broken styling, cosmetic, warnings - there are practical workarounds Type: Bug Bugs within the core SuiteCRM codebase

Comments

@pabaillon
Copy link

Issue

Expected Behavior

By clicking on the small arrow I should be able to sort by ascending or descending date

Actual Behavior

nothing is happening.

Context

Bad user experience.

Your Environment

  • SuiteCRM Version used: 8.2
  • Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)): Firefox
    108.0.2
  • Environment name and version (e.g. MySQL, PHP 7): Mariadb PHP 8.1
  • Operating System and version (e.g Ubuntu 16.04): Debian Bulleye
@johnM2401 johnM2401 added Type: Bug Bugs within the core SuiteCRM codebase Priority:Moderate Issues & PRs that are minor; broken styling, cosmetic, warnings - there are practical workarounds Area: Emails Issues & PRs related to all things regarding emails & email module labels Jan 17, 2023
@johnM2401
Copy link
Contributor

Hey!

Thanks for raising!

Quick note for future reference;
This doesn't appear to specifically affect SuiteCRM8, and can also be seen on 7.13. so will keep it on this Repo for now.

Thanks again!

@johnM2401 johnM2401 changed the title [8.2]Email module - can't sort email by Date Sent/Received Email module - can't sort email by Date Sent/Received Jan 17, 2023
@clemente-raposo
Copy link
Contributor

clemente-raposo commented Jan 18, 2023

Hi @johnM2401 @pabaillon,

The sorting on emails has been disabled. ESORT is not supported by all IMAP servers.

the emails should always be sorted by descending received date, I.e., the newest should show at the top

The sorting arrow on the column is just an indicator of the current sorting.

@JimFromAustin
Copy link

JimFromAustin commented Jan 30, 2023

In version 7.13.1 I am seeing the newest emails shown at the bottom, not the top. It appears this imap server sort issue has been discussed by Roundcube developers. Their solution was to provide the ability to disable sorting in the client, for situations when the imap server does not support sorting. roundcube/roundcubemail#4608 Seems like a great idea.

What version of SuiteCRM did sorting get disabled? Are we able to patch the old sorting code back or is development way past that point?

@DestinationAI
Copy link

As far as I see this problem is the result of another problem : the sort headers only for the email module disappeared. According all suiteCRM documentation I have read these should be there , just as any other module. Is this problem also being investigated curently?

@MYG63
Copy link

MYG63 commented May 8, 2023

Hello. I think that is a bad idea just to code it out! Can please someone tell us if it could be possible to - may be - hard code that "sorting by date back" to the code? So ist just would be fixed to sort by date?
Thanks.

@rsteinig
Copy link

rsteinig commented May 8, 2023

you can overwrite non update-safe at suitecrm_7_13_3/modules/Emails/include/ListView/ListViewSmartyEmails.php:

if (count($data['data'])) {
    if (isset($data['data'][0]['DATE_SENT_RECEIVED'])) {
        usort($data['data'], function ($a, $b) {
            // DESC SORTING ORDER
            return strtotime($b['DATE_SENT_RECEIVED']) - strtotime($a['DATE_SENT_RECEIVED']);
        });
    }
}

@MYG63
Copy link

MYG63 commented May 8, 2023

you can overwrite non update-safe at suitecrm_7_13_3/modules/Emails/include/ListView/ListViewSmartyEmails.php:

if (count($data['data'])) {
    if (isset($data['data'][0]['DATE_SENT_RECEIVED'])) {
        usort($data['data'], function ($a, $b) {
            // DESC SORTING ORDER
            return strtotime($b['DATE_SENT_RECEIVED']) - strtotime($a['DATE_SENT_RECEIVED']);
        });
    }
}

Thank you. That's working to sort emails in the view so far. But when you select any of these emails in the list and go to "bulk Action" - "Delete from IMAP" you will delete another one! Take care. May be that needs some more investigation. The list of course is another thing that the list of objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Emails Issues & PRs related to all things regarding emails & email module Priority:Moderate Issues & PRs that are minor; broken styling, cosmetic, warnings - there are practical workarounds Type: Bug Bugs within the core SuiteCRM codebase
Projects
None yet
Development

No branches or pull requests

7 participants