Skip to content

Commit

Permalink
Add option to find disabled articles in search
Browse files Browse the repository at this point in the history
Previously, the search would only find enabled articles. This adds an
option to the search to include disabled articles in the results.
  • Loading branch information
richieri-bps committed Jan 26, 2024
1 parent 464dacd commit d8d2920
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions share/html/Articles/Article/Elements/ShowSearchCriteria
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@
</div>
</div>

<div class="form-row">
<div class="label col-3"></div>
<div class="value col-9">
<div class="custom-control custom-checkbox">
<input type="checkbox" id="FindDisabledArticles" name="FindDisabledArticles" class="custom-control-input" <% $ARGS{'FindDisabledArticles'} ? 'checked="checked"' : "" %> />
<label class="custom-control-label" for="FindDisabledArticles"><&|/l&>Include disabled articles in listing.</&></label>
</div>
</div>
</div>

<div class="form-row label">
<h5><&|/l&>Content</&></h5>
</div>
Expand Down
6 changes: 6 additions & 0 deletions share/html/Articles/Article/Search.html
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,12 @@
my $customfields = RT::CustomFields->new( $session{'CurrentUser'} );
my %dates;

if ( $ARGS{FindDisabledArticles} ) {
$articles->FindAllRows;
} else {
$articles->LimitToEnabled;
}

$articles->Search( %ARGS, CustomFields => $customfields, Dates => \%dates,
OrderBy => \@OrderBy, Order => \@Order, );

Expand Down

0 comments on commit d8d2920

Please sign in to comment.