Bug 11742: FIX the code parameter was not take into account
authorJonathan Druart <jonathan.druart@biblibre.com>
Mon, 9 Jun 2014 10:21:31 +0000 (12:21 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Mon, 23 Jun 2014 18:19:56 +0000 (15:19 -0300)
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 <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
C4/Letters.pm
koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt

index ff63aac..1d916e0 100644 (file)
@@ -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;
index 34df1e7..7964e41 100644 (file)
@@ -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;