From: Jonathan Druart Date: Mon, 9 Jun 2014 10:21:31 +0000 (+0200) Subject: Bug 11742: FIX the code parameter was not take into account X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=commitdiff_plain;ds=sidebyside;h=1ac6af8fe21c6838f1a0b5e3e8bf3efd0ee16156;hp=5c4fdcf78aab2d284f3b88f9926756acb6a4d48f;p=koha_fer Bug 11742: FIX the code parameter was not take into account In C4::Letters::GetLetters, the code filter was not used as a query parameter. Moreover, the JS code was buggy. We only need to check the letter code, except if it is an edit and the letter code has not been changed. Signed-off-by: Chris Cormack Signed-off-by: Katrin Fischer --- diff --git a/C4/Letters.pm b/C4/Letters.pm index ff63aac9d0..1d916e05d9 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -85,6 +85,7 @@ sub GetLetters { . ( $code ? q| AND code = ?| : q|| ) . q| GROUP BY code ORDER BY name|, { Slice => {} } , ( $module ? $module : () ) + , ( $code ? $code : () ) ); return $letters; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt index 34df1e7caf..7964e4147c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt @@ -59,7 +59,10 @@ $(document).ready(function() { return false; } [% END %] - if ( new_lettercode != '[% code %]' ) { + + [% IF ( add_form and code ) # IF edit %] + if ( new_lettercode != '[% code %]' ) { + [% END %] $.ajax({ data: { code: new_lettercode }, type: 'GET', @@ -73,9 +76,11 @@ $(document).ready(function() { } }, }); - } else { - $("#add_notice").submit(); - } + [% IF ( add_form and code ) %] + } else { + $("#add_notice").submit(); + } + [% END %] }); var sms_limit = 160;