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

(-)a/t/db_dependent/Letters.t (-3 / +16 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 => 72;
21
use Test::More tests => 73;
22
use Test::MockModule;
22
use Test::MockModule;
23
use Test::Warn;
23
use Test::Warn;
24
24
Lines 306-312 $prepared_letter = GetPreparedLetter(( Link Here
306
$my_content_letter = qq|This is a SMS for an $substitute->{status}|;
306
$my_content_letter = qq|This is a SMS for an $substitute->{status}|;
307
is( $prepared_letter->{content}, $my_content_letter, 'GetPreparedLetter returns the content correctly' );
307
is( $prepared_letter->{content}, $my_content_letter, 'GetPreparedLetter returns the content correctly' );
308
308
309
$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>>.');});
309
$dbh->do(q{INSERT INTO letter (module, code, name, title, content) VALUES ('test_date','TEST_DATE','Test dates','A title with a timestamp: <<biblio.timestamp>>','This one only contains the date: <<biblio.timestamp | dateonly>>.');});
310
$prepared_letter = GetPreparedLetter((
310
$prepared_letter = GetPreparedLetter((
311
    module                 => 'test_date',
311
    module                 => 'test_date',
312
    branchcode             => '',
312
    branchcode             => '',
Lines 339-344 $prepared_letter = GetPreparedLetter(( Link Here
339
));
339
));
340
is( $prepared_letter->{content}, q|And also this one:| . output_pref({ dt => $date, dateonly => 1 }) . q|.|, 'dateonly test 3' );
340
is( $prepared_letter->{content}, q|And also this one:| . output_pref({ dt => $date, dateonly => 1 }) . q|.|, 'dateonly test 3' );
341
341
342
t::lib::Mocks::mock_preference( 'TimeFormat', '12hr' );
343
my $yesterday_night = $date->clone->add( days => -1 )->set_hour(22);
344
$dbh->do(q|UPDATE biblio SET timestamp = ? WHERE biblionumber = ?|, undef, $yesterday_night, $biblionumber );
345
$dbh->do(q{UPDATE letter SET content = 'And also this one:<<timestamp>>.' WHERE code = 'test_date';});
346
$prepared_letter = GetPreparedLetter((
347
    module                 => 'test_date',
348
    branchcode             => '',
349
    letter_code            => 'test_date',
350
    tables                 => $tables,
351
    substitute             => $substitute,
352
    repeat                 => $repeat,
353
));
354
is( $prepared_letter->{content}, q|And also this one:| . output_pref({ dt => $yesterday_night }) . q|.|, 'dateonly test 3' );
355
342
$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>');});
356
$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>');});
343
357
344
# Test that _parseletter doesn't modify its parameters bug 15429
358
# Test that _parseletter doesn't modify its parameters bug 15429
345
- 

Return to bug 16624