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

(-)a/Koha/Item.pm (-3 / +1 lines)
Lines 278-286 sub safe_to_delete { Link Here
278
278
279
    return "not_same_branch"
279
    return "not_same_branch"
280
      if defined C4::Context->userenv
280
      if defined C4::Context->userenv
281
      and !C4::Context->IsSuperLibrarian()
281
      and !Koha::Patrons->find( C4::Context->userenv->{number} )->can_edit_item( $self ) )
282
      and C4::Context->preference("IndependentBranches")
283
      and ( C4::Context->userenv->{branch} ne $self->homebranch );
284
282
285
    # check it doesn't have a waiting reserve
283
    # check it doesn't have a waiting reserve
286
    return "book_reserved"
284
    return "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 391-403 foreach my $item (@items) { Link Here
391
        $item->{'course_reserves'} = GetItemCourseReservesInfo( itemnumber => $item->{'itemnumber'} );
391
        $item->{'course_reserves'} = GetItemCourseReservesInfo( itemnumber => $item->{'itemnumber'} );
392
    }
392
    }
393
393
394
    if ( C4::Context->preference('IndependentBranches') ) {
394
    $item->{cannot_be_edited} = !$patron->can_edit_item( $item_object );
395
        my $userenv = C4::Context->userenv();
396
        if ( not C4::Context->IsSuperLibrarian()
397
            and $userenv->{branch} ne $item->{homebranch} ) {
398
            $item->{cannot_be_edited} = 1;
399
        }
400
    }
401
395
402
    if ( C4::Context->preference("LocalCoverImages") == 1 ) {
396
    if ( C4::Context->preference("LocalCoverImages") == 1 ) {
403
        $item->{cover_images} = $item_object->cover_images;
397
        $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 125-131 my ($template, $loggedinuser, $cookie) Link Here
125
125
126
126
127
# Does the user have a restricted item editing permission?
127
# Does the user have a restricted item editing permission?
128
my $uid = Koha::Patrons->find( $loggedinuser )->userid;
128
my $patron = Koha::Patrons->find( $loggedinuser );
129
my $uid = $patron->userid;
129
my $restrictededition = $uid ? haspermission($uid,  {'editcatalogue' => 'edit_items_restricted'}) : undef;
130
my $restrictededition = $uid ? haspermission($uid,  {'editcatalogue' => 'edit_items_restricted'}) : undef;
130
# In case user is a superlibrarian, editing is not restricted
131
# In case user is a superlibrarian, editing is not restricted
131
$restrictededition = 0 if ($restrictededition != 0 &&  C4::Context->IsSuperLibrarian());
132
$restrictededition = 0 if ($restrictededition != 0 &&  C4::Context->IsSuperLibrarian());
Lines 508-513 if ($op) { Link Here
508
509
509
my @items;
510
my @items;
510
for my $item ( $biblio->items->as_list, $biblio->host_items->as_list ) {
511
for my $item ( $biblio->items->as_list, $biblio->host_items->as_list ) {
512
    my $i = $item->columns_to_str;
513
    $item->{nomod} = 1 unless $patron->can_edit_item($item);
511
    push @items, $item->columns_to_str;
514
    push @items, $item->columns_to_str;
512
}
515
}
513
516
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc (-1 / +1 lines)
Lines 245-251 Link Here
245
        </thead>
245
        </thead>
246
        <tbody>
246
        <tbody>
247
            [% FOREACH item IN items %]
247
            [% FOREACH item IN items %]
248
                [% SET can_be_edited = ! ( Koha.Preference('IndependentBranches') && ! logged_in_user && item.homebranch != Branches.GetLoggedInBranchcode() ) %]
248
                [% SET can_be_edited = !item.nomod && !( Koha.Preference('IndependentBranches') && ! logged_in_user && item.homebranch != Branches.GetLoggedInBranchcode() ) %]
249
249
250
                <tr>
250
                <tr>
251
                    [% IF checkboxes_edit %]
251
                    [% IF checkboxes_edit %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-1 / +3 lines)
Lines 346-352 Link Here
346
                <tr>
346
                <tr>
347
                [% IF (StaffDetailItemSelection) %]
347
                [% IF (StaffDetailItemSelection) %]
348
                    <td style="text-align:center;vertical-align:middle">
348
                    <td style="text-align:center;vertical-align:middle">
349
                        <input type="checkbox" value="[% item.itemnumber | html %]" name="itemnumber" />
349
                        [% UNLESS item.cannot_be_edited %]
350
                            <input type="checkbox" value="[% item.itemnumber | html %]" name="itemnumber" />
351
                        [% END %]
350
                    </td>
352
                    </td>
351
                [% END %]
353
                [% END %]
352
                    [% IF Koha.Preference('LocalCoverImages') && ( tab == 'holdings' && itemloop_has_images || tab == 'otherholdings' && otheritemloop_has_images ) %]
354
                    [% 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