View | Details | Raw Unified | Return to bug 14206
Collapse All | Expand All

(-)a/C4/Letters.pm (-3 / +4 lines)
Lines 207-214 sub GetLettersAvailableForALibrary { Link Here
207
our %letter;
207
our %letter;
208
sub getletter {
208
sub getletter {
209
    my ( $module, $code, $branchcode, $message_transport_type ) = @_;
209
    my ( $module, $code, $branchcode, $message_transport_type ) = @_;
210
    $message_transport_type ||= 'email';
210
    $message_transport_type //= '%';
211
212
211
213
    if ( C4::Context->preference('IndependentBranches')
212
    if ( C4::Context->preference('IndependentBranches')
214
            and $branchcode
213
            and $branchcode
Lines 226-232 sub getletter { Link Here
226
    my $sth = $dbh->prepare(q{
225
    my $sth = $dbh->prepare(q{
227
        SELECT *
226
        SELECT *
228
        FROM letter
227
        FROM letter
229
        WHERE module=? AND code=? AND (branchcode = ? OR branchcode = '') AND message_transport_type = ?
228
        WHERE module=? AND code=? AND (branchcode = ? OR branchcode = '')
229
        AND message_transport_type LIKE ?
230
        ORDER BY branchcode DESC LIMIT 1
230
        ORDER BY branchcode DESC LIMIT 1
231
    });
231
    });
232
    $sth->execute( $module, $code, $branchcode, $message_transport_type );
232
    $sth->execute( $module, $code, $branchcode, $message_transport_type );
Lines 237-242 sub getletter { Link Here
237
    return { %$line };
237
    return { %$line };
238
}
238
}
239
239
240
240
=head2 DelLetter
241
=head2 DelLetter
241
242
242
    DelLetter(
243
    DelLetter(
(-)a/t/db_dependent/Letters.t (-2 / +7 lines)
Lines 18-24 Link Here
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
use Test::More tests => 58;
21
use Test::More tests => 60;
22
use Test::MockModule;
22
use Test::MockModule;
23
use Test::Warn;
23
use Test::Warn;
24
24
Lines 173-178 is( $letter->{title}, $title, 'GetLetters gets the title correctly' ); Link Here
173
is( $letter->{content}, $content, 'GetLetters gets the content correctly' );
173
is( $letter->{content}, $content, 'GetLetters gets the content correctly' );
174
is( $letter->{message_transport_type}, 'email', 'GetLetters gets the message type correctly' );
174
is( $letter->{message_transport_type}, 'email', 'GetLetters gets the message type correctly' );
175
175
176
# Regression test for Bug 14206
177
$dbh->do( q|INSERT INTO letter(branchcode,module,code,name,is_html,title,content,message_transport_type) VALUES ('FFL','my module','my code','my name',1,?,?,'print')|, undef, $title, $content );
178
my $letter14206_a = C4::Letters::getletter('my module', 'my code', 'FFL' );
179
is( $letter14206_a->{message_transport_type}, 'print', 'Bug 14206 - message_transport_type not passed, correct mtt detected' );
180
my $letter14206_b = C4::Letters::getletter('my module', 'my code', 'FFL', 'print');
181
is( $letter14206_b->{message_transport_type}, 'print', 'Bug 14206 - message_transport_type passed, correct mtt detected'  );
176
182
177
# addalert
183
# addalert
178
my $type = 'my type';
184
my $type = 'my type';
179
- 

Return to bug 14206