use Modern::Perl;
-use C4::Auth;
+use C4::Auth qw( get_template_and_user );
use C4::Context;
-use C4::Output;
+use C4::Output qw( parametrized_url output_html_with_http_headers );
use CGI qw ( -utf8 );
-use C4::Biblio;
-use C4::Items;
+use C4::Biblio qw(
+ CountItemsIssued
+ GetISBDView
+ GetMarcControlnumber
+ GetMarcISSN
+ TransformMarcToKoha
+);
use C4::Reserves;
-use C4::Acquisition;
-use C4::Serials; # uses getsubscriptionfrom biblionumber
-use C4::Koha;
-use Koha::IssuingRules;
+use C4::Serials qw( CountSubscriptionFromBiblionumber SearchSubscriptions GetLatestSerials );
+use C4::Koha qw(
+ GetNormalizedEAN
+ GetNormalizedISBN
+ GetNormalizedOCLCNumber
+ GetNormalizedUPC
+);
+use Koha::CirculationRules;
use Koha::ItemTypes;
use Koha::Patrons;
use Koha::RecordProcessor;
use Koha::Biblios;
+use Koha::Util::MARC;
my $query = CGI->new();
my $biblionumber = $query->param('biblionumber');
query => $query,
type => "opac",
authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
- debug => 1,
}
);
my $patron = Koha::Patrons->find($loggedinuser);
-my $opachiddenitems_rules;
-eval {
- my $yaml = C4::Context->preference('OpacHiddenItems') . "\n\n";
- $opachiddenitems_rules = YAML::Load($yaml);
-};
+my $opachiddenitems_rules = C4::Context->yaml_preference('OpacHiddenItems');
unless ( $patron and $patron->category->override_hidden_items ) {
# only skip this check if there's a logged in user
}
}
-my $record = $biblio->metadata->record;
-my $marcflavour = C4::Context->preference("marcflavour");
+my $record = $biblio->metadata->record;
+my @items = $biblio->items->filter_by_visible_in_opac({ patron => $patron })->as_list;
-my $record_processor = Koha::RecordProcessor->new({
- filters => 'ViewPolicy',
- options => {
- interface => 'opac',
- frameworkcode => $biblio->frameworkcode
+my $record_processor = Koha::RecordProcessor->new(
+ { filters => [ 'EmbedItems', 'ViewPolicy' ],
+ options => {
+ interface => 'opac',
+ frameworkcode => $biblio->frameworkcode,
+ items => \@items
+ }
}
-});
+);
$record_processor->process($record);
# get biblionumbers stored in the cart
}
}
+my $marcflavour = C4::Context->preference("marcflavour");
# some useful variables for enhanced content;
# in each case, we're grabbing the first value we find in
# the record and normalizing it
#coping with subscriptions
my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
-my $dat = TransformMarcToKoha( $record );
+my $dat = TransformMarcToKoha({ record => $record });
my @subscriptions = SearchSubscriptions({ biblionumber => $biblionumber, orderby => 'title' });
my @subs;
subscriptionsnumber => $subscriptionsnumber,
);
-my $norequests = 1;
my $allow_onshelf_holds;
my $res = GetISBDView({
'record' => $record,
my $items = $biblio->items;
while ( my $item = $items->next ) {
- $norequests = 0
- if $norequests
- && !$item->withdrawn
- && !$item->itemlost
- && ($item->notforloan < 0 || not $item->notforloan )
- && !Koha::ItemTypes->find($item->effective_itemtype)->notforloan
- && $item->itemnumber;
-
- $allow_onshelf_holds = Koha::IssuingRules->get_onshelfholds_policy( { item => $item, patron => $patron } )
+
+ $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } )
unless $allow_onshelf_holds;
}
$template->param( ReservableItems => 1 );
}
+my $norequests = ! $items->filter_by_for_hold->count;
+
$template->param(
- RequestOnOpac => C4::Context->preference("RequestOnOpac"),
norequests => $norequests,
ISBD => $res,
biblio => $biblio,
if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
$dat->{title} =~ s/\/+$//; # remove trailing slash
$dat->{title} =~ s/\s+$//; # remove trailing space
+ my $oclc_no = Koha::Util::MARC::oclc_number( $record );
$search_for_title = parametrized_url(
$search_for_title,
{
ISSN => $issn,
CONTROLNUMBER => $marccontrolnumber,
BIBLIONUMBER => $biblionumber,
+ OCLC_NO => $oclc_no,
}
);
$template->param('OPACSearchForTitleIn' => $search_for_title);