Lines 84-90
my ($template, $loggedinuser, $cookie)
Link Here
|
84 |
$template->param( searchid => scalar $input->param('searchid'), ); |
84 |
$template->param( searchid => scalar $input->param('searchid'), ); |
85 |
|
85 |
|
86 |
# Does the user have a restricted item edition permission? |
86 |
# Does the user have a restricted item edition permission? |
87 |
my $uid = $loggedinuser ? Koha::Patrons->find( $loggedinuser )->userid : undef; |
87 |
my $patron = Koha::Patrons->find( $loggedinuser ); |
|
|
88 |
my $uid = $loggedinuser ? $patron->userid : undef; |
88 |
my $restrictededition = $uid ? haspermission($uid, {'tools' => 'items_batchmod_restricted'}) : undef; |
89 |
my $restrictededition = $uid ? haspermission($uid, {'tools' => 'items_batchmod_restricted'}) : undef; |
89 |
# In case user is a superlibrarian, edition is not restricted |
90 |
# In case user is a superlibrarian, edition is not restricted |
90 |
$restrictededition = 0 if ($restrictededition != 0 && C4::Context->IsSuperLibrarian()); |
91 |
$restrictededition = 0 if ($restrictededition != 0 && C4::Context->IsSuperLibrarian()); |
Lines 641-661
sub BuildItemsData{
Link Here
|
641 |
my ( $itemtagfield, $itemtagsubfield) = &GetMarcFromKohaField( "items.itemnumber" ); |
642 |
my ( $itemtagfield, $itemtagsubfield) = &GetMarcFromKohaField( "items.itemnumber" ); |
642 |
my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField( "items.homebranch" ); |
643 |
my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField( "items.homebranch" ); |
643 |
foreach my $itemnumber (@itemnumbers){ |
644 |
foreach my $itemnumber (@itemnumbers){ |
644 |
my $itemdata = Koha::Items->find($itemnumber); |
645 |
my $item = Koha::Items->find($itemnumber); |
645 |
next unless $itemdata; # Should have been tested earlier, but just in case... |
646 |
next unless $item; # Should have been tested earlier, but just in case... |
646 |
$itemdata = $itemdata->unblessed; |
647 |
my $itemdata = $item->unblessed; |
647 |
my $itemmarc=Item2Marc($itemdata); |
648 |
my $itemmarc=Item2Marc($itemdata); |
648 |
my %this_row; |
649 |
my %this_row; |
649 |
foreach my $field (grep {$_->tag() eq $itemtagfield} $itemmarc->fields()) { |
650 |
foreach my $field (grep {$_->tag() eq $itemtagfield} $itemmarc->fields()) { |
650 |
# loop through each subfield |
651 |
# loop through each subfield |
651 |
my $itembranchcode=$field->subfield($branchtagsubfield); |
652 |
my $itembranchcode=$field->subfield($branchtagsubfield); |
652 |
if ($itembranchcode && C4::Context->preference("IndependentBranches")) { |
653 |
if ($itembranchcode) { |
653 |
#verifying rights |
654 |
$this_row{'nomod'} = !$patron->can_edit_item($item); |
654 |
my $userenv = C4::Context->userenv(); |
655 |
} |
655 |
unless (C4::Context->IsSuperLibrarian() or (($userenv->{'branch'} eq $itembranchcode))){ |
|
|
656 |
$this_row{'nomod'}=1; |
657 |
} |
658 |
} |
659 |
my $tag=$field->tag(); |
656 |
my $tag=$field->tag(); |
660 |
foreach my $subfield ($field->subfields) { |
657 |
foreach my $subfield ($field->subfields) { |
661 |
my ($subfcode,$subfvalue)=@$subfield; |
658 |
my ($subfcode,$subfvalue)=@$subfield; |
662 |
- |
|
|