From f19201a12ce1a0a611bc1fdee9ead5f3ba25a419 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 15 Dec 2021 10:09:22 +0100 Subject: [PATCH] Bug 29698: Make items available for PREDUEDGST With this patch you can access items using: Number of items [% items.count %] [% FOR i IN items %] [% SET checkout = i.checkout %] Item [% i.itemnumber %] is due on [% checkout.date_due | $KohaDates %] [% END %] == test plan == 1. Add the following to PREDUEDGST and DUEDST: Number of items [% items.count %] [% FOR i IN items %] [% SET checkout = i.checkout %] Item [% i.itemnumber %] is due on [% checkout.date_due | $KohaDates %] [% END %] 2. Find a patron and set there messaging prefs 'Item due' and 'Advanced notices' so they get an email and 'digest only'. On 'Advanced notices' set Days in advance to 1. 3. Check some things out to a patron and make them due tomorrow. 4. perl /kohadevbox/koha/misc/cronjobs/advance_notices.pl -v -c 5. Check the patrons notices and make sure the PREDUEDGST looks right. 6. Check some things out to a patron and make them due today. 7. Repeat 4. 8. Check the patrons notices and make sure the DUEDGST looks right. Signed-off-by: Lucas Gass Signed-off-by: Victor Grousset/tuxayo Signed-off-by: Fridolin Somers --- misc/cronjobs/advance_notices.pl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/misc/cronjobs/advance_notices.pl b/misc/cronjobs/advance_notices.pl index 96029dced0..9ec07659aa 100755 --- a/misc/cronjobs/advance_notices.pl +++ b/misc/cronjobs/advance_notices.pl @@ -492,6 +492,7 @@ sub parse_letter { lang => $patron->lang, substitute => $params->{'substitute'}, tables => \%table_params, + ( $params->{itemnumbers} ? ( loops => { items => $params->{itemnumbers} } ) : () ), message_transport_type => $params->{message_transport_type}, ); } @@ -587,7 +588,9 @@ sub send_digests { borrower_preferences => $borrower_preferences }); my $titles = ""; + my @itemnumbers; while ( my $item_info = $next_item_info->()) { + push @itemnumbers, $item_info->{itemnumber}; $titles .= C4::Letters::get_item_content( { item => $item_info, item_content_fields => \@item_content_fields } ); } @@ -601,6 +604,7 @@ sub send_digests { 'items.content' => $titles, %branch_info }, + itemnumbers => \@itemnumbers, branchcode => $branchcode, message_transport_type => $transport } -- 2.39.5