Bugzilla – Attachment 59482 Details for
Bug 17970
GetPreparedLetter does not warn when expected
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17970: Fix GetPreparedLetter behavior if nothing to substitute
Bug-17970-Fix-GetPreparedLetter-behavior-if-nothin.patch (text/plain), 1.95 KB, created by
Mark Tompsett
on 2017-01-24 03:32:09 UTC
(
hide
)
Description:
Bug 17970: Fix GetPreparedLetter behavior if nothing to substitute
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2017-01-24 03:32:09 UTC
Size:
1.95 KB
patch
obsolete
>From 5409f61488f960ab74550aa1ca6fb7656842daf5 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Sat, 21 Jan 2017 14:13:49 +0100 >Subject: [PATCH] Bug 17970: Fix GetPreparedLetter behavior if nothing to > substitute > >From C4::Letters::GetPreparedLetter: > > my $tables = $params{tables}; > my $substitute = $params{substitute}; > > $tables || $substitute || $repeat > or carp( "ERROR: nothing to substitute - both 'tables' and 'substitute' are empty" ), > return; > >So if the parameter tables or substitute is passed but does not contain anything, it will not warn as expected. > >Test plan: >1/ Apply the patch with tests >2/ Confirm that they do not pass >3/ Apply this patch >4/ Confirm that the tests now pass > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> >--- > C4/Letters.pm | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 3ff39b1..0415854 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -689,15 +689,15 @@ sub GetPreparedLetter { > or warn( "No $module $letter_code letter transported by " . $mtt ), > return; > >- my $tables = $params{tables}; >- my $substitute = $params{substitute}; >+ my $tables = $params{tables} || {}; >+ my $substitute = $params{substitute} || {}; > my $repeat = $params{repeat}; >- $tables || $substitute || $repeat >+ %$tables || %$substitute || $repeat > or carp( "ERROR: nothing to substitute - both 'tables' and 'substitute' are empty" ), > return; > my $want_librarian = $params{want_librarian}; > >- if ($substitute) { >+ if (%$substitute) { > while ( my ($token, $val) = each %$substitute ) { > if ( $token eq 'items.content' ) { > $val =~ s|\n|<br/>|g if $letter->{is_html}; >@@ -743,7 +743,7 @@ sub GetPreparedLetter { > } > } > >- if ($tables) { >+ if (%$tables) { > _substitute_tables( $letter, $tables ); > } > >-- >2.1.4
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 17970
:
59422
|
59423
|
59424
|
59425
|
59481
|
59482
|
60976
|
60977