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

Issue: Counts in Searches #5440

Closed
wants to merge 1 commit into from

Conversation

aydreeihn
Copy link
Contributor

This commit fixes an issue where you could not use a field that included a counter in Advanced Searches. This fixes the following fields:

  • Attachment Count
  • Collaborator Count
  • Reopen Count
  • Thread Count

This fixes Issue #5435

@@ -2567,12 +2567,35 @@ function compileQ(Q $Q, $model, $parens=true) {
}
// Handle simple field = <value> constraints
else {
if (is_string($field) && strpos($field, 'count') !== false) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a no-no! Think of ORM as framework code, it shouldn't have application logic at all.

@@ -13,6 +13,23 @@
)
$tickets->filter($thisstaff->getTicketsVisibility());

$tickets->annotate(array(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be a major performance penalty, especially for bigger datasets, since you're forcing every queue to aggregate data it might not need on every load when we already have a mechanism to inject columns (what to select) on demand. We already can add such counts as columns or as annotation on other columns.

@aydreeihn aydreeihn force-pushed the issue/search-counters branch 3 times, most recently from 7ff7b38 to cc122ff Compare April 7, 2020 17:23
This commit fixes an issue where you could not use a field that included a counter in Advanced Searches. This fixes the following fields:
- Attachment Count
- Collaborator Count
- Reopen Count
- Thread Count

This fixes Issue osTicket#5435
@protich
Copy link
Member

protich commented Apr 16, 2020

PR #5456 merged.

@protich protich closed this Apr 16, 2020
@gabrielfs17
Copy link

this problem still occurs in version 1.14

@JediKev
Copy link
Contributor

JediKev commented Jul 21, 2020

@gabrielfreisan

Hmmm...mine appears to be working correctly. Are you using the latest version of osTicket which is v1.14.2?

Cheers.

@gabrielfs17
Copy link

gabrielfs17 commented Jul 21, 2020 via email

@JediKev
Copy link
Contributor

JediKev commented Jul 21, 2020

@gabrielfreisan

Okay, are you seeing any errors via Apache error logs, PHP error logs, MySQL error logs, osTicket system logs, or Browser Console logs?

Can you give me exact steps to replicate? As well as screenshots of what you see?

When I run an Advanced Search and I search for Attachment Count => Equal => 1 I can see results in the queue:

Criteria

Screen Shot 2020-07-21 at 10 22 33

Results

Screen Shot 2020-07-21 at 10 22 41

Maybe there are no tickets that match your search criteria?

Cheers.

@gabrielfs17
Copy link

gabrielfs17 commented Jul 21, 2020 via email

@gabrielfs17
Copy link

gabrielfs17 commented Jul 21, 2020 via email

@JediKev
Copy link
Contributor

JediKev commented Jul 21, 2020

@gabrielfreisan

The images didn't post properly. What is the exact search criteria you are running? I still can't replicate this with just Reopen Count criteria nor just Collaborator Count criteria.

Cheers.

@gabrielfs17
Copy link

gabrielfs17 commented Jul 21, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants