From 09a7c74306d4787c832d27a2fa13fc02b9c097a2 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 12 May 2016 20:35:01 -0400 Subject: [PATCH] Bug 1859 - Notice fields: can't select multiple fields at once When selecting database fields to appear in a notice, selecting multiple fields at once doesn't work correctly. The selected fields are grouped together between << and >> instead of each being bracketed separately. This patch corrects this problem. Also changed: Removal of 'onclick'; Conversion of 'insert' button to a Bootstrap buttons styled with a Font Awesome icon; HTML validation error fixes. To test, apply the patch and go to Tools -> Notices & Slips. - Edit any notice. - Select a notice version to edit (Email, Print, etc.). - Confirm that the "Insert" button looks correct. - Using ctrl+click, select multiple database fields to add to the notice. Confirm that clicking the "Insert" button adds the fields correctly. - Confirm that there are no HTML validation errors. Signed-off-by: Nicole C Engard Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall (cherry picked from commit 9b99d7810176726fe28c65d17c7f93dcd95cdd09) Signed-off-by: Julian Maurice --- .../prog/en/modules/tools/letter.tt | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) 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 6f82662715..8b55d9e07e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt @@ -97,7 +97,11 @@ $(document).ready(function() { } }); $( "#transport-types" ).accordion({ collapsible: true, active:false, animate: 200 }); -}); + $(".insert").on("click",function(){ + var containerid = $(this).data("containerid"); + insertValueQuery( containerid ); + }) +}); [% IF add_form or copy_form %] function cancel(f) { @@ -129,17 +133,11 @@ $(document).ready(function() { var myListBox = $(fieldset).find('select[name="SQLfieldname"]'); if($(myListBox).find('option').length > 0) { - var chaineAj = ""; - var NbSelect = 0; $(myListBox).find('option').each( function (){ if ( $(this).attr('selected') ) { - NbSelect++; - if (NbSelect > 1) - chaineAj += ", "; - chaineAj += $(this).val(); + $(myQuery).insertAtCaret("<<" + $(this).val() + ">>"); } - } ); - $(myQuery).insertAtCaret("<<" + chaineAj + ">>"); + }); } } [% END %] @@ -277,8 +275,8 @@ $(document).ready(function() { [% ELSE %]
  • - [% IF adding %] + [% ELSE %] + Library: - [% Branches.GetName( branchcode ) %] + [% IF ( branchcode ) %] + [% Branches.GetName( branchcode ) %] + [% ELSE %] + All libraries + [% END %] [% END %]
  • [% END %] @@ -352,8 +355,8 @@ $(document).ready(function() { Required [% ELSE %] - - + Code: + [% code %] [% END %] @@ -418,7 +421,9 @@ $(document).ready(function() { [% END %] - + + + -- 2.39.5