|
Lines 53-59
use C4::Acquisition;
Link Here
|
| 53 |
use C4::Serials; # uses getsubscriptionfrom biblionumber |
53 |
use C4::Serials; # uses getsubscriptionfrom biblionumber |
| 54 |
use C4::Koha; |
54 |
use C4::Koha; |
| 55 |
use Koha::IssuingRules; |
55 |
use Koha::IssuingRules; |
| 56 |
use Koha::Items; |
|
|
| 57 |
use Koha::ItemTypes; |
56 |
use Koha::ItemTypes; |
| 58 |
use Koha::Patrons; |
57 |
use Koha::Patrons; |
| 59 |
use Koha::RecordProcessor; |
58 |
use Koha::RecordProcessor; |
|
Lines 78-114
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Link Here
|
| 78 |
} |
77 |
} |
| 79 |
); |
78 |
); |
| 80 |
|
79 |
|
| 81 |
my $patron = Koha::Patrons->find( $loggedinuser ); |
|
|
| 82 |
my $borcat = q{}; |
| 83 |
if ( $patron && C4::Context->preference('OpacHiddenItemsExceptions') ) { |
| 84 |
$borcat = $patron->categorycode; |
| 85 |
} |
| 86 |
|
80 |
|
| 87 |
my $record = GetMarcBiblio({ |
81 |
my $biblio = Koha::Biblios->find( $biblionumber, { prefetch => [ 'biblio_metadatas' ] } ); |
| 88 |
biblionumber => $biblionumber, |
82 |
my $patron = Koha::Patrons->find($loggedinuser); |
| 89 |
embed_items => 1, |
|
|
| 90 |
opac => 1, |
| 91 |
borcat => $borcat }); |
| 92 |
if ( ! $record ) { |
| 93 |
print $query->redirect("/cgi-bin/koha/errors/404.pl"); |
| 94 |
exit; |
| 95 |
} |
| 96 |
|
83 |
|
| 97 |
my @all_items = GetItemsInfo($biblionumber); |
84 |
my $opachiddenitems_rules; |
| 98 |
my $biblio = Koha::Biblios->find( $biblionumber ); |
85 |
eval { |
| 99 |
my $framework = $biblio ? $biblio->frameworkcode : q{}; |
86 |
my $yaml = C4::Context->preference('OpacHiddenItems') . "\n\n"; |
| 100 |
my ($tag_itemnumber, $subtag_itemnumber) = &GetMarcFromKohaField('items.itemnumber',$framework); |
87 |
$opachiddenitems_rules = YAML::Load($yaml); |
| 101 |
my @nonhiddenitems = $record->field($tag_itemnumber); |
88 |
}; |
| 102 |
if (scalar @all_items >= 1 && scalar @nonhiddenitems == 0) { |
89 |
|
| 103 |
print $query->redirect('/cgi-bin/koha/errors/404.pl'); # escape early |
90 |
unless ( $patron and $patron->category->override_hidden_items ) { |
| 104 |
exit; |
91 |
# only skip this check if there's a logged in user |
|
|
92 |
# and its category overrides OpacHiddenItems |
| 93 |
if ( $biblio->hidden_in_opac({ rules => $opachiddenitems_rules }) ) { |
| 94 |
print $query->redirect('/cgi-bin/koha/errors/404.pl'); # escape early |
| 95 |
exit; |
| 96 |
} |
| 105 |
} |
97 |
} |
| 106 |
|
98 |
|
|
|
99 |
my $record = $biblio->metadata->record; |
| 100 |
my $marcflavour = C4::Context->preference("marcflavour"); |
| 101 |
|
| 107 |
my $record_processor = Koha::RecordProcessor->new({ |
102 |
my $record_processor = Koha::RecordProcessor->new({ |
| 108 |
filters => 'ViewPolicy', |
103 |
filters => 'ViewPolicy', |
| 109 |
options => { |
104 |
options => { |
| 110 |
interface => 'opac', |
105 |
interface => 'opac', |
| 111 |
frameworkcode => $framework |
106 |
frameworkcode => $biblio->frameworkcode |
| 112 |
} |
107 |
} |
| 113 |
}); |
108 |
}); |
| 114 |
$record_processor->process($record); |
109 |
$record_processor->process($record); |
|
Lines 121-144
if(my $cart_list = $query->cookie("bib_list")){
Link Here
|
| 121 |
} |
116 |
} |
| 122 |
} |
117 |
} |
| 123 |
|
118 |
|
| 124 |
my $marcflavour = C4::Context->preference("marcflavour"); |
|
|
| 125 |
|
| 126 |
# some useful variables for enhanced content; |
119 |
# some useful variables for enhanced content; |
| 127 |
# in each case, we're grabbing the first value we find in |
120 |
# in each case, we're grabbing the first value we find in |
| 128 |
# the record and normalizing it |
121 |
# the record and normalizing it |
| 129 |
my $upc = GetNormalizedUPC($record,$marcflavour); |
122 |
my $upc = GetNormalizedUPC( $record, $marcflavour ); |
| 130 |
my $ean = GetNormalizedEAN($record,$marcflavour); |
123 |
my $ean = GetNormalizedEAN( $record, $marcflavour ); |
| 131 |
my $oclc = GetNormalizedOCLCNumber($record,$marcflavour); |
124 |
my $oclc = GetNormalizedOCLCNumber( $record, $marcflavour ); |
| 132 |
my $isbn = GetNormalizedISBN(undef,$record,$marcflavour); |
125 |
my $isbn = GetNormalizedISBN( undef, $record, $marcflavour ); |
| 133 |
my $content_identifier_exists; |
126 |
my $content_identifier_exists; |
| 134 |
if ( $isbn or $ean or $oclc or $upc ) { |
127 |
if ( $isbn or $ean or $oclc or $upc ) { |
| 135 |
$content_identifier_exists = 1; |
128 |
$content_identifier_exists = 1; |
| 136 |
} |
129 |
} |
| 137 |
$template->param( |
130 |
$template->param( |
| 138 |
normalized_upc => $upc, |
131 |
normalized_upc => $upc, |
| 139 |
normalized_ean => $ean, |
132 |
normalized_ean => $ean, |
| 140 |
normalized_oclc => $oclc, |
133 |
normalized_oclc => $oclc, |
| 141 |
normalized_isbn => $isbn, |
134 |
normalized_isbn => $isbn, |
| 142 |
content_identifier_exists => $content_identifier_exists, |
135 |
content_identifier_exists => $content_identifier_exists, |
| 143 |
); |
136 |
); |
| 144 |
|
137 |
|
|
Lines 174-192
my $allow_onshelf_holds;
Link Here
|
| 174 |
my $res = GetISBDView({ |
167 |
my $res = GetISBDView({ |
| 175 |
'record' => $record, |
168 |
'record' => $record, |
| 176 |
'template' => 'opac', |
169 |
'template' => 'opac', |
| 177 |
'framework' => $framework |
170 |
'framework' => $biblio->frameworkcode |
| 178 |
}); |
171 |
}); |
| 179 |
|
172 |
|
| 180 |
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } }; |
173 |
my $items = $biblio->items; |
| 181 |
for my $itm (@all_items) { |
174 |
while ( my $item = $items->next ) { |
| 182 |
my $item = Koha::Items->find( $itm->{itemnumber} ); |
|
|
| 183 |
$norequests = 0 |
175 |
$norequests = 0 |
| 184 |
if $norequests |
176 |
if $norequests |
| 185 |
&& !$itm->{'withdrawn'} |
177 |
&& !$item->withdrawn |
| 186 |
&& !$itm->{'itemlost'} |
178 |
&& !$item->itemlost |
| 187 |
&& ($itm->{'itemnotforloan'}<0 || not $itm->{'itemnotforloan'}) |
179 |
&& ($item->notforloan < 0 || not $item->notforloan ) |
| 188 |
&& !$itemtypes->{$itm->{'itype'}}->{notforloan} |
180 |
&& !Koha::ItemTypes->find($item->effective_itemtype)->notforloan |
| 189 |
&& $itm->{'itemnumber'}; |
181 |
&& $item->itemnumber; |
| 190 |
|
182 |
|
| 191 |
$allow_onshelf_holds = Koha::IssuingRules->get_onshelfholds_policy( { item => $item, patron => $patron } ) |
183 |
$allow_onshelf_holds = Koha::IssuingRules->get_onshelfholds_policy( { item => $item, patron => $patron } ) |
| 192 |
unless $allow_onshelf_holds; |
184 |
unless $allow_onshelf_holds; |
| 193 |
- |
|
|