Skip to content

Commit

Permalink
PartGroup: auch in deiversen Dropdown Partsgroup hierarchisch darstellen
Browse files Browse the repository at this point in the history
  • Loading branch information
wernerhahn committed Oct 30, 2024
1 parent 86d460a commit a5419c1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions SL/Controller/Part.pm
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ sub action_show_multi_items_dialog {
$search_term ||= $self->models->filtered->laundered->{all_with_customer_partnumber_substr_multi__ilike};

$_[0]->render('part/_multi_items_dialog', { layout => 0 },
all_partsgroups => SL::DB::Manager::PartsGroup->get_all,
all_partsgroups => SL::DB::Manager::PartsGroup->data_partsgroup_dropdown,
search_term => $search_term
);
}
Expand Down Expand Up @@ -1420,7 +1420,7 @@ sub init_all_languages {

sub init_all_partsgroups {
my ($self) = @_;
SL::DB::Manager::PartsGroup->get_all_sorted(query => [ or => [ id => $self->part->partsgroup_id, obsolete => 0 ] ]);
SL::DB::Manager::PartsGroup->data_partsgroup_dropdown;
}

sub init_all_buchungsgruppen {
Expand Down
11 changes: 11 additions & 0 deletions SL/DB/Manager/PartsGroup.pm
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,15 @@ sub get_hierarchy {
return \@list;
}

sub data_partsgroup_dropdown {
my ($name, %params);
my $partsgroup = get_hierarchy;
my $partsgroup_hierarchie;
foreach my $pg (@{$partsgroup}) {
next if $pg->{obsolete};
$pg->{partsgroup} = "| " x $pg->{level} . $pg->{partsgroup};
push @{$partsgroup_hierarchie}, $pg;
}
return $partsgroup_hierarchie;
}
1;

0 comments on commit a5419c1

Please sign in to comment.