|
Lines 79-85
my ($template, $loggedinuser, $cookie)
Link Here
|
| 79 |
}); |
79 |
}); |
| 80 |
|
80 |
|
| 81 |
# Does the user have a restricted item edition permission? |
81 |
# Does the user have a restricted item edition permission? |
| 82 |
my $uid = $loggedinuser ? Koha::Patrons->find( $loggedinuser )->userid : undef; |
82 |
my $patron = Koha::Patrons->find( $loggedinuser ); |
|
|
83 |
my $uid = $loggedinuser ? $patron->userid : undef; |
| 83 |
my $restrictededition = $uid ? haspermission($uid, {'tools' => 'items_batchmod_restricted'}) : undef; |
84 |
my $restrictededition = $uid ? haspermission($uid, {'tools' => 'items_batchmod_restricted'}) : undef; |
| 84 |
# In case user is a superlibrarian, edition is not restricted |
85 |
# In case user is a superlibrarian, edition is not restricted |
| 85 |
$restrictededition = 0 if ($restrictededition != 0 && C4::Context->IsSuperLibrarian()); |
86 |
$restrictededition = 0 if ($restrictededition != 0 && C4::Context->IsSuperLibrarian()); |
|
Lines 627-647
sub BuildItemsData{
Link Here
|
| 627 |
my ( $itemtagfield, $itemtagsubfield) = &GetMarcFromKohaField( "items.itemnumber" ); |
628 |
my ( $itemtagfield, $itemtagsubfield) = &GetMarcFromKohaField( "items.itemnumber" ); |
| 628 |
my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField( "items.homebranch" ); |
629 |
my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField( "items.homebranch" ); |
| 629 |
foreach my $itemnumber (@itemnumbers){ |
630 |
foreach my $itemnumber (@itemnumbers){ |
| 630 |
my $itemdata = Koha::Items->find($itemnumber); |
631 |
my $item = Koha::Items->find($itemnumber); |
| 631 |
next unless $itemdata; # Should have been tested earlier, but just in case... |
632 |
next unless $item; # Should have been tested earlier, but just in case... |
| 632 |
$itemdata = $itemdata->unblessed; |
633 |
my $itemdata = $item->unblessed; |
| 633 |
my $itemmarc=Item2Marc($itemdata); |
634 |
my $itemmarc=Item2Marc($itemdata); |
| 634 |
my %this_row; |
635 |
my %this_row; |
| 635 |
foreach my $field (grep {$_->tag() eq $itemtagfield} $itemmarc->fields()) { |
636 |
foreach my $field (grep {$_->tag() eq $itemtagfield} $itemmarc->fields()) { |
| 636 |
# loop through each subfield |
637 |
# loop through each subfield |
| 637 |
my $itembranchcode=$field->subfield($branchtagsubfield); |
638 |
my $itembranchcode=$field->subfield($branchtagsubfield); |
| 638 |
if ($itembranchcode && C4::Context->preference("IndependentBranches")) { |
639 |
if ($itembranchcode) { |
| 639 |
#verifying rights |
640 |
$this_row{'nomod'} = !$patron->can_edit_item($item); |
| 640 |
my $userenv = C4::Context->userenv(); |
641 |
} |
| 641 |
unless (C4::Context->IsSuperLibrarian() or (($userenv->{'branch'} eq $itembranchcode))){ |
|
|
| 642 |
$this_row{'nomod'}=1; |
| 643 |
} |
| 644 |
} |
| 645 |
my $tag=$field->tag(); |
642 |
my $tag=$field->tag(); |
| 646 |
foreach my $subfield ($field->subfields) { |
643 |
foreach my $subfield ($field->subfields) { |
| 647 |
my ($subfcode,$subfvalue)=@$subfield; |
644 |
my ($subfcode,$subfvalue)=@$subfield; |
| 648 |
- |
|
|