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

Quick Filter Fixes: #4728

Merged
merged 1 commit into from Mar 26, 2019

Conversation

Projects
None yet
3 participants
@aydreeihn
Copy link
Contributor

commented Feb 13, 2019

Make the following quick filters work:

  • Assigned
  • Assignee
  • Department Manager
  • Assigned Team

Also, make sure we account for if there are no choices available for a quick filter
Ex: The helpdesk does not have any teams

$this->_members = Staff::getStaffMembers();
if (!isset($this->_members)) {
$managers = array();
foreach (Staff::objects() as $staff) {

This comment has been minimized.

Copy link
@protich

protich Feb 13, 2019

Member

Why not filter via ORM and select only managers?

This comment has been minimized.

Copy link
@aydreeihn

aydreeihn Feb 14, 2019

Author Contributor

Off of departments?

if (!isset($this->_members)) {
            $managers = array();
            $managerIds = Dept::objects()
                ->filter(Q::any(array(
                    'manager_id__gt' => 0,
                )))
                ->values_flat('manager_id');

            foreach ($managerIds as $key => $id) {
                $staff = Staff::lookup($id[0]);
                $managers['s'.$id[0]] = $staff->getName()->name;
            }
            $this->_members = $managers;
        }

Does this make it less expensive? I still ended up with a lookup on the staff member.

case ($qf_value == 'assigned'):
case ($qf_value == '!assigned'):
$result = AssigneeChoiceField::getSearchQ($qf_value, $qf_value);
return $query->filter($result);

This comment has been minimized.

Copy link
@greezybacon

greezybacon Feb 13, 2019

Member

Shouldn't this be defined in AssigneeChoiceField::applyQuickFilter?

This comment has been minimized.

Copy link
@aydreeihn

aydreeihn Feb 14, 2019

Author Contributor

We could do that, but we would end up needing to define an applyQuickFilter function for AssignedField, AssigneeChoiceField, and TeamSelectionField.

applyQuickFilter is hit in class.queue.php getQuery
$qf->applyQuickFilter()
where $qf could be one of those classes depending on the quick filter.

After discussing it, it looks like it'll be fine to just leave it as is.

@aydreeihn aydreeihn force-pushed the aydreeihn:issue/quick-filters branch from b6c5f2f to 7dda796 Mar 26, 2019

Quick Filter Fixes:
Make the following work:
- Assigned
- Assignee
- Department Manager
- Assigned Team

Also, make sure we account for if there are no choices available for a quick filter Ex: The helpdesk does not have any teams

@aydreeihn aydreeihn force-pushed the aydreeihn:issue/quick-filters branch from 7dda796 to 838b70f Mar 26, 2019

@protich protich merged commit 1dee111 into osTicket:develop-next Mar 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.