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

(-)a/Koha/Item.pm (-3 / +1 lines)
Lines 277-285 sub safe_to_delete { Link Here
277
277
278
    return "not_same_branch"
278
    return "not_same_branch"
279
      if defined C4::Context->userenv
279
      if defined C4::Context->userenv
280
      and !C4::Context->IsSuperLibrarian()
280
      and !Koha::Patrons->find( C4::Context->userenv->{number} )->can_edit_item( $self ) )
281
      and C4::Context->preference("IndependentBranches")
282
      and ( C4::Context->userenv->{branch} ne $self->homebranch );
283
281
284
    # check it doesn't have a waiting reserve
282
    # check it doesn't have a waiting reserve
285
    return "book_reserved"
283
    return "book_reserved"
(-)a/catalogue/detail.pl (-7 / +1 lines)
Lines 376-388 foreach my $item (@items) { Link Here
376
        $item->{'course_reserves'} = GetItemCourseReservesInfo( itemnumber => $item->{'itemnumber'} );
376
        $item->{'course_reserves'} = GetItemCourseReservesInfo( itemnumber => $item->{'itemnumber'} );
377
    }
377
    }
378
378
379
    if ( C4::Context->preference('IndependentBranches') ) {
379
    $item->{cannot_be_edited} = !$patron->can_edit_item( $item_object );
380
        my $userenv = C4::Context->userenv();
381
        if ( not C4::Context->IsSuperLibrarian()
382
            and $userenv->{branch} ne $item->{homebranch} ) {
383
            $item->{cannot_be_edited} = 1;
384
        }
385
    }
386
380
387
    if ( C4::Context->preference("LocalCoverImages") == 1 ) {
381
    if ( C4::Context->preference("LocalCoverImages") == 1 ) {
388
        $item->{cover_images} = $item_object->cover_images;
382
        $item->{cover_images} = $item_object->cover_images;
(-)a/catalogue/moredetail.pl (+3 lines)
Lines 234-239 foreach my $item (@items){ Link Here
234
                $item->{'nomod'}=1;
234
                $item->{'nomod'}=1;
235
        }
235
        }
236
    }
236
    }
237
238
    $item->{nomod} = !$patron->can_edit_item( $item );
