View | Details | Raw Unified | Return to bug 23271
Collapse All | Expand All

(-)a/Koha/Template/Plugin/Branches.pm (+6 lines)
Lines 62-72 sub all { Link Here
62
    my $selecteds = $params->{selecteds};
62
    my $selecteds = $params->{selecteds};
63
    my $unfiltered = $params->{unfiltered} || 0;
63
    my $unfiltered = $params->{unfiltered} || 0;
64
    my $search_params = $params->{search_params} || {};
64
    my $search_params = $params->{search_params} || {};
65
    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
65
66
66
    if ( !$unfiltered ) {
67
    if ( !$unfiltered ) {
67
        $search_params->{only_from_group} = $params->{only_from_group} || 0;
68
        $search_params->{only_from_group} = $params->{only_from_group} || 0;
68
    }
69
    }
69
70
71
    my @selected =
72
      ref $selected eq 'Koha::Libraries'
73
      ? $selected->get_column('branchcode')
74
      : $selected;
75
70
    my $libraries = $unfiltered
76
    my $libraries = $unfiltered
71
      ? Koha::Libraries->search( $search_params, { order_by => ['branchname'] } )->unblessed
77
      ? Koha::Libraries->search( $search_params, { order_by => ['branchname'] } )->unblessed
72
      : Koha::Libraries->search_filtered( $search_params, { order_by => ['branchname'] } )->unblessed;
78
      : Koha::Libraries->search_filtered( $search_params, { order_by => ['branchname'] } )->unblessed;
(-)a/admin/itemtypes.pl (-15 / +1 lines)
Lines 58-75 undef($sip_media_type) if defined($sip_media_type) and $sip_media_type =~ /^\s*$ Link Here
58
if ( $op eq 'add_form' ) {
58
if ( $op eq 'add_form' ) {
59
    my $itemtype = Koha::ItemTypes->find($itemtype_code);
59
    my $itemtype = Koha::ItemTypes->find($itemtype_code);
60
60
61
    my $selected_branches = $itemtype ? $itemtype->get_library_limits : undef;
62
    my $branches = Koha::Libraries->search( {}, { order_by => ['branchname'] } )->unblessed;
63
    my @branches_loop;
64
    foreach my $branch ( @$branches ) {
65
        my $selected = ($selected_branches && grep {$_->branchcode eq $branch->{branchcode}} @{ $selected_branches->as_list } ) ? 1 : 0;
66
        push @branches_loop, {
67
            branchcode => $branch->{branchcode},
68
            branchname => $branch->{branchname},
69
            selected   => $selected,
70
        };
71
    }
72
73
    my $parent_type = $itemtype ? $itemtype->parent_type : undef;
61
    my $parent_type = $itemtype ? $itemtype->parent_type : undef;
74
    my $parent_types = Koha::ItemTypes->search({parent_type=>undef,itemtype => {'!='=>$itemtype_code}});
62
    my $parent_types = Koha::ItemTypes->search({parent_type=>undef,itemtype => {'!='=>$itemtype_code}});
75
    my $imagesets = C4::Koha::getImageSets( checked => ( $itemtype ? $itemtype->imageurl : undef ) );
63
    my $imagesets = C4::Koha::getImageSets( checked => ( $itemtype ? $itemtype->imageurl : undef ) );
Lines 83-89 if ( $op eq 'add_form' ) { Link Here
83
        imagesets => $imagesets,
71
        imagesets => $imagesets,
84
        searchcategory => $searchcategory,
72
        searchcategory => $searchcategory,
85
        can_be_translated => ( scalar(@$translated_languages) > 1 ? 1 : 0 ),
73
        can_be_translated => ( scalar(@$translated_languages) > 1 ? 1 : 0 ),
86
        branches_loop    => \@branches_loop,
87
    );
74
    );
88
} elsif ( $op eq 'add_validate' ) {
75
} elsif ( $op eq 'add_validate' ) {
89
    my $is_a_modif   = $input->param('is_a_modif');
76
    my $is_a_modif   = $input->param('is_a_modif');
Lines 209-217 if ( $op eq 'add_form' ) { Link Here
209
}
196
}
210
197
211
if ( $op eq 'list' ) {
198
if ( $op eq 'list' ) {
212
    my @itemtypes = Koha::ItemTypes->search->as_list;
213
    $template->param(
199
    $template->param(
214
        itemtypes => \@itemtypes,
200
        itemtypes => scalar Koha::ItemTypes->search,
215
        messages  => \@messages,
201
        messages  => \@messages,
216
    );
202
    );
217
}
203
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt (-17 / +12 lines)
Lines 1-6 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Asset %]
2
[% USE Asset %]
3
[% USE Koha %]
3
[% USE Koha %]
4
[% USE Branches %]
4
[% USE AuthorisedValues %]
5
[% USE AuthorisedValues %]
5
[% USE Price %]
6
[% USE Price %]
6
[% USE TablesSettings %]
7
[% USE TablesSettings %]
Lines 376-388 Data deleted Link Here
376
                <li><label for="branches">Library limitation: </label>
377
                <li><label for="branches">Library limitation: </label>
377
                    <select id="branches" name="branches" multiple size="10">
378
                    <select id="branches" name="branches" multiple size="10">
378
                        <option value="">All libraries</option>
379
                        <option value="">All libraries</option>
379
                        [% FOREACH branch IN branches_loop %]
380
                        [% PROCESS options_for_libraries libraries => Branches.all( selecteds => itemtype.get_library_limits, unfiltered => 1, do_not_select_my_library => 1 ) %]
380
                        [% IF ( branch.selected ) %]
381
                            <option selected="selected" value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
382
                        [% ELSE %]
383
                            <option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
384
                        [% END %]
385
                        [% END %]
386
                    </select>
381
                    </select>
387
                    <span class="hint">Select 'All libraries' if all libraries use this item type. Otherwise, select the specific libraries that use this item type.</span>
382
                    <span class="hint">Select 'All libraries' if all libraries use this item type. Otherwise, select the specific libraries that use this item type.</span>
388
                </li>
383
                </li>
Lines 529-548 Data deleted Link Here
529
            <td>[% itemtype.processfee | $Price %]</td>
524
            <td>[% itemtype.processfee | $Price %]</td>
530
            <td>[% itemtype.checkinmsg | html_line_break | $raw %]</td>
525
            <td>[% itemtype.checkinmsg | html_line_break | $raw %]</td>
531
            <td>
526
            <td>
532
                [% IF itemtype.library_limits %]
527
                [% SET library_limits = itemtype.library_limits %]
533
                    [% libraries_str = "" %]
528
                [% IF library_limits.count > 0 %]
534
                    [% FOREACH library IN itemtype.library_limits %]
529
                    [% library_str = "" %]
530
                    [% FOREACH library IN library_limits %]
535
                        [%- IF loop.first -%]
531
                        [%- IF loop.first -%]
536
                        [% libraries_str = library.branchname _ " (" _ library.branchcode _ ")" %]
532
                            [% library_str = library.branchname _ " (" _ library.branchcode _ ")" %]
537
                        [% ELSE %]
533
                        [% ELSE %]
538
                        [% libraries_str = libraries_str _ "\n" _ library.branchname _ " (" _ library.branchcode _ ")" %]
534
                            [% library_str = library_str _ "\n" _ library.branchname _ " (" _ library.branchcode _ ")" %]
539
                        [% END %]
535
                        [% END %]
540
                    [% END %]
536
                    [% END %]
541
                    <span class="library_limitation" title="[% libraries_str | html %]">
537
                    <span class="library_limitation" title="[% library_str | html %]">
542
                        [% IF itemtype.library_limits.count > 1 %]
538
                        [% IF library_limits.count > 1 %]
543
                            [% itemtype.library_limits.count | html %] library limitations
539
                            [% library_limits.count | html %] library limitations
544
                        [% ELSE %]
540
                        [% ELSE %]
545
                            [% itemtype.library_limits.count | html %] library limitation
541
                            [% library_limits.count | html %] library limitation
546
                        [% END %]
542
                        [% END %]
547
                [% ELSE %]
543
                [% ELSE %]
548
                    No limitation
544
                    No limitation
549
- 

Return to bug 23271