Bug 9016: (follow-up) make GetLetters return all letters

GetLetters only returns letters with a mtt = email. It should return all
letter codes in the DB.

The message_transport_type parameter is never used.

To reproduce the issue:
Create a notice with a sms template and no email template.
Go on the overdue rules configucation page.
The notice does not appear in the notice list.

Signed-off-by: Olli-Antti Kivilahti <kivilahtio@ProBook6570b>

---------------
Testing report:
---------------
Testing this subroutine from a test stub. Calling the method without arguments
and with argument 'circulation' and 'circulat'.
Works as supposed to.
Related Bug 11931 discovered but not within the scope of this featureset.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Jonathan Druart 2014-03-06 15:18:12 +01:00 committed by Galen Charlton
parent e778fb80c1
commit dc95637ef0

View file

@ -98,18 +98,17 @@ $template->param(LETTERLOOP => \@letterloop);
sub GetLetters {
# returns a reference to a hash of references to ALL letters...
my ( $cat, $message_transport_type ) = @_;
$message_transport_type ||= 'email';
my ( $cat ) = @_;
my %letters;
my $dbh = C4::Context->dbh;
my $sth;
my $query = q{
SELECT * FROM letter WHERE
SELECT * FROM letter WHERE 1
};
$query .= q{ module = ? AND } if defined $cat;
$query .= q{ message_transport_type = ? ORDER BY name};
$query .= q{ AND module = ? } if defined $cat;
$query .= q{ GROUP BY code ORDER BY name};
$sth = $dbh->prepare($query);
$sth->execute((defined $cat ? $cat : ()), $message_transport_type);
$sth->execute((defined $cat ? $cat : ()));
while ( my $letter = $sth->fetchrow_hashref ) {
$letters{ $letter->{'code'} } = $letter->{'name'};