Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Kernel/System/FAQSearch.pm
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ search in FAQ articles

ServiceID => $ServiceID, # (optional)

# Use FAQSearch as an FAQ filter on a single FAQ item,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

*a FAQ, if I am not mistaken

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It would depend on how the word FAQ sounds phonetically, not necessarily how it's spelled.

I figured it starts with a pronounced "eff..." and so it is preceded by an "an". :)

# or a predefined FAQ item list
FAQID => 1234, # (optional)
FAQID => [1234, 1235], # (optional)

# Approved
# Only available in internal interface (agent interface)
Approved => 1, # (optional) 1 or 0,
Expand Down Expand Up @@ -431,6 +436,22 @@ sub FAQSearch {
$Ext .= " LOWER(i.f_subject) LIKE LOWER('" . $Param{Title} . "') $Self->{LikeEscapeString}";
}

# Limit the search to just one (or a list) FAQID (used by the otobo-ai package
# to filter for events on single FAQ items with the job's FAQ filter).
if ( IsStringWithData( $Param{FAQID} ) || IsArrayRefWithData( $Param{FAQID} ) ) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

IsInteger would be more suitable as you are later quoting it as Integer

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This sounds good to me. Maybe it's worth considering changing it in Kernel::System::Ticket::TicketSearch aswell.


my $SQLQueryInCondition = $DBObject->QueryInCondition(
Key => 'i.id',
Values => ref $Param{FAQID} eq 'ARRAY' ? $Param{FAQID} : [ $Param{FAQID} ],
QuoteType => 'Integer',
BindMode => 0,
);
if ($Ext) {
$Ext .= ' AND ';
}
$Ext .= ' ( ' . $SQLQueryInCondition . ' ) ';
}

# search for languages
if ( $Param{LanguageIDs} && ref $Param{LanguageIDs} eq 'ARRAY' && @{ $Param{LanguageIDs} } ) {

Expand Down