Lines 21-26
use Mojo::Base 'Mojolicious::Controller';
Link Here
|
21 |
use Mojo::JSON; |
21 |
use Mojo::JSON; |
22 |
|
22 |
|
23 |
use C4::Auth qw( haspermission ); |
23 |
use C4::Auth qw( haspermission ); |
|
|
24 |
use C4::Items qw( GetHiddenItemnumbers ); |
24 |
|
25 |
|
25 |
use Koha::Items; |
26 |
use Koha::Items; |
26 |
|
27 |
|
Lines 36-41
sub get {
Link Here
|
36 |
# Hide non-public itemnotes if user has no staff access |
37 |
# Hide non-public itemnotes if user has no staff access |
37 |
my $user = $c->stash('koha.user'); |
38 |
my $user = $c->stash('koha.user'); |
38 |
unless ($user && haspermission($user->userid, {catalogue => 1})) { |
39 |
unless ($user && haspermission($user->userid, {catalogue => 1})) { |
|
|
40 |
|
41 |
my @hiddenitems = C4::Items::GetHiddenItemnumbers( ({ itemnumber => $itemnumber}) ); |
42 |
my %hiddenitems = map { $_ => 1 } @hiddenitems; |
43 |
|
44 |
# Pretend it was not found as it's hidden from OPAC to regular users |
45 |
return $c->$cb({error => "Item not found"}, 404) |
46 |
if $hiddenitems{$itemnumber}; |
47 |
|
39 |
$item->set({ itemnotes_nonpublic => undef }); |
48 |
$item->set({ itemnotes_nonpublic => undef }); |
40 |
} |
49 |
} |
41 |
|
50 |
|
42 |
- |
|
|