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

(-)a/Koha/Item.pm (-3 / +1 lines)
Lines 294-302 sub safe_to_delete { Link Here
294
294
295
    $error = "not_same_branch"
295
    $error = "not_same_branch"
296
      if defined C4::Context->userenv
296
      if defined C4::Context->userenv
297
      and !C4::Context->IsSuperLibrarian()
297
      and !Koha::Patrons->find( C4::Context->userenv->{number} )->can_edit_item( $self ) )
298
      and C4::Context->preference("IndependentBranches")
299
      and ( C4::Context->userenv->{branch} ne $self->homebranch );
300
298
301
    # check it doesn't have a waiting reserve
299
    # check it doesn't have a waiting reserve
302
    $error = "book_reserved"
300
    $error = "book_reserved"
(-)a/Koha/UI/Table/Builder/Items.pm (+5 lines)
Lines 71-77 Use it with: Link Here
71
71
72
sub build_table {
72
sub build_table {
73
    my ( $self, $params ) = @_;
73
    my ( $self, $params ) = @_;
74
75
    my $patron = $self->params;
76
74
    my %itemnumbers_to_idx = map { $self->{itemnumbers}->[$_] => $_ } 0..$#{$self->{itemnumbers}};
77
    my %itemnumbers_to_idx = map { $self->{itemnumbers}->[$_] => $_ } 0..$#{$self->{itemnumbers}};
78
75
    my $items = Koha::Items->search( { itemnumber => $self->{itemnumbers} } );
79
    my $items = Koha::Items->search( { itemnumber => $self->{itemnumbers} } );
76
80
77
    my @items;
81
    my @items;
Lines 85-90 sub build_table { Link Here
85
            holds          => $item->biblio->holds->count,
89
            holds          => $item->biblio->holds->count,
86
            item_holds     => $item->holds->count,
90
            item_holds     => $item->holds->count,
87
            is_checked_out => $item->checkout || 0,
91
            is_checked_out => $item->checkout || 0,
92
            nomod          => $patron ? 0 : $patron->can_edit_item($item),
88
        };
93
        };
89
        push @items, $item_info;
94
        push @items, $item_info;
90
    }
95
    }
(-)a/catalogue/detail.pl (+2 lines)
Lines 442-447 foreach my $item (@items) { Link Here
442
        $item_info->{'course_reserves'} = GetItemCourseReservesInfo( itemnumber => $item->itemnumber );
442
        $item_info->{'course_reserves'} = GetItemCourseReservesInfo( itemnumber => $item->itemnumber );
443
    }
443
    }
444
444
445
    $item->{cannot_be_edited} = !$patron->can_edit_item( $item_object );
446
445
    if ( C4::Context->preference("LocalCoverImages") == 1 ) {
447
    if ( C4::Context->preference("LocalCoverImages") == 1 ) {
446
        $item_info->{cover_images} = $item->cover_images;
448
        $item_info->{cover_images} = $item->cover_images;
447
    }
449
    }
(-)a/catalogue/moredetail.pl (-7 / +2 lines)
Lines 228-240 foreach my $item (@items){ Link Here
228
        }
228
        }
229
    }
229
    }
230
230
231
    if (C4::Context->preference("IndependentBranches")) {
231
    $item_data->{nomod} = !$patron->can_edit_item( $item );
232
        #verifying rights
232
233
        my $userenv = C4::Context->userenv();
234
        unless (C4::Context->IsSuperLibrarian() or ($userenv->{'branch'} eq $item->homebranch)) {
235
                $item_info->{'nomod'}=1;
236
        }
237
    }
238
    push @item_data, $item_info;
233
    push @item_data, $item_info;
