diff --git a/C4/Letters.pm b/C4/Letters.pm index 3268f4ba80..1fe54a7c23 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -776,14 +776,18 @@ sub _parseletter_sth { parameters : - $letter : a hash to letter fields (title & content useful) - $table : the Koha table to parse. - - $values : table record hashref + - $values_in : table record hashref parse all fields from a table, and replace values in title & content with the appropriate value (not exported sub, used only internally) =cut sub _parseletter { - my ( $letter, $table, $values ) = @_; + my ( $letter, $table, $values_in ) = @_; + + # Work on a local copy of $values_in (passed by reference) to avoid side effects + # in callers ( by changing / formatting values ) + my $values = { %$values_in }; if ( $table eq 'reserves' && $values->{'waitingdate'} ) { my @waitingdate = split /-/, $values->{'waitingdate'};