Bug 1859: Do not display <<>> if an entry without value is selected
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 13 May 2016 21:03:08 +0000 (22:03 +0100)
committerKyle M Hall <kyle@bywatersolutions.com>
Mon, 16 May 2016 17:25:57 +0000 (17:25 +0000)
For instance there are ---TABLES--- to delimite fields' tables, if
selected we do not want to add "<<>>" to the letter.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt

index 8ed7a52..2af7a0e 100644 (file)
@@ -134,7 +134,7 @@ $(document).ready(function() {
 
             if($(myListBox).find('option').length > 0) {
                 $(myListBox).find('option').each( function (){
-                    if ( $(this).attr('selected') ) {
+                    if ( $(this).attr('selected') && $(this).val().length > 0 ) {
                         $(myQuery).insertAtCaret("<<" + $(this).val() + ">>");
                     }
                 });