From d765622b5fbbd98c2af5b4cef93c7227e0f28f93 Mon Sep 17 00:00:00 2001 From: Andrew Fuerste Henry Date: Tue, 14 Jan 2025 20:02:52 +0000 Subject: [PATCH] Bug 38893: Quit job with message when longoverdue run with --library and CircControl set to logged in library To test: 1: Set CircControl to "the item's library" and run longoverdue with the --library flag, it works 2: Set CircControl to "the library you are logged in at" and run longoverdue, it gives an error 3: Apply patch, restart all 4: Run longoverdue, it quits and tells you "Use of --library flag not permitted when the CircControl system preference set to 'the library you are logged in at'" Signed-off-by: Martin Renvoize --- misc/cronjobs/longoverdue.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/misc/cronjobs/longoverdue.pl b/misc/cronjobs/longoverdue.pl index 6288f9d9d31..505ba7ff0b7 100755 --- a/misc/cronjobs/longoverdue.pl +++ b/misc/cronjobs/longoverdue.pl @@ -477,7 +477,10 @@ foreach my $startrange (sort keys %$lost) { $patron ||= Koha::Patrons->find( $row->{borrowernumber} ); $lib = $patron->branchcode(); } elsif ( $_ eq 'PickupLibrary' ) { - $lib = C4::Context->userenv->{'branch'}; + pod2usage( + '-exitval' => 1, + '-message' => "Use of --library flag not permitted when the CircControl system preference set to 'the library you are logged in at'", + ) } else { # ( $_ eq 'ItemHomeLibrary' ) if ($home_holding_pref eq 'homebranch') { $lib = Koha::Items->find( $row->{itemnumber} )->homebranch(); -- 2.48.1