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 |
- |
|
|