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