@@ -, +, @@ types --- Koha/Template/Plugin/Branches.pm | 6 ++++ admin/itemtypes.pl | 16 +---------- .../prog/en/modules/admin/itemtypes.tt | 28 ++++++++----------- 3 files changed, 19 insertions(+), 31 deletions(-) --- a/Koha/Template/Plugin/Branches.pm +++ a/Koha/Template/Plugin/Branches.pm @@ -62,11 +62,17 @@ sub all { my $selecteds = $params->{selecteds}; my $unfiltered = $params->{unfiltered} || 0; my $search_params = $params->{search_params} || {}; + my $do_not_select_my_library = $params->{do_not_select_my_library} || 0; # By default we select the library of the logged in user if no selected passed if ( !$unfiltered ) { $search_params->{only_from_group} = $params->{only_from_group} || 0; } + my @selected = + ref $selected eq 'Koha::Libraries' + ? $selected->get_column('branchcode') + : $selected; + my $libraries = $unfiltered ? Koha::Libraries->search( $search_params, { order_by => ['branchname'] } )->unblessed : Koha::Libraries->search_filtered( $search_params, { order_by => ['branchname'] } )->unblessed; --- a/admin/itemtypes.pl +++ a/admin/itemtypes.pl @@ -58,18 +58,6 @@ undef($sip_media_type) if defined($sip_media_type) and $sip_media_type =~ /^\s*$ if ( $op eq 'add_form' ) { my $itemtype = Koha::ItemTypes->find($itemtype_code); - my $selected_branches = $itemtype ? $itemtype->get_library_limits : undef; - my $branches = Koha::Libraries->search( {}, { order_by => ['branchname'] } )->unblessed; - my @branches_loop; - foreach my $branch ( @$branches ) { - my $selected = ($selected_branches && grep {$_->branchcode eq $branch->{branchcode}} @{ $selected_branches->as_list } ) ? 1 : 0; - push @branches_loop, { - branchcode => $branch->{branchcode}, - branchname => $branch->{branchname}, - selected => $selected, - }; - } - my $parent_type = $itemtype ? $itemtype->parent_type : undef; my $parent_types = Koha::ItemTypes->search({parent_type=>undef,itemtype => {'!='=>$itemtype_code}}); my $imagesets = C4::Koha::getImageSets( checked => ( $itemtype ? $itemtype->imageurl : undef ) ); @@ -83,7 +71,6 @@ if ( $op eq 'add_form' ) { imagesets => $imagesets, searchcategory => $searchcategory, can_be_translated => ( scalar(@$translated_languages) > 1 ? 1 : 0 ), - branches_loop => \@branches_loop, ); } elsif ( $op eq 'add_validate' ) { my $is_a_modif = $input->param('is_a_modif'); @@ -209,9 +196,8 @@ if ( $op eq 'add_form' ) { } if ( $op eq 'list' ) { - my @itemtypes = Koha::ItemTypes->search->as_list; $template->param( - itemtypes => \@itemtypes, + itemtypes => scalar Koha::ItemTypes->search, messages => \@messages, ); } --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt @@ -1,6 +1,7 @@ [% USE raw %] [% USE Asset %] [% USE Koha %] +[% USE Branches %] [% USE AuthorisedValues %] [% USE Price %] [% USE TablesSettings %] @@ -376,13 +377,7 @@ Data deleted