Bug 9325

Summary: overdue notices sent same messages for all users.
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: NoticesAssignee: Julian Maurice <julian.maurice>
Status: CLOSED FIXED QA Contact:
Severity: critical    
Priority: P5 - low CC: chris, derrynj, katrin.fischer, liz, mvsonmez
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8378
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 9325: Fix overdue letter generation
Fix generation of same overdue letter for different patrons

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.