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

(-)a/Koha/Item.pm (-3 / +1 lines)
Lines 298-306 sub safe_to_delete { Link Here
298
298
299
    $error = "not_same_branch"
299
    $error = "not_same_branch"
300
      if defined C4::Context->userenv
300
      if defined C4::Context->userenv
301
      and !C4::Context->IsSuperLibrarian()
301
      and !Koha::Patrons->find( C4::Context->userenv->{number} )->can_edit_item( $self ) )
302
      and C4::Context->preference("IndependentBranches")
303
      and ( C4::Context->userenv->{branch} ne $self->homebranch );
304
302
305
    # check it doesn't have a waiting reserve
303
    # check it doesn't have a waiting reserve
306
    $error = "book_reserved"
304
    $error = "book_reserved"
(-)a/Koha/UI/Table/Builder/Items.pm (+3 lines)
Lines 72-77 Use it with: Link Here
72
sub build_table {
72
sub build_table {
73
    my ( $self, $params ) = @_;
73
    my ( $self, $params ) = @_;
74
74
75
    my $patron = $self->params;
76
75
    my $items = Koha::Items->search( { itemnumber => $self->{itemnumbers} } );
77
    my $items = Koha::Items->search( { itemnumber => $self->{itemnumbers} } );
76
78
77
    my @items;
79
    my @items;
Lines 84-89 sub build_table { Link Here
84
            holds          => $item->biblio->holds->count,
86
            holds          => $item->biblio->holds->count,
85
            item_holds     => $item->holds->count,
87
            item_holds     => $item->holds->count,
86
            is_checked_out => $item->checkout || 0,
88
            is_checked_out => $item->checkout || 0,
89
            nomod          => $patron ? 0 : $patron->can_edit_item($item),
87
        };
90
        };
88
        push @items, $item_info;
91
        push @items, $item_info;
89
    }
92
    }
(-)a/catalogue/detail.pl (-7 / +1 lines)
Lines 441-453 foreach my $item (@items) { Link Here
441
        $item->{'course_reserves'} = GetItemCourseReservesInfo( itemnumber => $item->{'itemnumber'} );
441
        $item->{'course_reserves'} = GetItemCourseReservesInfo( itemnumber => $item->{'itemnumber'} );
442
    }
442
    }
443
443
444
    if ( C4::Context->preference('IndependentBranches') ) {
444
    $item->{cannot_be_edited} = !$patron->can_edit_item( $item_object );
445
        my $userenv = C4::Context->userenv();
446
        if ( not C4::Context->IsSuperLibrarian()
447
            and $userenv->{branch} ne $item->{homebranch} ) {
448
            $item->{cannot_be_edited} = 1;
449
        }
450
    }
451
445
452
    if ( C4::Context->preference("LocalCoverImages") == 1 ) {
446
    if ( C4::Context->preference("LocalCoverImages") == 1 ) {
453
        $item->{cover_images} = $item_object->cover_images;
447
        $item->{cover_images} = $item_object->cover_images;
(-)a/catalogue/moredetail.pl (+3 lines)
Lines 229-234 foreach my $item (@items){ Link Here
229
                $item->{'nomod'}=1;
229
                $item->{'nomod'}=1;
230
        }
230
        }
231
    }
231
    }
232
233
    $item->{nomod} = !$patron->can_edit_item( $item );
