Bug 9016: (follow-up) make GetLetters return all letters
authorJonathan Druart <jonathan.druart@biblibre.com>
Thu, 6 Mar 2014 14:18:12 +0000 (15:18 +0100)
committerGalen Charlton <gmc@esilibrary.com>
Fri, 2 May 2014 20:29:17 +0000 (20:29 +0000)
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>
C4/Letters.pm

index 51020b6..7b55762 100644 (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'};