znuny / Znuny

Znuny/Znuny LTS is a fork of the ((OTRS)) Community Edition, one of the most flexible web-based ticketing systems used for Customer Service, Help Desk, IT Service Management.
https://www.znuny.org
GNU General Public License v3.0
332 stars 82 forks source link

Sector Nord AG: New feature - Refactor of search function to allow multi-page search #534

Open ZTrotter opened 5 months ago

ZTrotter commented 5 months ago

Proposed change

Currently, when searching for dynamic fields in the AdminDynamicField mask, the search functionality is limited to dynamic fields displayed on the current page. This is not ideal, as it means that searching for a dynamic field may involve searching several pages before finding a result.

A dynamic field can be found by searching on a page where it appears image

But not on a page where it doesn't appear image

The suggested change is to rebuild the search functionality to allow for a search across multiple pages.

Type of change

Additional information

Replication

Checklist

mbethke commented 5 months ago

Nice :) One suggestion for _SearchDynamicField: that would be a good case for pulling the OM call out of the loop. But if you do that already, you might as well boil it down all the way:

  sub _SearchDynamicField {
      my ( $Self, %Param ) = @_;
      my $DynamicFieldObject = $Kernel::OM->Get('Kernel::System::DynamicField');
      return grep { $DynamicFieldObject->DynamicFieldGet( ID => $DynamicFieldID )->{Name} =~ /\Q$Param{Search}\E/i } @{ $Param{DynamicFields} }
  }