From c2729752e6e13ce0abacf91c6dbd3fde0d25c65f Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 4 Dec 2017 16:16:52 +0000 Subject: [PATCH] Bug 19743 - Header and Footer should be updated on each item for checkin / checkout / renewal notices When generating the checkout notice for a patron we only update the section in between the '---' tags For template toolkit purposes it means we cannot affect the content based on more than a single item. For instance, we want to add the total cost of all items checked out. Test Plan: 1) Add "Thank you for visiting <>." to the bottom of the checkout notice. Below the second '----'. 2) Check out an item to a patron to generate that notice 3) Note the branch name in the notice 4) Update the branch name in the branches editor, change it to something else 5) Check out a 2nd item to that patron 6) Notice the items list updated, but the branch name did not 7) Apply this patch 8) Check out a 3rd item to that patron 9) Notice the branch name updated this time Signed-off-by: Te Rauhina Jackson --- C4/Message.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/C4/Message.pm b/C4/Message.pm index 30b71c8..3783ce8 100644 --- a/C4/Message.pm +++ b/C4/Message.pm @@ -311,10 +311,12 @@ If passed a string, it'll append the string to the message. # $object->append($letter_or_item) -- add a new item to a message's content sub append { my ($self, $letter_or_item, $format) = @_; - my $item; + my ( $item, $header, $footer ); if (ref($letter_or_item)) { my $letter = $letter_or_item; my $metadata = _metadata($letter); + $header = $metadata->{header}; + $footer = $metadata->{footer}; $item = $metadata->{body}->[0]; } else { $item = $letter_or_item; @@ -325,6 +327,8 @@ sub append { } my $metadata = $self->metadata; push @{$metadata->{body}}, $item; + $metadata->{header} = $header; + $metadata->{footer} = $footer; $self->metadata($metadata); my $new_content = $self->render_metadata($format); return $self->content($new_content); -- 2.1.4