- my $opac_display = $input->param('opac_display');
- $attr_type->opac_display($opac_display);
- my $opac_editable = $input->param('opac_editable');
- $attr_type->opac_editable($opac_editable);
- my $staff_searchable = $input->param('staff_searchable');
- $attr_type->staff_searchable($staff_searchable);
- my $authorised_value_category = $input->param('authorised_value_category');
- $attr_type->authorised_value_category($authorised_value_category);
- my $display_checkout = $input->param('display_checkout');
- $attr_type->display_checkout($display_checkout);
- $attr_type->category_code(scalar $input->param('category_code'));
- $attr_type->class(scalar $input->param('class'));
- my @branches = $input->multi_param('branches');
- $attr_type->branches( \@branches );
-
- if ($op eq 'edit') {
- $template->param(edited_attribute_type => $attr_type->code());
- } else {
- $template->param(added_attribute_type => $attr_type->code());
+ $attr_type->set(
+ {
+ repeatable => $repeatable,
+ unique_id => $unique_id,
+ opac_display => $opac_display,
+ opac_editable => $opac_editable,
+ staff_searchable => $staff_searchable,
+ keep_for_pseudonymization => $keep_for_pseudonymization,
+ mandatory => $mandatory,
+ authorised_value_category => $authorised_value_category,
+ display_checkout => $display_checkout,
+ category_code => $category_code,
+ class => $class,
+ }
+ )->store;
+
+ my @branches = grep { ! /^\s*$/ } $input->multi_param('branches');
+ $attr_type->library_limits( \@branches );
+
+ if ( $op eq 'edit' ) {
+ $template->param( edited_attribute_type => $attr_type->code() );
+ }
+ else {
+ $template->param( added_attribute_type => $attr_type->code() );