From e4e45fab6cae6f46db5643c2fa8f150067954e63 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 16 Dec 2019 17:15:19 +0100 Subject: [PATCH] Bug 24389: Better error handle when claiming late orders MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit A successful message says that the email has been sent and the order has been claimed, but nothing happened. Test plan: 0. Do not apply this patch 1. Create a new vendor, does not create a contact 2. Create some orders, close the basket 3. Go to the late orders page and claims some orders => You get a successful message, but the claim has not been done! 4. Apply this patch 5. Claim the orders => You get an error 6. Set a contact for the vendor 7. Claim the orders => Success In the docker container, you may need to: % apt install postfix % postfix start Edit /etc/hosts 127.0.0.1 localhost localhost.localdomain Signed-off-by: Martin Renvoize Signed-off-by: Joonas Kylmälä Signed-off-by: Martin Renvoize Signed-off-by: Joy Nelson (cherry picked from commit c2c7c6e754c0cf44ce0f99798f5115731a61868e) Signed-off-by: Lucas Gass (cherry picked from commit 5bccfa152ab90183e84b7e5b03536b05efc71abd) Signed-off-by: Hayley Mapley --- acqui/lateorders.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/acqui/lateorders.pl b/acqui/lateorders.pl index 9febcf65c9..e72ba350f0 100755 --- a/acqui/lateorders.pl +++ b/acqui/lateorders.pl @@ -111,12 +111,12 @@ if ($op and $op eq "send_alert"){ } }; - if ( $@ ) { - $template->param(error_claim => $@); - } elsif ( ref $err and exists $err->{error} and $err->{error} eq "no_email" ) { + if ( 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_selected"){ $template->{VARS}->{'error_claim'} = "no_order_selected"; + } elsif ( $@ or ref $err and exists $err->{error} ) { + $template->param(error_claim => $@ || $err->{error}); } else { $template->{VARS}->{'info_claim'} = 1; } -- 2.39.5