Bugzilla – Attachment 64334 Details for
Bug 17975
TT syntax for notices - Prove that HOLD_SLIP is compatible
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17975: TT syntax for notices - Prove that HOLD_SLIP is compatible
Bug-17975-TT-syntax-for-notices---Prove-that-HOLDS.patch (text/plain), 6.06 KB, created by
Kyle M Hall (khall)
on 2017-06-15 14:56:58 UTC
(
hide
)
Description:
Bug 17975: TT syntax for notices - Prove that HOLD_SLIP is compatible
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2017-06-15 14:56:58 UTC
Size:
6.06 KB
patch
obsolete
>From ad844a8754bea67714ae2c71f3a85a83d4c9c575 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 16 Jan 2017 17:33:39 +0100 >Subject: [PATCH] Bug 17975: TT syntax for notices - Prove that HOLD_SLIP is > compatible >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Here we need to test <<today>>. >We already pass a value, but it was wrong. We must pass a string, not a >DateTime object, otherwise the KohaDates plugin will not display the >hours part if we need it. > >Test plan: >Define a HOLD_SLIP notice template to match your need. >Do not forget to use > [% today | $KohaDates %] >or > [% today | $KohaDates with_hours => 1 %] >To access data from the reserves table, use the 'hold' variable > >Tested both patches together with several date formats, works as expected. >Signed-off-by: Marc Véron <veron@veron.ch> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Letters.pm | 2 +- > t/db_dependent/Letters/TemplateToolkit.t | 86 +++++++++++++++++++++++++++++++- > 2 files changed, 85 insertions(+), 3 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 1d87a46..ada2794 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -1627,7 +1627,7 @@ sub _get_tt_params { > } > } > >- $params->{today} = dt_from_string(); >+ $params->{today} = output_pref({ dt => dt_from_string, dateformat => 'iso' }); > > return $params; > } >diff --git a/t/db_dependent/Letters/TemplateToolkit.t b/t/db_dependent/Letters/TemplateToolkit.t >index 4fd000a..075b6f4 100644 >--- a/t/db_dependent/Letters/TemplateToolkit.t >+++ b/t/db_dependent/Letters/TemplateToolkit.t >@@ -286,11 +286,11 @@ $prepared_letter = GetPreparedLetter( > is( $prepared_letter->{content}, $modification->id(), 'Patron modification object used correctly' ); > > subtest 'regression tests' => sub { >- plan tests => 4; >+ plan tests => 5; > > my $library = $builder->build( { source => 'Branch' } ); > my $patron = $builder->build( { source => 'Borrower' } ); >- my $biblio1 = Koha::Biblio->new({title => 'Test Biblio 1'})->store->unblessed; >+ my $biblio1 = Koha::Biblio->new({title => 'Test Biblio 1', author => 'An author', })->store->unblessed; > my $biblioitem1 = Koha::Biblioitem->new({biblionumber => $biblio1->{biblionumber}})->store()->unblessed; > my $item1 = Koha::Item->new( > { >@@ -300,6 +300,7 @@ subtest 'regression tests' => sub { > homebranch => $library->{branchcode}, > holdingbranch => $library->{branchcode}, > itype => 'BK', >+ itemcallnumber => 'itemcallnumber1', > } > )->store->unblessed; > my $biblio2 = Koha::Biblio->new({title => 'Test Biblio 2'})->store->unblessed; >@@ -312,6 +313,7 @@ subtest 'regression tests' => sub { > homebranch => $library->{branchcode}, > holdingbranch => $library->{branchcode}, > itype => 'BK', >+ itemcallnumber => 'itemcallnumber2', > } > )->store->unblessed; > >@@ -500,6 +502,86 @@ You have [% count %] items due > my $tt_letter = process_letter( { template => $tt_template, %$params }); > is( $tt_letter->{content}, $letter->{content}, ); > }; >+ >+ subtest 'HOLD_SLIP|dates|today' => sub { >+ plan tests => 2; >+ >+ my $code = 'HOLD_SLIP'; >+ >+ C4::Reserves::AddReserve( $library->{branchcode}, $patron->{borrowernumber}, $biblio1->{biblionumber}, undef, undef, undef, undef, "a note", undef, $item1->{itemnumber}, 'W' ); >+ C4::Reserves::AddReserve( $library->{branchcode}, $patron->{borrowernumber}, $biblio2->{biblionumber}, undef, undef, undef, undef, "another note", undef, $item2->{itemnumber} ); >+ >+ my $template = <<EOF; >+<h5>Date: <<today>></h5> >+ >+<h3> Transfer to/Hold in <<branches.branchname>></h3> >+ >+<h3><<borrowers.surname>>, <<borrowers.firstname>></h3> >+ >+<ul> >+ <li><<borrowers.cardnumber>></li> >+ <li><<borrowers.phone>></li> >+ <li> <<borrowers.address>><br /> >+ <<borrowers.address2>><br /> >+ <<borrowers.city>> <<borrowers.zipcode>> >+ </li> >+ <li><<borrowers.email>></li> >+</ul> >+<br /> >+<h3>ITEM ON HOLD</h3> >+<h4><<biblio.title>></h4> >+<h5><<biblio.author>></h5> >+<ul> >+ <li><<items.barcode>></li> >+ <li><<items.itemcallnumber>></li> >+ <li><<reserves.waitingdate>></li> >+</ul> >+<p>Notes: >+<pre><<reserves.reservenotes>></pre> >+</p> >+EOF >+ >+ reset_template( { template => $template, code => $code, module => 'circulation' } ); >+ my $letter_for_item1 = C4::Reserves::ReserveSlip( $library->{branchcode}, $patron->{borrowernumber}, $biblio1->{biblionumber} ); >+ my $letter_for_item2 = C4::Reserves::ReserveSlip( $library->{branchcode}, $patron->{borrowernumber}, $biblio2->{biblionumber} ); >+ >+ my $tt_template = <<EOF; >+<h5>Date: [% today | \$KohaDates with_hours => 1 %]</h5> >+ >+<h3> Transfer to/Hold in [% branch.branchname %]</h3> >+ >+<h3>[% borrower.surname %], [% borrower.firstname %]</h3> >+ >+<ul> >+ <li>[% borrower.cardnumber %]</li> >+ <li>[% borrower.phone %]</li> >+ <li> [% borrower.address %]<br /> >+ [% borrower.address2 %]<br /> >+ [% borrower.city %] [% borrower.zipcode %] >+ </li> >+ <li>[% borrower.email %]</li> >+</ul> >+<br /> >+<h3>ITEM ON HOLD</h3> >+<h4>[% biblio.title %]</h4> >+<h5>[% biblio.author %]</h5> >+<ul> >+ <li>[% item.barcode %]</li> >+ <li>[% item.itemcallnumber %]</li> >+ <li>[% hold.waitingdate | \$KohaDates %]</li> >+</ul> >+<p>Notes: >+<pre>[% hold.reservenotes %]</pre> >+</p> >+EOF >+ >+ reset_template( { template => $tt_template, code => $code, module => 'circulation' } ); >+ my $tt_letter_for_item1 = C4::Reserves::ReserveSlip( $library->{branchcode}, $patron->{borrowernumber}, $biblio1->{biblionumber} ); >+ my $tt_letter_for_item2 = C4::Reserves::ReserveSlip( $library->{branchcode}, $patron->{borrowernumber}, $biblio2->{biblionumber} ); >+ >+ is( $tt_letter_for_item1->{content}, $letter_for_item1->{content}, ); >+ is( $tt_letter_for_item2->{content}, $letter_for_item2->{content}, ); >+ }; > }; > > subtest 'loops' => sub { >-- >2.10.2
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 17975
:
59449
|
60691
|
60717
|
60720
|
63968
|
63969
|
63973
|
63974
| 64334 |
64335