Lines 75-81
my ($template, $loggedinuser, $cookie)
Link Here
|
75 |
}); |
75 |
}); |
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 539-559
sub BuildItemsData{
Link Here
|
539 |
my ( $itemtagfield, $itemtagsubfield) = &GetMarcFromKohaField("items.itemnumber", ""); |
540 |
my ( $itemtagfield, $itemtagsubfield) = &GetMarcFromKohaField("items.itemnumber", ""); |
540 |
my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField("items.homebranch", ""); |
541 |
my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField("items.homebranch", ""); |
541 |
foreach my $itemnumber (@itemnumbers){ |
542 |
foreach my $itemnumber (@itemnumbers){ |
542 |
my $itemdata = Koha::Items->find($itemnumber); |
543 |
my $item = Koha::Items->find($itemnumber); |
543 |
next unless $itemdata; # Should have been tested earlier, but just in case... |
544 |
next unless $item; # Should have been tested earlier, but just in case... |
544 |
$itemdata = $itemdata->unblessed; |
545 |
my $itemdata = $item->unblessed; |
545 |
my $itemmarc=Item2Marc($itemdata); |
546 |
my $itemmarc=Item2Marc($itemdata); |
546 |
my %this_row; |
547 |
my %this_row; |
547 |
foreach my $field (grep {$_->tag() eq $itemtagfield} $itemmarc->fields()) { |
548 |
foreach my $field (grep {$_->tag() eq $itemtagfield} $itemmarc->fields()) { |
548 |
# loop through each subfield |
549 |
# loop through each subfield |
549 |
my $itembranchcode=$field->subfield($branchtagsubfield); |
550 |
my $itembranchcode=$field->subfield($branchtagsubfield); |
550 |
if ($itembranchcode && C4::Context->preference("IndependentBranches")) { |
551 |
if ($itembranchcode) { |
551 |
#verifying rights |
552 |
$this_row{'nomod'} = !$patron->can_edit_item($item); |
552 |
my $userenv = C4::Context->userenv(); |
553 |
} |
553 |
unless (C4::Context->IsSuperLibrarian() or (($userenv->{'branch'} eq $itembranchcode))){ |
|
|
554 |
$this_row{'nomod'}=1; |
555 |
} |
556 |
} |
557 |
my $tag=$field->tag(); |
554 |
my $tag=$field->tag(); |
558 |
foreach my $subfield ($field->subfields) { |
555 |
foreach my $subfield ($field->subfields) { |
559 |
my ($subfcode,$subfvalue)=@$subfield; |
556 |
my ($subfcode,$subfvalue)=@$subfield; |
560 |
- |
|
|