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

(-)a/t/db_dependent/Letters.t (-5 / +17 lines)
Lines 21-30 use Modern::Perl; Link Here
21
21
22
use Test::More tests => 45;
22
use Test::More tests => 45;
23
23
24
use MARC::Record;
25
use C4::Biblio qw( AddBiblio );
24
use C4::Context;
26
use C4::Context;
25
use C4::Letters;
27
use C4::Letters;
26
use C4::Members;
28
use C4::Members;
27
use C4::Branch;
29
use C4::Branch;
30
use Koha::DateUtils qw( dt_from_string output_pref );
28
use t::lib::Mocks;
31
use t::lib::Mocks;
29
32
30
my $dbh = C4::Context->dbh;
33
my $dbh = C4::Context->dbh;
Lines 37-49 $dbh->do(q|DELETE FROM letter|); Link Here
37
$dbh->do(q|DELETE FROM message_queue|);
40
$dbh->do(q|DELETE FROM message_queue|);
38
$dbh->do(q|DELETE FROM message_transport_types|);
41
$dbh->do(q|DELETE FROM message_transport_types|);
39
42
43
my $date = dt_from_string;
40
my $borrowernumber = AddMember(
44
my $borrowernumber = AddMember(
41
    firstname    => 'Jane',
45
    firstname    => 'Jane',
42
    surname      => 'Smith',
46
    surname      => 'Smith',
43
    categorycode => 'PT',
47
    categorycode => 'PT',
44
    branchcode   => 'CPL',
48
    branchcode   => 'CPL',
49
    dateofbirth  => $date,
45
);
50
);
46
51
52
my $marc_record = MARC::Record->new;
53
my( $biblionumber, $biblioitemnumber ) = AddBiblio( $marc_record, '' );
47
54
48
# GetMessageTransportTypes
55
# GetMessageTransportTypes
49
my $mtts = C4::Letters::GetMessageTransportTypes();
56
my $mtts = C4::Letters::GetMessageTransportTypes();
Lines 126-132 The following item(s) is/are currently <<status>>: Link Here
126
133
127
<item> <<count>>. <<items.itemcallnumber>>, Barcode: <<items.barcode>> </item>
134
<item> <<count>>. <<items.itemcallnumber>>, Barcode: <<items.barcode>> </item>
128
135
129
Thank-you for your prompt attention to this matter.|;
136
Thank-you for your prompt attention to this matter.
137
Don't forget your date of birth: <<borrowers.dateofbirth>>.
138
Look at this wonderful biblio timestamp: <<biblio.timestamp>>.
139
|;
130
140
131
$dbh->do( q|INSERT INTO letter(branchcode,module,code,name,is_html,title,content,message_transport_type) VALUES ('CPL','my module','my code','my name',1,?,?,'email')|, undef, $title, $content );
141
$dbh->do( q|INSERT INTO letter(branchcode,module,code,name,is_html,title,content,message_transport_type) VALUES ('CPL','my module','my code','my name',1,?,?,'email')|, undef, $title, $content );
132
$letters = C4::Letters::GetLetters();
142
$letters = C4::Letters::GetLetters();
Lines 189-200 is( @$alerts, 0, 'delalert removes an alert' ); Link Here
189
# GetPreparedLetter
199
# GetPreparedLetter
190
t::lib::Mocks::mock_preference('OPACBaseURL', 'http://thisisatest.com');
200
t::lib::Mocks::mock_preference('OPACBaseURL', 'http://thisisatest.com');
191
201
192
$content = 'This is a SMS for an <<status>>';
202
my $sms_content = 'This is a SMS for an <<status>>';
193
$dbh->do( q|INSERT INTO letter(branchcode,module,code,name,is_html,title,content,message_transport_type) VALUES ('CPL','my module','my code','my name',1,'my title',?,'sms')|, undef, $content );
203
$dbh->do( q|INSERT INTO letter(branchcode,module,code,name,is_html,title,content,message_transport_type) VALUES ('CPL','my module','my code','my name',1,'my title',?,'sms')|, undef, $sms_content );
194
204
195
my $tables = {
205
my $tables = {
196
    borrowers => $borrowernumber,
206
    borrowers => $borrowernumber,
197
    branches => 'CPL',
207
    branches => 'CPL',
208
    biblio => $biblionumber,
198
};
209
};
199
my $substitute = {
210
my $substitute = {
200
    status => 'overdue',
211
    status => 'overdue',
Lines 231-237 The following item(s) is/are currently $substitute->{status}: Link Here
231
<item> 1. $repeat->[0]->{itemcallnumber}, Barcode: $repeat->[0]->{barcode} </item>
242
<item> 1. $repeat->[0]->{itemcallnumber}, Barcode: $repeat->[0]->{barcode} </item>
232
<item> 2. $repeat->[1]->{itemcallnumber}, Barcode: $repeat->[1]->{barcode} </item>
243
<item> 2. $repeat->[1]->{itemcallnumber}, Barcode: $repeat->[1]->{barcode} </item>
233
244
234
Thank-you for your prompt attention to this matter.|;
245
Thank-you for your prompt attention to this matter.
246
Don't forget your date of birth: | . output_pref({ dt => $date, dateonly => 1 }) . q|.
247
Look at this wonderful biblio timestamp: | . output_pref({ dt => $date }) . ".\n";
235
is( $prepared_letter->{title}, $my_title_letter, 'GetPreparedLetter returns the title correctly' );
248
is( $prepared_letter->{title}, $my_title_letter, 'GetPreparedLetter returns the title correctly' );
236
is( $prepared_letter->{content}, $my_content_letter, 'GetPreparedLetter returns the content correctly' );
249
is( $prepared_letter->{content}, $my_content_letter, 'GetPreparedLetter returns the content correctly' );
237
250
238
- 

Return to bug 11244