Bug 29100: Add checkouts data loop to predue notices script ( advance_notices.pl )

Predue / due notices are limited to using itemscontent to display checkouts data. It would be nice to make all the checkouts data available for those notices so that libraries could format that data more nicely if they wish.

1) Apply this patch
2) For DUE and PREDUE notices, set the message body to the following:
Title: [% issue.title %]
3) For DUEDGST and PREDUEDGST notices, set the message body to the following:
Titles:
[% FOREACH i IN issues %]
* [% i.title %]
[% END %]
4) Generate PREDUE and DUE notices for patrons including digests
5) Verify those notices contain the checkout titles

Signed-off-by: Felicity Brown <Felicity.Brown@montgomerycountymd.gov>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Kyle Hall 2021-09-23 13:24:42 -04:00 committed by Tomas Cohen Arazi
parent 0481f1d74e
commit 2114c70d11
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 16 additions and 2 deletions

View File

@ -294,7 +294,9 @@ UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) {
my $letter_type = 'DUE';
$sth->execute($upcoming->{'borrowernumber'},$upcoming->{'itemnumber'},'0');
my $titles = "";
my @issues;
while ( my $item_info = $sth->fetchrow_hashref()) {
push( @issues, $item_info );
$titles .= C4::Letters::get_item_content( { item => $item_info, item_content_fields => \@item_content_fields } );
}
@ -306,7 +308,10 @@ UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) {
branchcode => $branchcode,
biblionumber => $item->biblionumber,
itemnumber => $upcoming->{'itemnumber'},
substitute => { 'items.content' => $titles },
substitute => {
'items.content' => $titles,
issue => $issues[0],
},
message_transport_type => $transport,
} )
or warn "no letter of type '$letter_type' found for borrowernumber ".$upcoming->{'borrowernumber'}.". Please see sample_notices.sql";
@ -342,7 +347,9 @@ UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) {
my $letter_type = 'PREDUE';
$sth->execute($upcoming->{'borrowernumber'},$upcoming->{'itemnumber'},$borrower_preferences->{'days_in_advance'});
my $titles = "";
my @issues;
while ( my $item_info = $sth->fetchrow_hashref()) {
push( @issues, $item_info );
$titles .= C4::Letters::get_item_content( { item => $item_info, item_content_fields => \@item_content_fields } );
}
@ -354,7 +361,10 @@ UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) {
branchcode => $branchcode,
biblionumber => $item->biblionumber,
itemnumber => $upcoming->{'itemnumber'},
substitute => { 'items.content' => $titles },
substitute => {
'items.content' => $titles,
issue => $issues[0],
},
message_transport_type => $transport,
} )
or warn "no letter of type '$letter_type' found for borrowernumber ".$upcoming->{'borrowernumber'}.". Please see sample_notices.sql";
@ -593,8 +603,10 @@ sub send_digests {
});
my $titles = "";
my @itemnumbers;
my @issues;
while ( my $item_info = $next_item_info->()) {
push @itemnumbers, $item_info->{itemnumber};
push( @issues, $item_info );
$titles .= C4::Letters::get_item_content( { item => $item_info, item_content_fields => \@item_content_fields } );
}
@ -604,9 +616,11 @@ sub send_digests {
{
letter_code => $params->{letter_code},
borrowernumber => $borrowernumber,
issues => \@issues,
substitute => {
count => $count,
'items.content' => $titles,
issues => \@issues,
%branch_info
},
itemnumbers => \@itemnumbers,