|
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 628-648
sub BuildItemsData{
Link Here
|
| 628 |
my ( $itemtagfield, $itemtagsubfield) = &GetMarcFromKohaField( "items.itemnumber" ); |
629 |
my ( $itemtagfield, $itemtagsubfield) = &GetMarcFromKohaField( "items.itemnumber" ); |
| 629 |
my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField( "items.homebranch" ); |
630 |
my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField( "items.homebranch" ); |
| 630 |
foreach my $itemnumber (@itemnumbers){ |
631 |
foreach my $itemnumber (@itemnumbers){ |
| 631 |
my $itemdata = Koha::Items->find($itemnumber); |
632 |
my $item = Koha::Items->find($itemnumber); |
| 632 |
next unless $itemdata; # Should have been tested earlier, but just in case... |
633 |
next unless $item; # Should have been tested earlier, but just in case... |
| 633 |
$itemdata = $itemdata->unblessed; |
634 |
my $itemdata = $item->unblessed; |
| 634 |
my $itemmarc=Item2Marc($itemdata); |
635 |
my $itemmarc=Item2Marc($itemdata); |
| 635 |
my %this_row; |
636 |
my %this_row; |
| 636 |
foreach my $field (grep {$_->tag() eq $itemtagfield} $itemmarc->fields()) { |
637 |
foreach my $field (grep {$_->tag() eq $itemtagfield} $itemmarc->fields()) { |
| 637 |
# loop through each subfield |
638 |
# loop through each subfield |
| 638 |
my $itembranchcode=$field->subfield($branchtagsubfield); |
639 |
my $itembranchcode=$field->subfield($branchtagsubfield); |
| 639 |
if ($itembranchcode && C4::Context->preference("IndependentBranches")) { |
640 |
if ($itembranchcode) { |
| 640 |
#verifying rights |
641 |
$this_row{'nomod'} = !$patron->can_edit_item($item); |
| 641 |
my $userenv = C4::Context->userenv(); |
642 |
} |
| 642 |
unless (C4::Context->IsSuperLibrarian() or (($userenv->{'branch'} eq $itembranchcode))){ |
|
|
| 643 |
$this_row{'nomod'}=1; |
| 644 |
} |
| 645 |
} |
| 646 |
my $tag=$field->tag(); |
643 |
my $tag=$field->tag(); |
| 647 |
foreach my $subfield ($field->subfields) { |
644 |
foreach my $subfield ($field->subfields) { |
| 648 |
my ($subfcode,$subfvalue)=@$subfield; |
645 |
my ($subfcode,$subfvalue)=@$subfield; |
| 649 |
- |
|
|