my ($itemnumber,$barcode, $serial) = @_;
my $dbh = C4::Context->dbh;
my $data;
+
if ($itemnumber) {
my $sth = $dbh->prepare("
SELECT * FROM items
$sth->execute($barcode);
$data = $sth->fetchrow_hashref;
}
+
+ return unless ( $data );
+
if ( $serial) {
my $ssth = $dbh->prepare("SELECT serialseq,publisheddate from serialitems left join serial on serialitems.serialid=serial.serialid where serialitems.itemnumber=?");
$ssth->execute($data->{'itemnumber'}) ;
=head2 GetHiddenItemnumbers
-=over 4
-
-$result = GetHiddenItemnumbers(@items);
+ my @itemnumbers_to_hide = GetHiddenItemnumbers(@items);
-=back
+Given a list of items it checks which should be hidden from the OPAC given
+the current configuration. Returns a list of itemnumbers corresponding to
+those that should be hidden.
=cut
#---- branch
if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
if ( ( C4::Context->preference("IndependentBranches") )
- && ( C4::Context->userenv->{flags} % 2 != 1 ) ) {
+ && ( C4::Context->userenv && C4::Context->userenv->{flags} % 2 != 1 ) ) {
my $sth = $dbh->prepare( "SELECT branchcode,branchname FROM branches WHERE branchcode = ? ORDER BY branchname" );
$sth->execute( C4::Context->userenv->{branch} );
push @authorised_values, ""
}
}
- $defaultvalue = C4::Context->userenv->{branch};
+ $defaultvalue = C4::Context->userenv ? C4::Context->userenv->{branch} : undef;
if ( $defaultvalues and $defaultvalues->{branchcode} ) {
$defaultvalue = $defaultvalues->{branchcode};
}