Bug 35163 - overdue_notices.pl wrongly reports "terms were not matched and replaced"
Summary: overdue_notices.pl wrongly reports "terms were not matched and replaced"
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-26 13:18 UTC by Magnus Enger
Modified: 2023-10-26 13:18 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Magnus Enger 2023-10-26 13:18:36 UTC
I tried running overdue_notices.pl with the --verbose argument, and got a bunch of messages like this: 

The following terms were not matched and replaced: 
	div class="adress_odue"
	div class="adressrad"
	/div
...

But the generated messages in the message_queue looks ok. The message comes from this code, around line 766 of misc/cronjobs/overdue_notices.pl:

my @misses = grep { /./ } map { /^([^>]*)[>]+/; ( $1 || '' ); } split /\</, $letter->{'content'};
if (@misses) {
    $verbose and warn "The following terms were not matched and replaced: \n\t" . join "\n\t", @misses;
}

I have a hunch this is meant to look for things like <<something>> that are still left in the $letter->{'content'}, but it actually finds and reports on things like <something>, including HTML tags. So maybe it can be improved to look for <<>>? 

Maybe there should even be two different checks like this, one for HTML messages and one for non-HTML-messages?