239
}
234
}
240
235
(-)a/cataloguing/additem.pl (-1 / +4 lines)
Lines 155-161 my ($template, $loggedinuser, $cookie) Link Here
155
155
156
156
157
# Does the user have a restricted item editing permission?
157
# Does the user have a restricted item editing permission?
158
my $uid = Koha::Patrons->find( $loggedinuser )->userid;
158
my $patron = Koha::Patrons->find( $loggedinuser );
159
my $uid = $patron->userid;
159
my $restrictededition = $uid ? haspermission($uid,  {'editcatalogue' => 'edit_items_restricted'}) : undef;
160
my $restrictededition = $uid ? haspermission($uid,  {'editcatalogue' => 'edit_items_restricted'}) : undef;
160
# In case user is a superlibrarian, editing is not restricted
161
# In case user is a superlibrarian, editing is not restricted
161
$restrictededition = 0 if ($restrictededition != 0 &&  C4::Context->IsSuperLibrarian());
162
$restrictededition = 0 if ($restrictededition != 0 &&  C4::Context->IsSuperLibrarian());
Lines 554-559 if ($op) { Link Here
554
555
555
my @items;
556
my @items;
556
for my $item ( $biblio->items->as_list, $biblio->host_items->as_list ) {
557
for my $item ( $biblio->items->as_list, $biblio->host_items->as_list ) {
558
    my $i = $item->columns_to_str;
559
    $item->{nomod} = 1 unless $patron->can_edit_item($item);
557
    push @items, $item->columns_to_str;
560
    push @items, $item->columns_to_str;
558
}
561
}
559
562
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc (-1 / +1 lines)
Lines 262-268 Link Here
262
        </thead>
262
        </thead>
263
        <tbody>
263
        <tbody>
264
            [% FOREACH item IN items %]
264
            [% FOREACH item IN items %]
265
                [% SET can_be_edited = ! ( Koha.Preference('IndependentBranches') && ! logged_in_user.is_superlibrarian && item.homebranch != Branches.GetLoggedInBranchname() ) %]
265
                [% SET can_be_edited = !item.nomod && !( Koha.Preference('IndependentBranches') && ! logged_in_user && item.homebranch != Branches.GetLoggedInBranchname() ) %]
266
266
267
                <tr>
267
                <tr>
268
                    <td>[% item.index + 1 | html %]</td>
268
                    <td>[% item.index + 1 | html %]</td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-1 / +3 lines)
Lines 381-387 Link Here
381
                <tr id="item_[% item.itemnumber | html %]" data-itemnumber="[% item.itemnumber | html %]" data-duedate="[% item.datedue | html %]">
381
                <tr id="item_[% item.itemnumber | html %]" data-itemnumber="[% item.itemnumber | html %]" data-duedate="[% item.datedue | html %]">
382
                [% IF (StaffDetailItemSelection) %]
382
                [% IF (StaffDetailItemSelection) %]
383
                    <td style="text-align:center;vertical-align:middle">
383
                    <td style="text-align:center;vertical-align:middle">
384
                        <input type="checkbox" value="[% item.itemnumber | html %]" name="itemnumber" />
384
                        [% UNLESS item.cannot_be_edited %]
385
                            <input type="checkbox" value="[% item.itemnumber | html %]" name="itemnumber" />
386
                        [% END %]
385
                    </td>
387
                    </td>
386
                [% END %]
388
                [% END %]
387
                    [% IF Koha.Preference('LocalCoverImages') && ( tab == 'holdings' && itemloop_has_images || tab == 'otherholdings' && otheritemloop_has_images ) %]
389
                    [% IF Koha.Preference('LocalCoverImages') && ( tab == 'holdings' && itemloop_has_images || tab == 'otherholdings' && otheritemloop_has_images ) %]
(-)a/tools/batchMod.pl (-3 / +3 lines)
Lines 74-80 my ($template, $loggedinuser, $cookie) Link Here
74
$template->param( searchid => scalar $input->param('searchid'), );
74
$template->param( searchid => scalar $input->param('searchid'), );
75
75
76
# Does the user have a restricted item edition permission?
76
# Does the user have a restricted item edition permission?
77
my $uid = $loggedinuser ? Koha::Patrons->find( $loggedinuser )->userid : undef;
77
my $patron = Koha::Patrons->find( $loggedinuser );
78
my $uid = $loggedinuser ? $patron->userid : undef;
78
my $restrictededition = $uid ? haspermission($uid,  {'tools' => 'items_batchmod_restricted'}) : undef;
79
my $restrictededition = $uid ? haspermission($uid,  {'tools' => 'items_batchmod_restricted'}) : undef;
79
# In case user is a superlibrarian, edition is not restricted
80
# In case user is a superlibrarian, edition is not restricted
80
$restrictededition = 0 if ($restrictededition != 0 && C4::Context->IsSuperLibrarian());
81
$restrictededition = 0 if ($restrictededition != 0 && C4::Context->IsSuperLibrarian());
Lines 292-298 if ($op eq "show"){ Link Here
292
if ( $display_items ) {
293
if ( $display_items ) {
293
    my $items_table =
294
    my $items_table =
294
      Koha::UI::Table::Builder::Items->new( { itemnumbers => \@itemnumbers } )
295
      Koha::UI::Table::Builder::Items->new( { itemnumbers => \@itemnumbers } )
295
      ->build_table;
296
      ->build_table( { patron => $patron } );;
296
    $template->param(
297
    $template->param(
297
        items        => $items_table->{items},
298
        items        => $items_table->{items},
298
        item_header_loop => $items_table->{headers},
299
        item_header_loop => $items_table->{headers},
299
- 

Return to bug 20256