In overdue_notices.pl, letter template must not be passed to parse_letter because this sub modifies it, so the first overdue letter is ok but following letters have exactly the same content.
Created attachment 14297 [details] [review] Bug 9325: Fix overdue letter generation In overdue_notices.pl, letter template must not be passed to parse_letter because this sub modifies it, so the first overdue letter is ok but following letters have exactly the same content. This patch make a copy of the template before passing it to parse_letter
Commit 40f9914e60e002ae4cbf10d09cff8bbf32abd8fe for bug 8378 created this bad behaviour. I would be in favour of reverting that, and fixing the fines bug by just doing @@ -671,7 +679,7 @@ sub parse_letter { my $currency_format; if ($params->{'letter'}->{'content'} =~ m/<fine>(.*)<\/fine>/o) { # process any fine tags... $currency_format = $1; - $params->{'letter'}->{'content'} =~ s/<fine>.*<\/fine>/<<item.fine>>/o; + $params->{'letter'}->{'content'} =~ s/<fine>.*<\/fine>/<<items.fine>>/o; }
Steps to reproduce the bug (copied from 8378): 1. make 2 checkouts with 2 different borrowers of the same categorycode 2. make these checkouts become overdue "update issues set date_due='XXXX-XX-XX XX:XX' where borrowernumber IN(X,Y)" 3. run misc/cronjobs/overdue_notices.pl -n You should obtain the same letter twice. 4. Now apply the patch and re-run misc/cronjobs/overdue_notices.pl -n You should obtain 2 different letters.
Bug 8378 that caused this bug has been reverted from master.
Created attachment 14420 [details] [review] Fix generation of same overdue letter for different patrons Using C4::Letters::GetProcessedLetter instead of C4::Letters::GetPreparedLetter in parse_letter causes problem.