From 90818a64ef697ca92eb873439f03ee02bf3e2444 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 16 Aug 2023 14:34:15 -0400 Subject: [PATCH] Bug 34545: Koha should die with an error if AutoSelfCheckID is invalid If AutoSelfCheckID is an not valid ( either by deleting the patron or by changing the patron's userid ), self-checkout will display the login screen and no error will be generated in any logs. Test Plan: 1) Apply this patch 2) Verify AutoSelfCheckID is working as expected 3) Change AutoSelfCheckID to an invalid userid 4) Restart all the things! 5) Verify visiting sco-main.pl generates an error! --- opac/sco/sco-main.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl index 9f70a415cc4..2245f44743e 100755 --- a/opac/sco/sco-main.pl +++ b/opac/sco/sco-main.pl @@ -63,6 +63,8 @@ unless ( in_iprange(C4::Context->preference('SelfCheckAllowByIPRanges')) ) { if (C4::Context->preference('AutoSelfCheckAllowed')) { my $AutoSelfCheckID = C4::Context->preference('AutoSelfCheckID'); + die "Cannot auto login to self checkout, user $AutoSelfCheckID does not exist!" + unless Koha::Patrons->search( { userid => $AutoSelfCheckID } )->count(); my $AutoSelfCheckPass = C4::Context->preference('AutoSelfCheckPass'); $query->param(-name=>'userid',-values=>[$AutoSelfCheckID]); $query->param(-name=>'password',-values=>[$AutoSelfCheckPass]); -- 2.30.2