Bug 15429 - sub _parseletter should not change referenced values
In C4/Letters.pm, sub _parseletter changes values that are passed by reference. E.g. patron's expiry date can change from iso format to syspref format, leading to strange behaviour in the calling routines (see Bug 15423). This patch makes sub _parseletter work on a copy of the referenced values. (Submitted to get feedback - is this the way to go?) Signed-off-by: Frédéric Demians <f.demians@tamil.fr> Good solution to real time bomb. Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> (cherry picked from commit002a2dcb1f) Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> (cherry picked from commitcc3b2d0590) Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
This commit is contained in:
parent
4ad5decf4a
commit
a7d0a998bc
|
|
@ -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'};
|
||||
|
|
|
|||
Loading…
Reference in New Issue