#---- branch
if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
- return Koha::Libraries->find($value)->branchname;
+ my $branch = Koha::Libraries->find($value);
+ return $branch? $branch->branchname: q{};
}
#---- itemtypes
$onloan_items->{$key}->{itemcallnumber} = $item->{itemcallnumber};
$onloan_items->{$key}->{description} = $item->{description};
$onloan_items->{$key}->{imageurl} =
- getitemtypeimagelocation( $search_context, $itemtypes{ $item->{itype} }->{imageurl} );
+ getitemtypeimagelocation( $search_context->{'interface'}, $itemtypes{ $item->{itype} }->{imageurl} );
# if something's checked out and lost, mark it as 'long overdue'
if ( $item->{itemlost} ) {
else {
$can_place_holds = 1;
$available_count++;
- $available_items->{$prefix}->{count}++ if $item->{$hbranch};
- foreach (qw(branchname itemcallnumber description)) {
+ $available_items->{$prefix}->{count}++ if $item->{$hbranch};
+ foreach (qw(branchname itemcallnumber description)) {
$available_items->{$prefix}->{$_} = $item->{$_};
}
$available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} };
# XSLT processing of some stuff
# we fetched the sysprefs already before the loop through all retrieved record!
- my $interface = $search_context->{'interface'} eq 'opac' ? 'OPAC' : '';
if (!$scan && $xslfile) {
$oldbiblio->{XSLTResultsRecord} = XSLTParse4Display($oldbiblio->{biblionumber}, $marcrecord, $xslsyspref, 1, \@hiddenitems, $sysxml, $xslfile, $lang);
}
}
);
+my $patron = Koha::Patrons->find( $loggedinuser );
my $borcat = q{};
-if ( C4::Context->preference('OpacHiddenItemsExceptions') ) {
- # we need to fetch the borrower info here, so we can pass the category
- my $patron = Koha::Patrons->find( { borrowernumber => $loggedinuser } );
- $borcat = $patron ? $patron->categorycode : $borcat;
+if ( $patron && C4::Context->preference('OpacHiddenItemsExceptions') ) {
+ $borcat = $patron->categorycode;
}
my $record = GetMarcBiblio({
});
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
-my $patron = Koha::Patrons->find( $loggedinuser );
for my $itm (@all_items) {
my $item = Koha::Items->find( $itm->{itemnumber} );
$norequests = 0
use Modern::Perl;
use CGI qw ( -utf8 );
+use List::Util qw/none/; # well just one :)
+
use C4::Koha;
use C4::Biblio;
use C4::Items;
my $borcat = q{};
if ( C4::Context->preference('OpacHiddenItemsExceptions') ) {
# we need to fetch the borrower info here, so we can pass the category
- my $borrower = Koha::Patron->find( { borrowernumber -> $borrowernumber } );
- $borcat = $borrower ? $borrower->categorycode : $borcat;
+ my $patron = Koha::Patrons->find($borrowernumber);
+ $borcat = $patron ? $patron->categorycode : $borcat;
}
my $record_processor = Koha::RecordProcessor->new({ filters => 'ViewPolicy' });
my @all_items = GetItemsInfo($biblionumber);
my @hiddenitems;
my $patron = Koha::Patrons->find( $borrowernumber );
-my $borcat= q{};
+our $borcat= q{};
if ( C4::Context->preference('OpacHiddenItemsExceptions') ) {
$borcat = $patron ? $patron->categorycode : q{};
}
authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
}
);
+my $patron = Koha::Patrons->find( $borrowernumber );
my $lang = C4::Languages::getlanguage($cgi);
my $search_context = {};
$search_context->{'interface'} = 'opac';
if (C4::Context->preference('OpacHiddenItemsExceptions')){
- # we need to fetch the borrower info here, so we can pass the category
- my $patron = Koha::Patrons->find( { borrowernumber => $borrowernumber } );
$search_context->{'category'} = $patron ? $patron->categorycode : q{};
}
my $art_req_itypes;
if( C4::Context->preference('ArticleRequests') ) {
- my $patron = $borrowernumber ? Koha::Patrons->find( $borrowernumber ) : undef;
$art_req_itypes = Koha::IssuingRules->guess_article_requestable_itemtypes({ $patron ? ( categorycode => $patron->categorycode ) : () });
}
use_ok('Koha::BiblioUtils');
use_ok('Koha::BiblioUtils::Iterator');
-use C4::Biblio;
use C4::Items;
+use C4::Biblio;
use DBI;
use t::lib::TestBuilder;
use t::lib::Mocks;
use MARC::Field;
use Data::Dumper;
-use C4::Biblio;
use C4::Items;
+use C4::Biblio;
use C4::Labels::Layout;
use Koha::Database;