- authorised_value_category_list($template, $attr_type->authorised_value_category());
- pa_classes( $template, $attr_type->class );
+ $template->param( authorised_value_category => $attr_type->authorised_value_category() );
+ $template->param(classes_val_loop => GetAuthorisedValues( 'PA_CLASS' ));
+
+ my $branches = Koha::Libraries->search( {}, { order_by => ['branchname'] } )->unblessed;
+ my @branches_loop;
+ my $selected_branches = $attr_type->branches;
+ foreach my $branch (@$branches) {
+ my $selected = ( grep {$_->{branchcode} eq $branch->{branchcode}} @$selected_branches ) ? 1 : 0;
+ push @branches_loop, {
+ branchcode => $branch->{branchcode},
+ branchname => $branch->{branchname},
+ selected => $selected,
+ };
+ }
+ $template->param( branches_loop => \@branches_loop );