From 836f3ce992ef2c3bffbcf80c73bcacbbe479ea85 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's library's notice for DUEDGST and PREDUEDGST If a notice is defined for the library 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. Signed-off-by: Kyle M Hall Signed-off-by: Katrin Fischer Passes all tests and QA script. Test case: User from Library A, checked out books - in library A from A and B - in library B from B Verified, that the 'all libraries' notice is still used, when no specific notice is defined. Verified, that the patron's home library noticed is used, when defined. Note: Before and after the patch we print the branch information from the patron's home library, so also using the template from this branch, seems logical. All items over all branches are processed into one single reminder email, before and after the patch. Signed-off-by: Galen Charlton --- 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 178f09a1d7..4e7149d6e1 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) { -- 2.39.5