Bugzilla – Attachment 194311 Details for
Bug 14962
Temp Shelving Location / On Display Module
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14962: (QA follow-up) Apply full active-display filter in get_public
3e06eae.patch (text/plain), 2.01 KB, created by
Martin Renvoize (ashimema)
on 2026-03-02 10:24:39 UTC
(
hide
)
Description:
Bug 14962: (QA follow-up) Apply full active-display filter in get_public
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2026-03-02 10:24:39 UTC
Size:
2.01 KB
patch
obsolete
>From 3e06eae45d917be3ad0136eece2cdb2e2a469997 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Tue, 24 Feb 2026 13:01:33 +0000 >Subject: [PATCH] Bug 14962: (QA follow-up) Apply full active-display filter in > get_public > >get_public only checked end_date, allowing disabled displays and >displays not yet started to be retrieved by unauthenticated OPAC users. > >Apply the same criteria used by Koha::Displays->active: enabled must >be true, start_date must be null or in the past, and end_date must be >null or in the future. > >Sponsored-by: ByWater Solutions >Signed-of-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> >--- > Koha/REST/V1/Displays.pm | 19 ++++++++++++------- > 1 file changed, 12 insertions(+), 7 deletions(-) > >diff --git a/Koha/REST/V1/Displays.pm b/Koha/REST/V1/Displays.pm >index 75aeb56b2ee..8a752dc2bc4 100644 >--- a/Koha/REST/V1/Displays.pm >+++ b/Koha/REST/V1/Displays.pm >@@ -233,17 +233,22 @@ sub get_public { > my $c = shift->openapi->valid_input or return; > > return try { >- my $display = Koha::Displays->find( $c->param('display_id') ); >+ my $today = dt_from_string->truncate( to => 'day' )->ymd; >+ >+ my $display = Koha::Displays->search( >+ { >+ display_id => $c->param('display_id'), >+ enabled => 1, >+ -and => [ >+ -or => [ { start_date => undef }, { start_date => { '<=' => $today } } ], >+ -or => [ { end_date => undef }, { end_date => { '>=' => $today } } ], >+ ], >+ } >+ )->next; > > return $c->render_resource_not_found("Display") > unless $display; > >- my $today = dt_from_string->truncate( to => 'day' )->ymd; >- >- if ( $display->end_date && $display->end_date < $today ) { >- return $c->render_resource_not_found("Display"); >- } >- > return $c->render( status => 200, openapi => $c->objects->to_api($display), ); > } catch { > $c->unhandled_exception($_); >-- >2.53.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14962
:
190216
|
190217
|
190218
|
190219
|
190220
|
190221
|
190222
|
190223
|
190224
|
190225
|
190226
|
190227
|
190228
|
190229
|
190230
|
190231
|
190232
|
190571
|
190572
|
193719
|
193720
|
193721
|
193722
|
193723
|
193724
|
193725
|
193726
|
193727
|
193728
|
193729
|
193730
|
193731
|
193732
|
193733
|
193734
|
193735
|
193736
|
193737
|
193738
|
193739
|
193740
|
193741
|
193742
|
193743
|
193744
|
193745
|
193746
|
193747
|
193748
|
193749
|
193750
|
193751
|
193752
|
193753
|
193754
|
193755
|
194285
|
194286
|
194287
|
194288
|
194289
|
194290
|
194291
|
194292
|
194293
|
194294
|
194295
|
194296
|
194297
|
194298
|
194299
|
194300
|
194301
|
194302
|
194303
|
194304
|
194305
|
194306
|
194307
|
194308
|
194309
|
194310
| 194311 |
194312
|
194313
|
194314
|
194315
|
194316
|
194317
|
194318
|
194320
|
194321
|
194322