Bug 22002: (bug 21621 follow-up) Re-add GROUP BY in letter.pl and fix it

Caused by
  commit 0cffb0f758
  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 <barton@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2018-12-16 11:02:56 -03:00 committed by Lucas Gass
parent 36ed18b58f
commit 067137eb53
2 changed files with 3 additions and 1 deletions

View File

@ -91,7 +91,7 @@
[% FOREACH lette IN letter %]
[% can_edit = lette.branchcode || !independant_branch %]
<tr>
<td>[% IF lette.branchname %][% lette.branchname %][% ELSE %](All libraries)[% END %]</td>
<td>X[%lette.branchcode%]X[% IF lette.branchname%][% lette.branchname | html %][% ELSE %](All libraries)[% END %]</td>
<td>
[% SWITCH lette.module %]
[% CASE 'acquisition' %]<span>Acquisition</span>

View File

@ -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);