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

(-)a/Koha/ArticleRequest.pm (-1 / +1 lines)
Lines 106-112 sub notify { Link Here
106
    if (
106
    if (
107
        my $letter = C4::Letters::GetPreparedLetter(
107
        my $letter = C4::Letters::GetPreparedLetter(
108
            module                 => 'circulation',
108
            module                 => 'circulation',
109
            letter_code            => "AR_$status",
109
            letter_code            => "AR_$status", # AR_PENDING, AR_PROCESSING, AR_COMPLETED, AR_CANCELED
110
            message_transport_type => 'email',
110
            message_transport_type => 'email',
111
            tables                 => {
111
            tables                 => {
112
                article_requests => $self->id,
112
                article_requests => $self->id,
(-)a/t/db_dependent/Letters/TemplateToolkit.t (-2 / +53 lines)
Lines 30-35 use C4::Members; Link Here
30
use C4::Biblio;
30
use C4::Biblio;
31
use Koha::Database;
31
use Koha::Database;
32
use Koha::DateUtils;
32
use Koha::DateUtils;
33
use Koha::ArticleRequests;
33
use Koha::Biblio;
34
use Koha::Biblio;
34
use Koha::Biblioitem;
35
use Koha::Biblioitem;
35
use Koha::Item;
36
use Koha::Item;
Lines 39-44 use Koha::Serial; Link Here
39
use Koha::Subscription;
40
use Koha::Subscription;
40
use Koha::Suggestion;
41
use Koha::Suggestion;
41
use Koha::Checkout;
42
use Koha::Checkout;
43
use Koha::Notice::Messages;
42
use Koha::Notice::Templates;
44
use Koha::Notice::Templates;
43
use Koha::Patron::Modification;
45
use Koha::Patron::Modification;
44
46
Lines 282-288 $prepared_letter = GetPreparedLetter( Link Here
282
is( $prepared_letter->{content}, $modification->id(), 'Patron modification object used correctly' );
284
is( $prepared_letter->{content}, $modification->id(), 'Patron modification object used correctly' );
283
285
284
subtest 'regression tests' => sub {
286
subtest 'regression tests' => sub {
285
    plan tests => 1;
287
    plan tests => 2;
286
288
287
    my $library = $builder->build( { source => 'Branch' } );
289
    my $library = $builder->build( { source => 'Branch' } );
288
    my $patron  = $builder->build( { source => 'Borrower' } );
290
    my $patron  = $builder->build( { source => 'Borrower' } );
Lines 323-328 subtest 'regression tests' => sub { Link Here
323
325
324
        is( $tt_letter->{content}, $letter->{content}, );
326
        is( $tt_letter->{content}, $letter->{content}, );
325
    };
327
    };
328
329
    subtest 'AR_*' => sub {
330
        plan tests => 1;
331
        my $code = 'AR_CANCELED';
332
        my $article_request = $builder->build({ source => 'ArticleRequest' });
333
        my $branchcode = $library->{branchcode};
334
335
        my $template = q|
336
            <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>)
337
338
            Your request for an article from <<biblio.title>> (<<items.barcode>>) has been canceled for the following reason:
339
340
            <<article_requests.notes>>
341
342
            Article requested:
343
            Title: <<article_requests.title>>
344
            Author: <<article_requests.author>>
345
            Volume: <<article_requests.volume>>
346
            Issue: <<article_requests.issue>>
347
            Date: <<article_requests.date>>
348
            Pages: <<article_requests.pages>>
349
            Chapters: <<article_requests.chapters>>
350
            Notes: <<article_requests.patron_notes>>
351
        |;
352
        reset_template( { template => $template, code => $code, module => 'circulation' } );
353
        Koha::ArticleRequests->find( $article_request->{id} )->cancel;
354
        my $letter = Koha::Notice::Messages->single( {}, { order_by => { -desc => 'id' } } );
355
356
        my $tt_template = q|
357
            [% borrower.firstname %] [% borrower.surname %] ([% borrower.cardnumber %])
358
359
            Your request for an article from [% biblio.title %] ([% items.barcode %]) has been canceled for the following reason:
360
361
            [% article_request.notes %]
362
363
            Article requested:
364
            Title: [% article_request.title %]
365
            Author: [% article_request.author %]
366
            Volume: [% article_request.volume %]
367
            Issue: [% article_request.issue %]
368
            Date: [% article_request.date %]
369
            Pages: [% article_request.pages %]
370
            Chapters: [% article_request.chapters %]
371
            Notes: [% article_request.patron_notes %]
372
        |;
373
        reset_template( { template => $template, code => $code, module => 'circulation' } );
374
        Koha::ArticleRequests->find( $article_request->{id} )->cancel;
375
        my $tt_letter = Koha::Notice::Messages->single( {}, { order_by => { -desc => 'id' } } );
376
        is( $tt_letter->{content}, $letter->{content}, );
377
    };
326
};
378
};
327
379
328
sub reset_template {
380
sub reset_template {
329
- 

Return to bug 17963