From 5e7fa5d7c8fcf7dcb14a0c123a6de84b9d4649a1 Mon Sep 17 00:00:00 2001 From: Andrew Isherwood Date: Wed, 5 Jan 2022 10:00:10 -0300 Subject: [PATCH] Bug 28932: Fix duplicate next_action & prev_action This patch fixes the duplicate buttons issue. To test: 1. Apply the regression tests patch 2. Run: $ kshell k$ prove t/db_dependent/Illrequests.t => FAIL: Tests fail 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass Signed-off-by: Tomas Cohen Arazi Signed-off-by: Fridolin Somers Signed-off-by: Kyle M Hall (cherry picked from commit 692804a49a59208b6726f48523bfb82e73671ddc) Signed-off-by: Andrew Fuerste-Henry (cherry picked from commit 0b9c338f581fc562c94e8f1122b6d5b9bfc715e3) Signed-off-by: Victor Grousset/tuxayo --- Koha/Illrequest.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Koha/Illrequest.pm b/Koha/Illrequest.pm index 39cf0eabf8..3b06807608 100644 --- a/Koha/Illrequest.pm +++ b/Koha/Illrequest.pm @@ -565,7 +565,8 @@ sub _status_graph_union { if ( grep { $prev_action eq $_ } @core_status_ids ) { my @next_actions = @{$status_graph->{$prev_action}->{next_actions}}; - push @next_actions, $backend_status_key; + push @next_actions, $backend_status_key + if (!grep(/^$backend_status_key$/, @next_actions)); $status_graph->{$prev_action}->{next_actions} = \@next_actions; } @@ -575,7 +576,8 @@ sub _status_graph_union { if ( grep { $next_action eq $_ } @core_status_ids ) { my @prev_actions = @{$status_graph->{$next_action}->{prev_actions}}; - push @prev_actions, $backend_status_key; + push @prev_actions, $backend_status_key + if (!grep(/^$backend_status_key$/, @prev_actions)); $status_graph->{$next_action}->{prev_actions} = \@prev_actions; } -- 2.39.5