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 <paola.rossi@cineca.it>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Reworded commit message to reflect what the patch achieves.
Works as described and passes tests.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
simith 2014-11-13 13:25:38 -05:00 committed by Tomas Cohen Arazi
parent 9958cce551
commit 268fc21685
3 changed files with 10 additions and 0 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -83,6 +83,8 @@ $(document).ready(function() {
[% IF error_claim %]
[% IF ( error_claim == "no_email" ) %]
<div class="error">This vendor has no email</div>
[% ELSIF ( error_claim == "no_order_seleted" ) %]
<div class="error">No order selected</div>
[% ELSE %]
<div class="error">[% error_claim %]</div>
[% END %]