From 70caff963ab22380e6609162814a748d0ceeabf9 Mon Sep 17 00:00:00 2001 From: Laura_Escamilla Date: Wed, 1 Jul 2026 16:25:56 +0000 Subject: [PATCH] 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 Signed-off-by: David Cook Signed-off-by: Pedro Amorim --- Koha/AdditionalContents.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Koha/AdditionalContents.pm b/Koha/AdditionalContents.pm index 765eddb875..dbda9cab76 100644 --- a/Koha/AdditionalContents.pm +++ b/Koha/AdditionalContents.pm @@ -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 ); }