Lines 59-65
use C4::Koha;
Link Here
|
59 |
use List::MoreUtils qw( any uniq ); |
59 |
use List::MoreUtils qw( any uniq ); |
60 |
use Koha::Biblios; |
60 |
use Koha::Biblios; |
61 |
use Koha::IssuingRules; |
61 |
use Koha::IssuingRules; |
62 |
use Koha::Items; |
|
|
63 |
use Koha::ItemTypes; |
62 |
use Koha::ItemTypes; |
64 |
use Koha::Patrons; |
63 |
use Koha::Patrons; |
65 |
use Koha::RecordProcessor; |
64 |
use Koha::RecordProcessor; |
Lines 84-122
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Link Here
|
84 |
} |
83 |
} |
85 |
); |
84 |
); |
86 |
|
85 |
|
87 |
my $patron = Koha::Patrons->find( $loggedinuser ); |
86 |
my $biblio = Koha::Biblios->find( $biblionumber, { prefetch => [ 'metadata', 'items' ] } ); |
88 |
my $borcat = q{}; |
|
|
89 |
if ( C4::Context->preference('OpacHiddenItemsExceptions') ) { |
90 |
# we need to fetch the borrower info here, so we can pass the category |
91 |
$borcat = $patron ? $patron->categorycode : $borcat; |
92 |
} |
93 |
|
87 |
|
94 |
my $record = GetMarcBiblio({ |
88 |
unless ( $biblio ) { |
95 |
biblionumber => $biblionumber, |
|
|
96 |
embed_items => 1, |
97 |
opac => 1, |
98 |
borcat => $borcat }); |
99 |
if ( ! $record ) { |
100 |
print $query->redirect("/cgi-bin/koha/errors/404.pl"); |
89 |
print $query->redirect("/cgi-bin/koha/errors/404.pl"); |
101 |
exit; |
90 |
exit; |
102 |
} |
91 |
} |
103 |
|
92 |
|
104 |
my @all_items = GetItemsInfo($biblionumber); |
93 |
my $patron = Koha::Patrons->find( $loggedinuser ); |
105 |
my $biblio = Koha::Biblios->find( $biblionumber ); |
94 |
|
106 |
my $framework = $biblio ? $biblio->frameworkcode : q{}; |
95 |
my $opachiddenitems_rules; |
107 |
my $tagslib = &GetMarcStructure( 0, $framework ); |
96 |
eval { |
108 |
my ($tag_itemnumber,$subtag_itemnumber) = &GetMarcFromKohaField( 'items.itemnumber' ); |
97 |
my $yaml = C4::Context->preference('OpacHiddenItems') . "\n\n"; |
109 |
my @nonhiddenitems = $record->field($tag_itemnumber); |
98 |
$opachiddenitems_rules = YAML::Load($yaml); |
110 |
if (scalar @all_items >= 1 && scalar @nonhiddenitems == 0) { |
99 |
}; |
111 |
print $query->redirect("/cgi-bin/koha/errors/404.pl"); |
100 |
|
112 |
exit; |
101 |
unless ( $patron and $patron->category->override_hidden_items ) { |
|
|
102 |
# only skip this check if there's a logged in user |
103 |
# and its category overrides OpacHiddenItems |
104 |
if ( $biblio->hidden_in_opac({ rules => $opachiddenitems_rules }) ) { |
105 |
print $query->redirect('/cgi-bin/koha/errors/404.pl'); # escape early |
106 |
exit; |
107 |
} |
113 |
} |
108 |
} |
114 |
|
109 |
|
|
|
110 |
my $record = $biblio->metadata->record; |
111 |
my $marcflavour = C4::Context->preference("marcflavour"); |
112 |
|
115 |
my $record_processor = Koha::RecordProcessor->new({ |
113 |
my $record_processor = Koha::RecordProcessor->new({ |
116 |
filters => 'ViewPolicy', |
114 |
filters => 'ViewPolicy', |
117 |
options => { |
115 |
options => { |
118 |
interface => 'opac', |
116 |
interface => 'opac', |
119 |
frameworkcode => $framework |
117 |
frameworkcode => $biblio->frameworkcode |
120 |
} |
118 |
} |
121 |
}); |
119 |
}); |
122 |
$record_processor->process($record); |
120 |
$record_processor->process($record); |
Lines 129-134
if(my $cart_list = $query->cookie("bib_list")){
Link Here
|
129 |
} |
127 |
} |
130 |
} |
128 |
} |
131 |
|
129 |
|
|
|
130 |
my $tagslib = &GetMarcStructure( 0, $biblio->frameworkcode ); |
132 |
my ($bt_tag,$bt_subtag) = GetMarcFromKohaField( 'biblio.title' ); |
131 |
my ($bt_tag,$bt_subtag) = GetMarcFromKohaField( 'biblio.title' ); |
133 |
$template->param( |
132 |
$template->param( |
134 |
bibliotitle => $biblio->title, |
133 |
bibliotitle => $biblio->title, |
Lines 136-145
$template->param(
Link Here
|
136 |
$tagslib->{$bt_tag}->{$bt_subtag}->{hidden} > -8; # except -8; |
135 |
$tagslib->{$bt_tag}->{$bt_subtag}->{hidden} > -8; # except -8; |
137 |
|
136 |
|
138 |
my $allow_onshelf_holds; |
137 |
my $allow_onshelf_holds; |
139 |
for my $itm (@all_items) { |
138 |
my $items = $biblio->items; |
140 |
my $item = Koha::Items->find( $itm->{itemnumber} ); |
139 |
while ( my $item = $items->next ) { |
141 |
$allow_onshelf_holds = Koha::IssuingRules->get_onshelfholds_policy( { item => $item, patron => $patron } ); |
140 |
$allow_onshelf_holds = Koha::IssuingRules->get_onshelfholds_policy( { item => $item, patron => $patron } ) |
142 |
last if $allow_onshelf_holds; |
141 |
unless $allow_onshelf_holds; |
143 |
} |
142 |
} |
144 |
|
143 |
|
145 |
if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) { |
144 |
if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) { |
Lines 326-332
if ( C4::Context->preference("OPACISBD") ) {
Link Here
|
326 |
} |
325 |
} |
327 |
|
326 |
|
328 |
#Search for title in links |
327 |
#Search for title in links |
329 |
my $marcflavour = C4::Context->preference("marcflavour"); |
|
|
330 |
my $dat = TransformMarcToKoha( $record ); |
328 |
my $dat = TransformMarcToKoha( $record ); |
331 |
my $isbn = GetNormalizedISBN(undef,$record,$marcflavour); |
329 |
my $isbn = GetNormalizedISBN(undef,$record,$marcflavour); |
332 |
my $marccontrolnumber = GetMarcControlnumber ($record, $marcflavour); |
330 |
my $marccontrolnumber = GetMarcControlnumber ($record, $marcflavour); |
333 |
- |
|
|