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

Signed-off-by: Michaela <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Martin Renvoize 2026-02-25 11:58:35 +00:00 committed by Pedro Amorim
parent 6640e3e58a
commit 228bf75845
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
3 changed files with 5 additions and 3 deletions

View File

@ -1435,7 +1435,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 ) = ( "", "" );

View File

@ -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' },
}
);

View File

@ -364,7 +364,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,
@ -497,7 +497,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');