Bugzilla – Attachment 56790 Details for
Bug 5260
Add option to send an order by e-mail to the acquisition module
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 5260: QA follow-up: Fix error when no notice template is defined
Bug-5260-QA-follow-up-Fix-error-when-no-notice-tem.patch (text/plain), 3.64 KB, created by
Jonathan Druart
on 2016-10-24 14:02:24 UTC
(
hide
)
Description:
Bug 5260: QA follow-up: Fix error when no notice template is defined
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-10-24 14:02:24 UTC
Size:
3.64 KB
patch
obsolete
>From ed19dcde64c68045e29fa6ab9b5cc6b356623d4f Mon Sep 17 00:00:00 2001 >From: Katrin Fischer <katrin.fischer.83@web.de> >Date: Wed, 19 Oct 2016 23:26:22 +0200 >Subject: [PATCH] Bug 5260: QA follow-up: Fix error when no notice template is > defined > >When no notice template ACQORDER was defined, you'r receive a false >positive "email sent" message. Now it will display a specific >error message instead. > >Also includes 2 unit tests to test for the warn and new error code. > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > C4/Letters.pm | 2 +- > acqui/basket.pl | 6 ++---- > koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt | 2 ++ > t/db_dependent/Letters.t | 9 ++++++++- > 4 files changed, 13 insertions(+), 6 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index ed8ff88..24a1201 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -566,7 +566,7 @@ sub SendAlerts { > }, > repeat => $dataorders, > want_librarian => 1, >- ) or return; >+ ) or return { error => "no_letter" }; > > # Remove the order tag > $letter->{content} =~ s/<order>(.*?)<\/order>/$1/gxms; >diff --git a/acqui/basket.pl b/acqui/basket.pl >index b8caba5..054d743 100755 >--- a/acqui/basket.pl >+++ b/acqui/basket.pl >@@ -178,10 +178,8 @@ if ( $op eq 'delete_confirm' ) { > }; > if ( $@ ) { > $redirect_url .= '&email_error='.$@; >- } elsif ( ref $err and exists $err->{error} and $err->{error} eq "no_email" ) { >- $redirect_url .= '&email_error=no_email'; >- } elsif ( ref $err and exists $err->{error} and $err->{error} eq "no_basketno" ) { >- $redirect_url .= '&email_error=no_basketno'; >+ } elsif ( ref $err and exists $err->{error} ) { >+ $redirect_url .= '&email_error=' . $err->{error}; > } else { > $redirect_url .= '&email_ok=1'; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >index f94fbf4..8a114fd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >@@ -301,6 +301,8 @@ > This vendor has no contact selected for sending orders to or is missing an e-mail address. > [% ELSIF ( email_error == "no_basketno" ) %] > No basket given. >+ [% ELSIF ( email_error == "no_letter" ) %] >+ There is no notice template with code ACQORDER defined. > [% ELSE %] > ERROR! - [% email_error %] > [% END %] >diff --git a/t/db_dependent/Letters.t b/t/db_dependent/Letters.t >index d283c01..3f20306 100644 >--- a/t/db_dependent/Letters.t >+++ b/t/db_dependent/Letters.t >@@ -18,7 +18,7 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use Test::More tests => 78; >+use Test::More tests => 80; > use Test::MockModule; > use Test::Warn; > >@@ -431,6 +431,13 @@ warning_is { > is($err, 1, "Successfully sent order."); > is($mail{'To'}, 'testemail@mydomain.com', "mailto correct in sent order"); > is($mail{'Message'}, 'my vendor|John Smith|Ordernumber ' . $ordernumber . ' (Silence in the library) (1 ordered)', 'Order notice text constructed successfully'); >+ >+$dbh->do(q{DELETE FROM letter WHERE code = 'TESTACQORDER';}); >+warning_like { >+ $err = SendAlerts( 'orderacquisition', $basketno , 'TESTACQORDER' ) } >+ qr/No orderacquisition TESTACQORDER letter transported by email/, >+ "GetPreparedLetter warns about missing notice template"; >+is($err->{'error'}, 'no_letter', "No TESTACQORDER letter was defined."); > } > > >-- >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 5260
:
2653
|
4067
|
4068
|
4781
|
22171
|
56449
|
56450
|
56483
|
56484
|
56549
|
56550
|
56551
|
56560
|
56561
|
56562
|
56568
|
56679
|
56680
|
56686
|
56687
|
56688
|
56689
|
56705
|
56706
|
56707
|
56708
|
56709
|
56786
|
56787
|
56788
|
56789
| 56790 |
56791
|
56792
|
56793
|
56794
|
56795