Bug 40934: (follow-up) --code and --exclude-code should be mutually exclusive

Both options were being accepted but only the last one in the command line
was being applied. Now they are mutually exclusive like --category and
--skip-category in longoverdue.pl.

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-01-20 13:00:28 +00:00 committed by Pedro Amorim
parent 3430793f07
commit e6908ef0a7
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
1 changed files with 5 additions and 1 deletions

View File

@ -75,6 +75,10 @@ ENDUSAGE
die $usage if $help;
if ( @letter_code && @exclude_letter_code ) {
die "The options --code and --exclude-code are mutually exclusive.\nUse one or the other.\n" . $usage;
}
my $script_handler = Koha::Script->new( { script => $0 } );
try {
@ -88,7 +92,7 @@ try {
};
# Remove empty elements, see bug 37075
@letter_code = grep { $_ ne q{} } @letter_code;
@letter_code = grep { $_ ne q{} } @letter_code;
@exclude_letter_code = grep { $_ ne q{} } @exclude_letter_code;
C4::Letters::SendQueuedMessages(