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 378-390 foreach my $item (@items) { Link Here
378
        $item->{'course_reserves'} = GetItemCourseReservesInfo( itemnumber => $item->{'itemnumber'} );
378
        $item->{'course_reserves'} = GetItemCourseReservesInfo( itemnumber => $item->{'itemnumber'} );
379
    }
379
    }
380
380
381
    if ( C4::Context->preference('IndependentBranches') ) {
381
    $item->{cannot_be_edited} = !$patron->can_edit_item( $item_object );
382
        my $userenv = C4::Context->userenv();
383
        if ( not C4::Context->IsSuperLibrarian()
384
            and $userenv->{branch} ne $item->{homebranch} ) {
385
            $item->{cannot_be_edited} = 1;
386
        }
387
    }
388
382
389
    if ( C4::Context->preference("LocalCoverImages") == 1 ) {
383
    if ( C4::Context->preference("LocalCoverImages") == 1 ) {
390
        $item->{cover_images} = $item_object->cover_images;
384
        $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 345-351 Link Here
345
                <tr>
345
                <tr>
346
                [% IF (StaffDetailItemSelection) %]
346
                [% IF (StaffDetailItemSelection) %]
347
                    <td style="text-align:center;vertical-align:middle">
347
                    <td style="text-align:center;vertical-align:middle">
348
                        <input type="checkbox" value="[% item.itemnumber | html %]" name="itemnumber" />
348
                        [% UNLESS item.cannot_be_edited %]
349
                            <input type="checkbox" value="[% item.itemnumber | html %]" name="itemnumber" />
350
                        [% END %]
349
                    </td>
351
                    </td>
350
                [% END %]
352
                [% END %]
351
                    [% IF Koha.Preference('LocalCoverImages') && ( tab == 'holdings' && itemloop_has_images || tab == 'otherholdings' && otheritemloop_has_images ) %]
353
                    [% IF Koha.Preference('LocalCoverImages') && ( tab == 'holdings' && itemloop_has_images || tab == 'otherholdings' && otheritemloop_has_images ) %]
(-)a/tools/batchMod.pl (-12 / +8 lines)
Lines 80-86 my ($template, $loggedinuser, $cookie) Link Here
80
$template->param( searchid => scalar $input->param('searchid'), );
80
$template->param( searchid => scalar $input->param('searchid'), );
81
81
82
# Does the user have a restricted item edition permission?
82
# Does the user have a restricted item edition permission?
83
my $uid = $loggedinuser ? Koha::Patrons->find( $loggedinuser )->userid : undef;
83
my $patron = Koha::Patrons->find( $loggedinuser );
84
my $uid = $loggedinuser ? $patron->userid : undef;
84
my $restrictededition = $uid ? haspermission($uid,  {'tools' => 'items_batchmod_restricted'}) : undef;
85
my $restrictededition = $uid ? haspermission($uid,  {'tools' => 'items_batchmod_restricted'}) : undef;
85
# In case user is a superlibrarian, edition is not restricted
86
# In case user is a superlibrarian, edition is not restricted
86
$restrictededition = 0 if ($restrictededition != 0 && C4::Context->IsSuperLibrarian());
87
$restrictededition = 0 if ($restrictededition != 0 && C4::Context->IsSuperLibrarian());
Lines 642-662 sub BuildItemsData{ Link Here
642
    my (  $itemtagfield,   $itemtagsubfield) = &GetMarcFromKohaField( "items.itemnumber" );
643
    my (  $itemtagfield,   $itemtagsubfield) = &GetMarcFromKohaField( "items.itemnumber" );
643
    my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField( "items.homebranch" );
644
    my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField( "items.homebranch" );
644
		foreach my $itemnumber (@itemnumbers){
645
		foreach my $itemnumber (@itemnumbers){
645
            my $itemdata = Koha::Items->find($itemnumber);
646
            my $item = Koha::Items->find($itemnumber);
646
            next unless $itemdata; # Should have been tested earlier, but just in case...
647
            next unless $item; # Should have been tested earlier, but just in case...
647
            $itemdata = $itemdata->unblessed;
648
            my $itemdata = $item->unblessed;
648
			my $itemmarc=Item2Marc($itemdata);
649
			my $itemmarc=Item2Marc($itemdata);
649
			my %this_row;
650
			my %this_row;
650
			foreach my $field (grep {$_->tag() eq $itemtagfield} $itemmarc->fields()) {
651
			foreach my $field (grep {$_->tag() eq $itemtagfield} $itemmarc->fields()) {
651
				# loop through each subfield
652
				# loop through each subfield
652
				my $itembranchcode=$field->subfield($branchtagsubfield);
653
				my $itembranchcode=$field->subfield($branchtagsubfield);
653
                if ($itembranchcode && C4::Context->preference("IndependentBranches")) {
654
                if ($itembranchcode) {
654
						#verifying rights
655
                    $this_row{'nomod'} = !$patron->can_edit_item($item);
655
						my $userenv = C4::Context->userenv();
656
                }
656
                        unless (C4::Context->IsSuperLibrarian() or (($userenv->{'branch'} eq $itembranchcode))){
657
								$this_row{'nomod'}=1;
658
						}
659
				}
660
				my $tag=$field->tag();
657
				my $tag=$field->tag();
661
				foreach my $subfield ($field->subfields) {
658
				foreach my $subfield ($field->subfields) {
662
					my ($subfcode,$subfvalue)=@$subfield;
659
					my ($subfcode,$subfvalue)=@$subfield;
663
- 

Return to bug 20256