Bugzilla – Attachment 46076 Details for
Bug 15429
sub _parseletter should not change referenced values
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15429 - sub _parseletter should not change referenced values
Bug-15429---sub-parseletter-should-not-change-refe.patch (text/plain), 1.85 KB, created by
Jonathan Druart
on 2015-12-30 13:16:00 UTC
(
hide
)
Description:
Bug 15429 - sub _parseletter should not change referenced values
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-12-30 13:16:00 UTC
Size:
1.85 KB
patch
obsolete
>From 8668170eda72c9baf60ff3ad157da76617b63d03 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Marc=20V=C3=A9ron?= <veron@veron.ch> >Date: Mon, 28 Dec 2015 10:29:17 +0100 >Subject: [PATCH] Bug 15429 - sub _parseletter should not change referenced > values >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >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> >--- > C4/Letters.pm | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index bc60bc3..d07d33f 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -790,14 +790,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 'borrowers' && $values->{'dateexpiry'} ){ > $values->{'dateexpiry'} = format_sqldatetime( $values->{'dateexpiry'} ); >-- >2.1.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15429
:
45994
|
46072
|
46073
| 46076 |
46077
|
46160