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 => 61; |
21 |
use Test::More tests => 64; |
22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
23 |
use Test::Warn; |
23 |
use Test::Warn; |
24 |
|
24 |
|
Lines 141-147
my $letters = C4::Letters::GetLetters();
Link Here
|
141 |
is( @$letters, 0, 'GetLetters returns the correct number of letters' ); |
141 |
is( @$letters, 0, 'GetLetters returns the correct number of letters' ); |
142 |
|
142 |
|
143 |
my $title = q|<<branches.branchname>> - <<status>>|; |
143 |
my $title = q|<<branches.branchname>> - <<status>>|; |
144 |
my $content = q|Dear <<borrowers.firstname>> <<borrowers.surname>>, |
144 |
my $content = q{Dear <<borrowers.firstname>> <<borrowers.surname>>, |
145 |
According to our current records, you have items that are overdue.Your library does not charge late fines, but please return or renew them at the branch below as soon as possible. |
145 |
According to our current records, you have items that are overdue.Your library does not charge late fines, but please return or renew them at the branch below as soon as possible. |
146 |
|
146 |
|
147 |
<<branches.branchname>> |
147 |
<<branches.branchname>> |
Lines 155-161
The following item(s) is/are currently <<status>>:
Link Here
|
155 |
Thank-you for your prompt attention to this matter. |
155 |
Thank-you for your prompt attention to this matter. |
156 |
Don't forget your date of birth: <<borrowers.dateofbirth>>. |
156 |
Don't forget your date of birth: <<borrowers.dateofbirth>>. |
157 |
Look at this wonderful biblio timestamp: <<biblio.timestamp>>. |
157 |
Look at this wonderful biblio timestamp: <<biblio.timestamp>>. |
158 |
|; |
158 |
}; |
159 |
|
159 |
|
160 |
$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 ); |
160 |
$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 ); |
161 |
$letters = C4::Letters::GetLetters(); |
161 |
$letters = C4::Letters::GetLetters(); |
Lines 279-284
The following item(s) is/are currently $substitute->{status}:
Link Here
|
279 |
Thank-you for your prompt attention to this matter. |
279 |
Thank-you for your prompt attention to this matter. |
280 |
Don't forget your date of birth: | . output_pref({ dt => $date, dateonly => 1 }) . q|. |
280 |
Don't forget your date of birth: | . output_pref({ dt => $date, dateonly => 1 }) . q|. |
281 |
Look at this wonderful biblio timestamp: | . output_pref({ dt => $date }) . ".\n"; |
281 |
Look at this wonderful biblio timestamp: | . output_pref({ dt => $date }) . ".\n"; |
|
|
282 |
|
282 |
is( $prepared_letter->{title}, $my_title_letter, 'GetPreparedLetter returns the title correctly' ); |
283 |
is( $prepared_letter->{title}, $my_title_letter, 'GetPreparedLetter returns the title correctly' ); |
283 |
is( $prepared_letter->{content}, $my_content_letter, 'GetPreparedLetter returns the content correctly' ); |
284 |
is( $prepared_letter->{content}, $my_content_letter, 'GetPreparedLetter returns the content correctly' ); |
284 |
|
285 |
|
Lines 294-299
$prepared_letter = GetPreparedLetter((
Link Here
|
294 |
$my_content_letter = qq|This is a SMS for an $substitute->{status}|; |
295 |
$my_content_letter = qq|This is a SMS for an $substitute->{status}|; |
295 |
is( $prepared_letter->{content}, $my_content_letter, 'GetPreparedLetter returns the content correctly' ); |
296 |
is( $prepared_letter->{content}, $my_content_letter, 'GetPreparedLetter returns the content correctly' ); |
296 |
|
297 |
|
|
|
298 |
$dbh->do(q{INSERT INTO letter (module, code, name, title, content) VALUES ('test_date','TEST_DATE','Test dates','Test dates','This one only contains the date: <<biblio.timestamp | dateonly>>.');}); |
299 |
$prepared_letter = GetPreparedLetter(( |
300 |
module => 'test_date', |
301 |
branchcode => '', |
302 |
letter_code => 'test_date', |
303 |
tables => $tables, |
304 |
substitute => $substitute, |
305 |
repeat => $repeat, |
306 |
)); |
307 |
is( $prepared_letter->{content}, q|This one only contains the date: | . output_pref({ dt => $date, dateonly => 1 }) . q|.| ); |
308 |
|
309 |
$dbh->do(q{UPDATE letter SET content = 'And also this one:<<timestamp | dateonly>>.' WHERE code = 'test_date';}); |
310 |
$prepared_letter = GetPreparedLetter(( |
311 |
module => 'test_date', |
312 |
branchcode => '', |
313 |
letter_code => 'test_date', |
314 |
tables => $tables, |
315 |
substitute => $substitute, |
316 |
repeat => $repeat, |
317 |
)); |
318 |
is( $prepared_letter->{content}, q|This one only contains the date: | . output_pref({ dt => $date, dateonly => 1 }) . q|.| ); |
319 |
|
320 |
$dbh->do(q{UPDATE letter SET content = 'And also this one:<<timestamp|dateonly >>.' WHERE code = 'test_date';}); |
321 |
$prepared_letter = GetPreparedLetter(( |
322 |
module => 'test_date', |
323 |
branchcode => '', |
324 |
letter_code => 'test_date', |
325 |
tables => $tables, |
326 |
substitute => $substitute, |
327 |
repeat => $repeat, |
328 |
)); |
329 |
is( $prepared_letter->{content}, q|This one only contains the date: | . output_pref({ dt => $date, dateonly => 1 }) . q|.| ); |
330 |
|
297 |
$dbh->do(q{INSERT INTO letter (module, code, name, title, content) VALUES ('claimacquisition','TESTACQCLAIM','Acquisition Claim','Item Not Received','<<aqbooksellers.name>>|<<aqcontacts.name>>|<order>Ordernumber <<aqorders.ordernumber>> (<<biblio.title>>) (<<aqorders.quantity>> ordered)</order>');}); |
331 |
$dbh->do(q{INSERT INTO letter (module, code, name, title, content) VALUES ('claimacquisition','TESTACQCLAIM','Acquisition Claim','Item Not Received','<<aqbooksellers.name>>|<<aqcontacts.name>>|<order>Ordernumber <<aqorders.ordernumber>> (<<biblio.title>>) (<<aqorders.quantity>> ordered)</order>');}); |
298 |
|
332 |
|
299 |
my $booksellerid = C4::Bookseller::AddBookseller( |
333 |
my $booksellerid = C4::Bookseller::AddBookseller( |
300 |
- |
|
|