From a99e25363c950e30f30f881e70f884b77557274d Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 25 Feb 2026 11:58:35 +0000 Subject: [PATCH] Bug 10190: fix four more issues spotted in the overdues script - Patron.pm has_restricting_overdues: sort ASC not DESC so the oldest (most overdue) item is checked per branch/itemtype; DESC caused the deduplication skip to discard the very items most likely to trigger a restriction - overdue_notices.pl: fix --itemtypesout option name in GetOptions (was 'itemtypeouts', never matched the documented --itemtypesout flag) - overdue_notices.pl: fix typo 'catagorycode' -> 'categorycode' in --borcatout search, which silently broke category exclusion - circulation_triggers.pl: add flagsrequired => parameters/manage_circ_rules so the admin page enforces the correct permission; also add missing use Koha::Notice::Templates --- Koha/Patron.pm | 2 +- admin/circulation_triggers.pl | 2 ++ misc/cronjobs/overdue_notices.pl | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Koha/Patron.pm b/Koha/Patron.pm index 75d3ce9ea0d..ddbeac5ba58 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -1251,7 +1251,7 @@ sub has_restricting_overdues { my $date = dt_from_string()->truncate( to => 'day' )->add( days => 1 ); # Work from oldest overdue to newest - $overdues = $overdues->search( {}, { order_by => { '-desc' => 'me.date_due' } } ); + $overdues = $overdues->search( {}, { order_by => { '-asc' => 'me.date_due' } } ); my $now = dt_from_string(); my ( $itemtype, $branchcode ) = ( "", "" ); diff --git a/admin/circulation_triggers.pl b/admin/circulation_triggers.pl index b60f8afb8ae..07845c8cffe 100755 --- a/admin/circulation_triggers.pl +++ b/admin/circulation_triggers.pl @@ -22,6 +22,7 @@ use Modern::Perl; use CGI qw ( -utf8 ); use C4::Auth qw( get_template_and_user ); use C4::Output qw( output_html_with_http_headers ); +use Koha::Notice::Templates; my $query = CGI->new; @@ -30,6 +31,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( template_name => "admin/circulation_triggers.tt", query => $query, type => "intranet", + flagsrequired => { parameters => 'manage_circ_rules' }, } ); diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl index 28b1fe51ea1..3a2fa8780ef 100755 --- a/misc/cronjobs/overdue_notices.pl +++ b/misc/cronjobs/overdue_notices.pl @@ -368,7 +368,7 @@ GetOptions( 'text:s' => \$text_filename, # this optional argument gets '' if not supplied. 'itemscontent=s' => \$itemscontent, 'itemtypes=s' => \@myitemtypes, - 'itemtypeouts=s' => \@myitemtypesout, + 'itemtypesout=s' => \@myitemtypesout, 'list-all' => \$listall, 't|triggered' => \$triggered, 'test' => \$test_mode, @@ -501,7 +501,7 @@ my @categories; if (@myborcat) { @categories = @myborcat; } elsif (@myborcatout) { - @categories = Koha::Patron::Categories->search( { catagorycode => { 'not_in' => \@myborcatout } } ) + @categories = Koha::Patron::Categories->search( { categorycode => { 'not_in' => \@myborcatout } } ) ->get_column('categorycode'); } else { @categories = Koha::Patron::Categories->search()->get_column('categorycode'); -- 2.53.0