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

(-)a/Koha/Item.pm (-3 / +1 lines)
Lines 281-289 sub safe_to_delete { Link Here
281
281
282
    $error = "not_same_branch"
282
    $error = "not_same_branch"
283
      if defined C4::Context->userenv
283
      if defined C4::Context->userenv
284
      and !C4::Context->IsSuperLibrarian()
284
      and !Koha::Patrons->find( C4::Context->userenv->{number} )->can_edit_item( $self ) )
285
      and C4::Context->preference("IndependentBranches")
286
      and ( C4::Context->userenv->{branch} ne $self->homebranch );
287
285
288
    # check it doesn't have a waiting reserve
286
    # check it doesn't have a waiting reserve
289
    $error = "book_reserved"
287
    $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 389-401 foreach my $item (@items) { Link Here
389
        $item->{'course_reserves'} = GetItemCourseReservesInfo( itemnumber => $item->{'itemnumber'} );
389
        $item->{'course_reserves'} = GetItemCourseReservesInfo( itemnumber => $item->{'itemnumber'} );
390
    }
390
    }
391
391
392
    if ( C4::Context->preference('IndependentBranches') ) {
392
    $item->{cannot_be_edited} = !$patron->can_edit_item( $item_object );
393
        my $userenv = C4::Context->userenv();
394
        if ( not C4::Context->IsSuperLibrarian()
395
            and $userenv->{branch} ne $item->{homebranch} ) {
396
            $item->{cannot_be_edited} = 1;
397
        }
398
    }
399
393
400
    if ( C4::Context->preference("LocalCoverImages") == 1 ) {
394
    if ( C4::Context->preference("LocalCoverImages") == 1 ) {
401
        $item->{cover_images} = $item_object->cover_images;
395
        $item->{cover_images} = $item_object->cover_images;
(-)a/catalogue/moredetail.pl (+3 lines)
Lines 232-237 foreach my $item (@items){ Link Here
232
                $item->{'nomod'}=1;
232
                $item->{'nomod'}=1;
233
        }
233
        }
234
    }
234
    }
235
236
    $item->{nomod} = !$patron->can_edit_item( $item );
237
235
    if ($item->{'datedue'}) {
238
    if ($item->{'datedue'}) {
236
        $item->{'issue'}= 1;
239
        $item->{'issue'}= 1;
237
    } else {
240
    } else {
(-)a/cataloguing/additem.pl (-1 / +4 lines)
Lines 124-130 my ($template, $loggedinuser, $cookie) Link Here
124
124
125
125
126
# Does the user have a restricted item editing permission?
126
# Does the user have a restricted item editing permission?
127
my $uid = Koha::Patrons->find( $loggedinuser )->userid;
127
my $patron = Koha::Patrons->find( $loggedinuser );
128
my $uid = $patron->userid;
128
my $restrictededition = $uid ? haspermission($uid,  {'editcatalogue' => 'edit_items_restricted'}) : undef;
129
my $restrictededition = $uid ? haspermission($uid,  {'editcatalogue' => 'edit_items_restricted'}) : undef;
129
# In case user is a superlibrarian, editing is not restricted
130
# In case user is a superlibrarian, editing is not restricted
130
$restrictededition = 0 if ($restrictededition != 0 &&  C4::Context->IsSuperLibrarian());
131
$restrictededition = 0 if ($restrictededition != 0 &&  C4::Context->IsSuperLibrarian());
Lines 506-511 if ($op) { Link Here
506
507
507
my @items;
508
my @items;
508
for my $item ( $biblio->items->as_list, $biblio->host_items->as_list ) {
509
for my $item ( $biblio->items->as_list, $biblio->host_items->as_list ) {
510
    my $i = $item->columns_to_str;
511
    $item->{nomod} = 1 unless $patron->can_edit_item($item);
509
    push @items, $item->columns_to_str;
512
    push @items, $item->columns_to_str;
510
}
513
}
511
514
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc (-1 / +1 lines)
Lines 246-252 Link Here
246
        </thead>
246
        </thead>
247
        <tbody>
247
        <tbody>
248
            [% FOREACH item IN items %]
248
            [% FOREACH item IN items %]
249
                [% SET can_be_edited = ! ( Koha.Preference('IndependentBranches') && ! logged_in_user.is_superlibrarian && item.homebranch != Branches.GetLoggedInBranchname() ) %]
249
                [% SET can_be_edited = !item.nomod && !( Koha.Preference('IndependentBranches') && ! logged_in_user && item.homebranch != Branches.GetLoggedInBranchname() ) %]
250
250
251
                <tr>
251
                <tr>
252
                    [% IF checkboxes_edit %]
252
                    [% IF checkboxes_edit %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-1 / +3 lines)
Lines 344-350 Link Here
344
                <tr>
344
                <tr>
345
                [% IF (StaffDetailItemSelection) %]
345
                [% IF (StaffDetailItemSelection) %]
346
                    <td style="text-align:center;vertical-align:middle">
346
                    <td style="text-align:center;vertical-align:middle">
347
                        <input type="checkbox" value="[% item.itemnumber | html %]" name="itemnumber" />
347
                        [% UNLESS item.cannot_be_edited %]
348
                            <input type="checkbox" value="[% item.itemnumber | html %]" name="itemnumber" />
349
                        [% END %]
348
                    </td>
350
                    </td>
349
                [% END %]
351
                [% END %]
350
                    [% IF Koha.Preference('LocalCoverImages') && ( tab == 'holdings' && itemloop_has_images || tab == 'otherholdings' && otheritemloop_has_images ) %]
352
                    [% 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 296-302 if ($op eq "show"){ Link Here
296
if ( $display_items ) {
297
if ( $display_items ) {
297
    my $items_table =
298
    my $items_table =
298
      Koha::UI::Table::Builder::Items->new( { itemnumbers => \@itemnumbers } )
299
      Koha::UI::Table::Builder::Items->new( { itemnumbers => \@itemnumbers } )
299
      ->build_table;
300
      ->build_table( { patron => $patron } );;
300
    $template->param(
301
    $template->param(
301
        items        => $items_table->{items},
302
        items        => $items_table->{items},
302
        item_header_loop => $items_table->{headers},
303
        item_header_loop => $items_table->{headers},
303
- 

Return to bug 20256