Bug 42973: Restore manual ordering for news

To test:
1. Create four OPAC news items:

   - "Pinned news item" with "Appear in position" = 1 and an older publication date.

   - "Newest unnumbered news item" with no position and the newest publication date.

   - "Middle unnumbered news item" with no position and an intermediate publication date.

   - "Oldest unnumbered news item" with no position and the oldest publication date.

2. View the OPAC main page.

3. Confirm the news items are ordered by publication date, with the newest item first.

Apply the patch.

4. Reload the OPAC main page.

5. Confirm the manually positioned news item appears first.

6. Confirm the remaining news items are ordered by publication date descending.

7. Confirm news items without an "Appear in position" value continue to display newest first.

8. Sign off and have a wonderful day!

Signed-off-by: Gretchen Maxeiner <MaxeinerGL@gcc.edu>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Laura_Escamilla 2026-07-01 16:25:56 +00:00 committed by Pedro Amorim
parent bb53e653f3
commit 70caff963a
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
1 changed files with 5 additions and 1 deletions

View File

@ -115,7 +115,11 @@ sub search_for_display {
my $attribs = {
prefetch => 'additional_content',
order_by => { -desc => 'additional_content.published_on' }
order_by => [
\['ISNULL(additional_content.number)'],
{ -asc => 'additional_content.number' },
{ -desc => 'additional_content.published_on' },
],
};
return Koha::AdditionalContentsLocalizations->search( $search_params, $attribs );
}