Skip to content

Commit

Permalink
ACQUI-147: Fix duplicate branches in library groups
Browse files Browse the repository at this point in the history
_assign_branches_to_parent wasn't accounting for duplicate branches
  • Loading branch information
mblenk committed Jul 16, 2024
1 parent 21b88ba commit 337309c
Show file tree
Hide file tree
Showing 2 changed files with 294 additions and 353 deletions.
7 changes: 6 additions & 1 deletion Koha/Plugin/Acquire/views/acquisitions.pl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use C4::Output qw( output_html_with_http_headers );

use CGI qw ( -utf8 );
use List::MoreUtils qw( uniq );

use Koha::Plugin::Acquire;
use Koha::Patrons;
Expand Down Expand Up @@ -125,7 +126,11 @@ sub _assign_branches_to_parent {
}
push(@sub_group_libraries, @{ $sub_group->{libraries} });
}
$group->{libraries} = \@sub_group_libraries;
my @parent_branches;
foreach my $library (@sub_group_libraries) {
push(@parent_branches, $library) unless grep($_->{branchcode} eq $library->{branchcode}, @parent_branches);
}
$group->{libraries} = \@parent_branches;
}
return $group;
}
Loading

0 comments on commit 337309c

Please sign in to comment.