From c9ffb63b820ecf88b6bfd3761b1ac52bce74ed4a 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 --- 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.10.2