From 1108795bcd050ce9b6ec6e8de4151bb70e819cb2 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Sun, 16 Dec 2018 11:02:56 -0300 Subject: [PATCH] Bug 22002: (bug 21621 follow-up) Re-add GROUP BY in letter.pl and fix it MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Caused by commit 0cffb0f7589aa52d65bda9a8a4934790a141f3a0 Bug 21621: Remove incorrect GROUP BY from tools/letter.pl The test plan was not complete enough. Test plan: 1) Go to Home › Tools › Notices & slips 2) Choose a letter to edit, e.g. PREDUE. Note that there is only a single row. 3) Click the edit button on the notice. 4) Expand the 'Print' section. Put text into the Message subject and Message body text areas. 5) Click save, this will take you back to the 'Notices & slips' page. 6) Clone PREDUE for a specific library 7) The 'all libraries' option must list the templates for all libraries, but without duplicate 8) Select a library in the dropdown list: only the templates for the given library is listed, without duplicate Signed-off-by: Barton Chittenden Signed-off-by: Katrin Fischer Signed-off-by: Nick Clemens (cherry picked from commit 99a75aca903eb076d12b46c3546e86d917d1e244) Signed-off-by: Martin Renvoize --- koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt | 2 +- tools/letter.pl | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) 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 c72b4ed2bf..9a0d7d4156 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt @@ -93,7 +93,7 @@ [% FOREACH lette IN letter %] [% can_edit = lette.branchcode || !independant_branch %] - [% IF lette.branchname %][% lette.branchname | html %][% ELSE %](All libraries)[% END %] + X[%lette.branchcode%]X[% IF lette.branchname%][% lette.branchname | html %][% ELSE %](All libraries)[% END %] [% SWITCH lette.module %] [% CASE 'acquisition' %]Acquisition diff --git a/tools/letter.pl b/tools/letter.pl index caaeb0e212..0cc0029394 100755 --- a/tools/letter.pl +++ b/tools/letter.pl @@ -377,6 +377,8 @@ sub retrieve_letters { } $sql .= " WHERE ".join(" AND ", @where) if @where; + $sql .= " GROUP BY branchcode,module,code,name,branchname"; + $sql .= " ORDER BY module, code, branchcode"; return $dbh->selectall_arrayref($sql, { Slice => {} }, @args); -- 2.39.5