Bugzilla – Attachment 59433 Details for
Bug 17963
TT syntax for notices - Prove that AR_* are compatible
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17963: TT syntax for notices - Prove that AR_* are compatible
Bug-17963-TT-syntax-for-notices---Prove-that-AR-ar.patch (text/plain), 4.80 KB, created by
Jonathan Druart
on 2017-01-23 15:52:30 UTC
(
hide
)
Description:
Bug 17963: TT syntax for notices - Prove that AR_* are compatible
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-01-23 15:52:30 UTC
Size:
4.80 KB
patch
obsolete
>From 5745365ad49616a2a48aa790d7104145a03520f8 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 16 Jan 2017 14:46:12 +0100 >Subject: [PATCH] Bug 17963: TT syntax for notices - Prove that AR_* are > compatible > >Nothing new here since bug 17962, the AR_* notice messages are quite >simple. They send the article_request, patron, biblio, biblioitem, item and >library linked to the article request. > >All the fields from these 6 tables should still be accessible using the >TT syntax. > >Test plan: >Define TT notice templates for AR_PENDING, AR_PROCESSING, AR_COMPLETED >or AR_CANCELED. > >You should manage to create a template to generate the same result as >the historical syntax. >--- > Koha/ArticleRequest.pm | 2 +- > t/db_dependent/Letters/TemplateToolkit.t | 54 +++++++++++++++++++++++++++++++- > 2 files changed, 54 insertions(+), 2 deletions(-) > >diff --git a/Koha/ArticleRequest.pm b/Koha/ArticleRequest.pm >index 75318fd..6b4daf4 100644 >--- a/Koha/ArticleRequest.pm >+++ b/Koha/ArticleRequest.pm >@@ -106,7 +106,7 @@ sub notify { > if ( > my $letter = C4::Letters::GetPreparedLetter( > module => 'circulation', >- letter_code => "AR_$status", >+ letter_code => "AR_$status", # AR_PENDING, AR_PROCESSING, AR_COMPLETED, AR_CANCELED > message_transport_type => 'email', > tables => { > article_requests => $self->id, >diff --git a/t/db_dependent/Letters/TemplateToolkit.t b/t/db_dependent/Letters/TemplateToolkit.t >index 9bf8033..41397c0 100644 >--- a/t/db_dependent/Letters/TemplateToolkit.t >+++ b/t/db_dependent/Letters/TemplateToolkit.t >@@ -30,6 +30,7 @@ use C4::Members; > use C4::Biblio; > use Koha::Database; > use Koha::DateUtils; >+use Koha::ArticleRequests; > use Koha::Biblio; > use Koha::Biblioitem; > use Koha::Item; >@@ -39,6 +40,7 @@ use Koha::Serial; > use Koha::Subscription; > use Koha::Suggestion; > use Koha::Checkout; >+use Koha::Notice::Messages; > use Koha::Notice::Templates; > use Koha::Patron::Modification; > >@@ -282,7 +284,7 @@ $prepared_letter = GetPreparedLetter( > is( $prepared_letter->{content}, $modification->id(), 'Patron modification object used correctly' ); > > subtest 'regression tests' => sub { >- plan tests => 1; >+ plan tests => 2; > > my $library = $builder->build( { source => 'Branch' } ); > my $patron = $builder->build( { source => 'Borrower' } ); >@@ -323,6 +325,56 @@ subtest 'regression tests' => sub { > > is( $tt_letter->{content}, $letter->{content}, ); > }; >+ >+ subtest 'AR_*' => sub { >+ plan tests => 1; >+ my $code = 'AR_CANCELED'; >+ my $article_request = $builder->build({ source => 'ArticleRequest' }); >+ my $branchcode = $library->{branchcode}; >+ >+ my $template = q| >+ <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>) >+ >+ Your request for an article from <<biblio.title>> (<<items.barcode>>) has been canceled for the following reason: >+ >+ <<article_requests.notes>> >+ >+ Article requested: >+ Title: <<article_requests.title>> >+ Author: <<article_requests.author>> >+ Volume: <<article_requests.volume>> >+ Issue: <<article_requests.issue>> >+ Date: <<article_requests.date>> >+ Pages: <<article_requests.pages>> >+ Chapters: <<article_requests.chapters>> >+ Notes: <<article_requests.patron_notes>> >+ |; >+ reset_template( { template => $template, code => $code, module => 'circulation' } ); >+ Koha::ArticleRequests->find( $article_request->{id} )->cancel; >+ my $letter = Koha::Notice::Messages->single( {}, { order_by => { -desc => 'id' } } ); >+ >+ my $tt_template = q| >+ [% borrower.firstname %] [% borrower.surname %] ([% borrower.cardnumber %]) >+ >+ Your request for an article from [% biblio.title %] ([% items.barcode %]) has been canceled for the following reason: >+ >+ [% article_request.notes %] >+ >+ Article requested: >+ Title: [% article_request.title %] >+ Author: [% article_request.author %] >+ Volume: [% article_request.volume %] >+ Issue: [% article_request.issue %] >+ Date: [% article_request.date %] >+ Pages: [% article_request.pages %] >+ Chapters: [% article_request.chapters %] >+ Notes: [% article_request.patron_notes %] >+ |; >+ reset_template( { template => $template, code => $code, module => 'circulation' } ); >+ Koha::ArticleRequests->find( $article_request->{id} )->cancel; >+ my $tt_letter = Koha::Notice::Messages->single( {}, { order_by => { -desc => 'id' } } ); >+ is( $tt_letter->{content}, $letter->{content}, ); >+ }; > }; > > sub reset_template { >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17963
:
59433
|
59434
|
59440
|
59539
|
60402
|
61594