From 03040e1c721598e5bf8a84b305acd52d575f81b5 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 5 Mar 2014 15:08:13 +0100 Subject: [PATCH] Bug 8258: Use patron branchcode notice for DUEDGST and PREDUEDGST If a notice is defined for the branchcode of the patron, it should be used. Without this patch, the notice used is the one defined for all libraries. Test plan: 1/ Set the advanced notice for a patron using digest. 2/ Check one item out to this patron (backdate the return date according the days in advance value). 3/ launch advance_notices.pl -c 4/ Verify the notice used is the default one. 5/ Define a notice for the library of the patron for PREDUEDGST 6/ launch advance_notices.pl -c 7/ Verify the notice used is the one previously defined. 8/ Check one item out to this patron (date due = today) 9/ launch advance_notices.pl -c 10/ Verify the notice used is the default one. 11/ Define a notice for the library of the patron for DUEDGST 12/ launch advance_notices.pl -c 13/ Verify the notice used is the one previously defined. --- misc/cronjobs/advance_notices.pl | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/misc/cronjobs/advance_notices.pl b/misc/cronjobs/advance_notices.pl index 178f09a..4e7149d 100755 --- a/misc/cronjobs/advance_notices.pl +++ b/misc/cronjobs/advance_notices.pl @@ -349,13 +349,18 @@ PATRON: while ( my ( $borrowernumber, $digest ) = each %$upcoming_digest ) { ## Get branch info for borrowers home library. my %branch_info = get_branch_info( $borrowernumber ); - my $letter = parse_letter( { letter_code => $letter_type, - borrowernumber => $borrowernumber, - substitute => { count => $count, - 'items.content' => $titles, - %branch_info, - } - } ) + my $letter = parse_letter( + { + letter_code => $letter_type, + borrowernumber => $borrowernumber, + substitute => { + count => $count, + 'items.content' => $titles, + %branch_info, + }, + branchcode => $branch_info{ "branches.branchcode" }, + } + ) or die "no letter of type '$letter_type' found. Please see sample_notices.sql"; if ($nomail) { local $, = "\f"; @@ -392,13 +397,18 @@ PATRON: while ( my ( $borrowernumber, $digest ) = each %$due_digest ) { ## Get branch info for borrowers home library. my %branch_info = get_branch_info( $borrowernumber ); - my $letter = parse_letter( { letter_code => $letter_type, - borrowernumber => $borrowernumber, - substitute => { count => $count, - 'items.content' => $titles, - %branch_info, - } - } ) + my $letter = parse_letter( + { + letter_code => $letter_type, + borrowernumber => $borrowernumber, + substitute => { + count => $count, + 'items.content' => $titles, + %branch_info, + }, + branchcode => $branch_info{ "branches.branchcode" }, + } + ) or die "no letter of type '$letter_type' found. Please see sample_notices.sql"; if ($nomail) { -- 1.7.10.4