234
232
    if ($item->{'datedue'}) {
235
    if ($item->{'datedue'}) {
233
        $item->{'issue'}= 1;
236
        $item->{'issue'}= 1;
234
    } else {
237
    } else {
(-)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 549-554 if ($op) { Link Here
549
550
550
my @items;
551
my @items;
551
for my $item ( $biblio->items->as_list, $biblio->host_items->as_list ) {
552
for my $item ( $biblio->items->as_list, $biblio->host_items->as_list ) {
553
    my $i = $item->columns_to_str;
554
    $item->{nomod} = 1 unless $patron->can_edit_item($item);
552
    push @items, $item->columns_to_str;
555
    push @items, $item->columns_to_str;
553
}
556
}
554
557
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc (-1 / +1 lines)
Lines 261-267 Link Here
261
        </thead>
261
        </thead>
262
        <tbody>
262
        <tbody>
263
            [% FOREACH item IN items %]
263
            [% FOREACH item IN items %]
264
                [% SET can_be_edited = ! ( Koha.Preference('IndependentBranches') && ! logged_in_user.is_superlibrarian && item.homebranch != Branches.GetLoggedInBranchname() ) %]
264
                [% SET can_be_edited = !item.nomod && !( Koha.Preference('IndependentBranches') && ! logged_in_user && item.homebranch != Branches.GetLoggedInBranchname() ) %]
265
265
266
                <tr>
266
                <tr>
267
                    [% IF checkboxes_edit %]
267
                    [% IF checkboxes_edit %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-1 / +3 lines)
Lines 376-382 Link Here
376
                <tr id="item_[% item.itemnumber | html %]" data-itemnumber="[% item.itemnumber | html %]" data-duedate="[% item.datedue | html %]">
376
                <tr id="item_[% item.itemnumber | html %]" data-itemnumber="[% item.itemnumber | html %]" data-duedate="[% item.datedue | html %]">
377
                [% IF (StaffDetailItemSelection) %]
377
                [% IF (StaffDetailItemSelection) %]
378
                    <td style="text-align:center;vertical-align:middle">
378
                    <td style="text-align:center;vertical-align:middle">
379
                        <input type="checkbox" value="[% item.itemnumber | html %]" name="itemnumber" />
379
                        [% UNLESS item.cannot_be_edited %]
380
                            <input type="checkbox" value="[% item.itemnumber | html %]" name="itemnumber" />
381
                        [% END %]
380
                    </td>
382
                    </td>
381
                [% END %]
383
                [% END %]
382
                    [% IF Koha.Preference('LocalCoverImages') && ( tab == 'holdings' && itemloop_has_images || tab == 'otherholdings' && otheritemloop_has_images ) %]
384
                    [% IF Koha.Preference('LocalCoverImages') && ( tab == 'holdings' && itemloop_has_images || tab == 'otherholdings' && otheritemloop_has_images ) %]
(-)a/tools/batchMod.pl (-3 / +3 lines)
Lines 75-81 my ($template, $loggedinuser, $cookie) Link Here
75
$template->param( searchid => scalar $input->param('searchid'), );
75
$template->param( searchid => scalar $input->param('searchid'), );
76
76
77
# Does the user have a restricted item edition permission?
77
# Does the user have a restricted item edition permission?
78
my $uid = $loggedinuser ? Koha::Patrons->find( $loggedinuser )->userid : undef;
78
my $patron = Koha::Patrons->find( $loggedinuser );
79
my $uid = $loggedinuser ? $patron->userid : undef;
79
my $restrictededition = $uid ? haspermission($uid,  {'tools' => 'items_batchmod_restricted'}) : undef;
80
my $restrictededition = $uid ? haspermission($uid,  {'tools' => 'items_batchmod_restricted'}) : undef;
80
# In case user is a superlibrarian, edition is not restricted
81
# In case user is a superlibrarian, edition is not restricted
81
$restrictededition = 0 if ($restrictededition != 0 && C4::Context->IsSuperLibrarian());
82
$restrictededition = 0 if ($restrictededition != 0 && C4::Context->IsSuperLibrarian());
Lines 293-299 if ($op eq "show"){ Link Here
293
if ( $display_items ) {
294
if ( $display_items ) {
294
    my $items_table =
295
    my $items_table =
295
      Koha::UI::Table::Builder::Items->new( { itemnumbers => \@itemnumbers } )
296
      Koha::UI::Table::Builder::Items->new( { itemnumbers => \@itemnumbers } )
296
      ->build_table;
297
      ->build_table( { patron => $patron } );;
297
    $template->param(
298
    $template->param(
298
        items        => $items_table->{items},
299
        items        => $items_table->{items},
299
        item_header_loop => $items_table->{headers},
300
        item_header_loop => $items_table->{headers},
300
- 

Return to bug 20256