From 268fc21685eff0d076f1aa300569ebc95f4c8d64 Mon Sep 17 00:00:00 2001 From: simith Date: Thu, 13 Nov 2014 13:25:38 -0500 Subject: [PATCH] Bug 12505 - Acq claim: Show error message when no order is selected If no order is selected on the acq claim page when clicking 'Claim order' an ugly perl error message is displayed. This patch corrects the behaviour to display a human readable 'No order selected' instead. Signed-off-by: Paola Rossi Signed-off-by: Katrin Fischer Reworded commit message to reflect what the patch achieves. Works as described and passes tests. Signed-off-by: Tomas Cohen Arazi --- C4/Letters.pm | 6 ++++++ acqui/lateorders.pl | 2 ++ koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt | 2 ++ 3 files changed, 10 insertions(+) diff --git a/C4/Letters.pm b/C4/Letters.pm index 8c9f5072f4..5673cbc234 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -324,6 +324,12 @@ sub SendAlerts { LEFT JOIN aqbooksellers ON subscription.aqbooksellerid=aqbooksellers.id WHERE serial.serialid IN ( }; + + if (!@$externalid){ + carp "No Order seleted"; + return { error => "no_order_seleted" }; + } + $strsth .= join( ",", @$externalid ) . ")"; my $sthorders = $dbh->prepare($strsth); $sthorders->execute; diff --git a/acqui/lateorders.pl b/acqui/lateorders.pl index d43dbbefaa..b68673f17f 100755 --- a/acqui/lateorders.pl +++ b/acqui/lateorders.pl @@ -116,6 +116,8 @@ if ($op and $op eq "send_alert"){ $template->param(error_claim => $@); } elsif ( ref $err and exists $err->{error} and $err->{error} eq "no_email" ) { $template->{VARS}->{'error_claim'} = "no_email"; + } elsif ( ref $err and exists $err->{error} and $err->{error} eq "no_order_seleted"){ + $template->{VARS}->{'error_claim'} = "no_order_seleted"; } else { $template->{VARS}->{'info_claim'} = 1; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt index efa0db6daf..d794d74f0b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt @@ -83,6 +83,8 @@ $(document).ready(function() { [% IF error_claim %] [% IF ( error_claim == "no_email" ) %]
This vendor has no email
+ [% ELSIF ( error_claim == "no_order_seleted" ) %] +
No order selected
[% ELSE %]
[% error_claim %]
[% END %] -- 2.39.5