239
237
    if ($item->{'datedue'}) {
240
    if ($item->{'datedue'}) {
238
        $item->{'issue'}= 1;
241
        $item->{'issue'}= 1;
239
    } else {
242
    } else {
(-)a/cataloguing/additem.pl (-4 / +9 lines)
Lines 435-441 my ($template, $loggedinuser, $cookie) Link Here
435
435
436
436
437
# Does the user have a restricted item editing permission?
437
# Does the user have a restricted item editing permission?
438
my $uid = Koha::Patrons->find( $loggedinuser )->userid;
438
my $patron = Koha::Patrons->find( $loggedinuser );
439
my $uid = $patron->userid;
439
my $restrictededition = $uid ? haspermission($uid,  {'editcatalogue' => 'edit_items_restricted'}) : undef;
440
my $restrictededition = $uid ? haspermission($uid,  {'editcatalogue' => 'edit_items_restricted'}) : undef;
440
# In case user is a superlibrarian, editing is not restricted
441
# In case user is a superlibrarian, editing is not restricted
441
$restrictededition = 0 if ($restrictededition != 0 &&  C4::Context->IsSuperLibrarian());
442
$restrictededition = 0 if ($restrictededition != 0 &&  C4::Context->IsSuperLibrarian());
Lines 853-865 foreach my $field (@fields) { Link Here
853
						|| $subfieldvalue;
854
						|| $subfieldvalue;
854
        }
855
        }
855
856
856
        if (($field->tag eq $branchtagfield) && ($subfieldcode eq $branchtagsubfield) && C4::Context->preference("IndependentBranches")) {
857
        if (   $subfieldvalue
858
            && ( $field->tag eq $branchtagfield )
859
            && ( $subfieldcode eq $branchtagsubfield ) )
860
        {
857
            #verifying rights
861
            #verifying rights
858
            my $userenv = C4::Context->userenv();
862
            unless ( $patron->can_edit_item($subfieldvalue) ) {
859
            unless (C4::Context->IsSuperLibrarian() or (($userenv->{'branch'} eq $subfieldvalue))){
863
                warn "NOMOD";
860
                $this_row{'nomod'} = 1;
864
                $this_row{'nomod'} = 1;
861
            }
865
            }
862
        }
866
        }
867
863
        $this_row{itemnumber} = $subfieldvalue if ($field->tag() eq $itemtagfield && $subfieldcode eq $itemtagsubfield);
868
        $this_row{itemnumber} = $subfieldvalue if ($field->tag() eq $itemtagfield && $subfieldcode eq $itemtagsubfield);
864
869
865
        if ( C4::Context->preference('EasyAnalyticalRecords') ) {
870
        if ( C4::Context->preference('EasyAnalyticalRecords') ) {
(-)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 (-12 / +8 lines)
Lines 81-87 my ($template, $loggedinuser, $cookie) Link Here
81
$template->param( searchid => scalar $input->param('searchid'), );
81
$template->param( searchid => scalar $input->param('searchid'), );
82
82
83
# Does the user have a restricted item edition permission?
83
# Does the user have a restricted item edition permission?
84
my $uid = $loggedinuser ? Koha::Patrons->find( $loggedinuser )->userid : undef;
84
my $patron = Koha::Patrons->find( $loggedinuser );
85
my $uid = $loggedinuser ? $patron->userid : undef;
85
my $restrictededition = $uid ? haspermission($uid,  {'tools' => 'items_batchmod_restricted'}) : undef;
86
my $restrictededition = $uid ? haspermission($uid,  {'tools' => 'items_batchmod_restricted'}) : undef;
86
# In case user is a superlibrarian, edition is not restricted
87
# In case user is a superlibrarian, edition is not restricted
87
$restrictededition = 0 if ($restrictededition != 0 && C4::Context->IsSuperLibrarian());
88
$restrictededition = 0 if ($restrictededition != 0 && C4::Context->IsSuperLibrarian());
Lines 671-691 sub BuildItemsData{ Link Here
671
    my (  $itemtagfield,   $itemtagsubfield) = &GetMarcFromKohaField( "items.itemnumber" );
672
    my (  $itemtagfield,   $itemtagsubfield) = &GetMarcFromKohaField( "items.itemnumber" );
672
    my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField( "items.homebranch" );
673
    my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField( "items.homebranch" );
673
		foreach my $itemnumber (@itemnumbers){
674
		foreach my $itemnumber (@itemnumbers){
674
            my $itemdata = Koha::Items->find($itemnumber);
675
            my $item = Koha::Items->find($itemnumber);
675
            next unless $itemdata; # Should have been tested earlier, but just in case...
676
            next unless $item; # Should have been tested earlier, but just in case...
676
            $itemdata = $itemdata->unblessed;
677
            my $itemdata = $item->unblessed;
677
			my $itemmarc=Item2Marc($itemdata);
678
			my $itemmarc=Item2Marc($itemdata);
678
			my %this_row;
679
			my %this_row;
679
			foreach my $field (grep {$_->tag() eq $itemtagfield} $itemmarc->fields()) {
680
			foreach my $field (grep {$_->tag() eq $itemtagfield} $itemmarc->fields()) {
680
				# loop through each subfield
681
				# loop through each subfield
681
				my $itembranchcode=$field->subfield($branchtagsubfield);
682
				my $itembranchcode=$field->subfield($branchtagsubfield);
682
                if ($itembranchcode && C4::Context->preference("IndependentBranches")) {
683
                if ($itembranchcode) {
683
						#verifying rights
684
                    $this_row{'nomod'} = !$patron->can_edit_item($item);
684
						my $userenv = C4::Context->userenv();
685
                }
685
                        unless (C4::Context->IsSuperLibrarian() or (($userenv->{'branch'} eq $itembranchcode))){
686
								$this_row{'nomod'}=1;
687
						}
688
				}
689
				my $tag=$field->tag();
686
				my $tag=$field->tag();
690
				foreach my $subfield ($field->subfields) {
687
				foreach my $subfield ($field->subfields) {
691
					my ($subfcode,$subfvalue)=@$subfield;
688
					my ($subfcode,$subfvalue)=@$subfield;
692
- 

Return to bug 20256