Bug 9325 - overdue notices sent same messages for all users.
Summary: overdue notices sent same messages for all users.
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Notices (show other bugs)
Version: master
Hardware: All All
: P5 - low critical (vote)
Assignee: Julian Maurice
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-27 15:44 UTC by Jonathan Druart
Modified: 2019-06-27 09:24 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 9325: Fix overdue letter generation (1.20 KB, patch)
2012-12-27 15:46 UTC, Jonathan Druart
Details | Diff | Splinter Review
Fix generation of same overdue letter for different patrons (378 bytes, patch)
2013-01-04 14:57 UTC, Volkan Sonmez
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2012-12-27 15:44:59 UTC
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.
Comment 1 Jonathan Druart 2012-12-27 15:46:41 UTC
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
Comment 2 Chris Cormack 2012-12-28 03:21:22 UTC
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;
     }
Comment 3 Liz Rea 2012-12-28 03:34:48 UTC
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.
Comment 4 Katrin Fischer 2013-01-03 06:57:46 UTC
Bug 8378 that caused this bug has been reverted from master.
Comment 5 Volkan Sonmez 2013-01-04 14:57:23 UTC
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.