Lines 19-25
Link Here
|
19 |
# with Koha; if not, write to the Free Software Foundation, Inc., |
19 |
# with Koha; if not, write to the Free Software Foundation, Inc., |
20 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
20 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
21 |
|
21 |
|
22 |
|
|
|
23 |
use strict; |
22 |
use strict; |
24 |
use warnings; |
23 |
use warnings; |
25 |
|
24 |
|
Lines 35-41
use C4::Circulation;
Link Here
|
35 |
use C4::Tags qw(get_tags); |
34 |
use C4::Tags qw(get_tags); |
36 |
use C4::XISBN qw(get_xisbns get_biblionumber_from_isbn); |
35 |
use C4::XISBN qw(get_xisbns get_biblionumber_from_isbn); |
37 |
use C4::External::Amazon; |
36 |
use C4::External::Amazon; |
38 |
use C4::External::Syndetics qw(get_syndetics_index get_syndetics_summary get_syndetics_toc get_syndetics_excerpt get_syndetics_reviews get_syndetics_anotes ); |
37 |
use C4::External::Syndetics |
|
|
38 |
qw(get_syndetics_index get_syndetics_summary get_syndetics_toc get_syndetics_excerpt get_syndetics_reviews get_syndetics_anotes ); |
39 |
use C4::Review; |
39 |
use C4::Review; |
40 |
use C4::Ratings; |
40 |
use C4::Ratings; |
41 |
use C4::Members; |
41 |
use C4::Members; |
Lines 53-62
use C4::HTML5Media;
Link Here
|
53 |
use C4::CourseReserves qw(GetItemCourseReservesInfo); |
53 |
use C4::CourseReserves qw(GetItemCourseReservesInfo); |
54 |
|
54 |
|
55 |
BEGIN { |
55 |
BEGIN { |
56 |
if (C4::Context->preference('BakerTaylorEnabled')) { |
56 |
if ( C4::Context->preference('BakerTaylorEnabled') ) { |
57 |
require C4::External::BakerTaylor; |
57 |
require C4::External::BakerTaylor; |
58 |
import C4::External::BakerTaylor qw(&image_url &link_url); |
58 |
import C4::External::BakerTaylor qw(&image_url &link_url); |
59 |
} |
59 |
} |
60 |
} |
60 |
} |
61 |
|
61 |
|
62 |
my $query = new CGI; |
62 |
my $query = new CGI; |
Lines 66-72
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
Link Here
|
66 |
query => $query, |
66 |
query => $query, |
67 |
type => "opac", |
67 |
type => "opac", |
68 |
authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), |
68 |
authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), |
69 |
flagsrequired => { borrow => 1 }, |
69 |
flagsrequired => { borrow => 1 }, |
70 |
} |
70 |
} |
71 |
); |
71 |
); |
72 |
|
72 |
|
Lines 77-98
$biblionumber = int($biblionumber);
Link Here
|
77 |
##>> Handling the Serial issue filter parameters from the user |
77 |
##>> Handling the Serial issue filter parameters from the user |
78 |
## |
78 |
## |
79 |
# We can filter issues based on these five values. |
79 |
# We can filter issues based on these five values. |
80 |
my $filterBranchLimiter = $query->param('filterBranchLimiter') ? $query->param('filterBranchLimiter') : '_ShowAll'; |
80 |
my $filterBranchLimiter = |
81 |
my $filterVolume = $query->param('filterVolume') ? $query->param('filterVolume') : undef; |
81 |
$query->param('filterBranchLimiter') |
82 |
my $filterNumber = $query->param('filterNumber') ? $query->param('filterNumber') : undef; |
82 |
? $query->param('filterBranchLimiter') |
83 |
my $filterIssue = $query->param('filterIssue') ? $query->param('filterIssue') : undef; |
83 |
: undef; |
84 |
my $filterFromDate = $query->param('filterFrom') ? $query->param('filterFrom') : undef; |
84 |
my $filterVolume = |
85 |
my $filterToDate = $query->param('filterTo') ? $query->param('filterTo') : undef; |
85 |
$query->param('filterVolume') ? $query->param('filterVolume') : undef; |
86 |
|
86 |
my $filterNumber = |
87 |
my $filter; #a HASH! Collect the filters here, so they can be more conveniently moved around. |
87 |
$query->param('filterNumber') ? $query->param('filterNumber') : undef; |
|
|
88 |
my $filterIssue = |
89 |
$query->param('filterIssue') ? $query->param('filterIssue') : undef; |
90 |
my $filterFromDate = |
91 |
$query->param('filterFrom') ? $query->param('filterFrom') : undef; |
92 |
my $filterToDate = |
93 |
$query->param('filterTo') ? $query->param('filterTo') : undef; |
94 |
|
95 |
my $filter = |
96 |
{}; #a HASH! Collect the filters here, so they can be more conveniently moved around. |
88 |
|
97 |
|
89 |
#We filter by the branch only if a valid branch is given. |
98 |
#We filter by the branch only if a valid branch is given. |
90 |
if (defined $filterBranchLimiter && $filterBranchLimiter ne '_ShowAll') { |
99 |
if ( defined $filterBranchLimiter && $filterBranchLimiter ne '_ShowAll' ) { |
91 |
$filter->{branch} = $filterBranchLimiter; |
100 |
$filter->{branch} = $filterBranchLimiter; |
92 |
} |
101 |
} |
93 |
if (defined $filterVolume && length $filterVolume > 0) { |
102 |
if ( defined $filterVolume && length $filterVolume > 0 ) { |
94 |
if (!($filterVolume =~ /\d{1,4}/)) { |
103 |
if ( !( $filterVolume =~ /\d{1,4}/ ) ) { |
95 |
print $query->header(); #bad data goddamnit! |
104 |
print $query->header(); #bad data goddamnit! |
96 |
print "Invalid volume. Please try again. \n"; |
105 |
print "Invalid volume. Please try again. \n"; |
97 |
exit; |
106 |
exit; |
98 |
} |
107 |
} |
Lines 100-108
if (defined $filterVolume && length $filterVolume > 0) {
Link Here
|
100 |
$filter->{volume} = $filterVolume; |
109 |
$filter->{volume} = $filterVolume; |
101 |
} |
110 |
} |
102 |
} |
111 |
} |
103 |
if (defined $filterNumber && length $filterNumber > 0) { |
112 |
if ( defined $filterNumber && length $filterNumber > 0 ) { |
104 |
if (!($filterNumber =~ /\d{1,2}/)) { |
113 |
if ( !( $filterNumber =~ /\d{1,2}/ ) ) { |
105 |
print $query->header(); #stop spamming bad data! |
114 |
print $query->header(); #stop spamming bad data! |
106 |
print "Invalid number. Please try again. \n"; |
115 |
print "Invalid number. Please try again. \n"; |
107 |
exit; |
116 |
exit; |
108 |
} |
117 |
} |
Lines 110-118
if (defined $filterNumber && length $filterNumber > 0) {
Link Here
|
110 |
$filter->{number} = $filterNumber; |
119 |
$filter->{number} = $filterNumber; |
111 |
} |
120 |
} |
112 |
} |
121 |
} |
113 |
if (defined $filterIssue && length $filterIssue > 0) { |
122 |
if ( defined $filterIssue && length $filterIssue > 0 ) { |
114 |
if (!($filterIssue =~ /\d{1,2}/) ) { |
123 |
if ( !( $filterIssue =~ /\d{1,2}/ ) ) { |
115 |
print $query->header(); #stop spamming bad data! |
124 |
print $query->header(); #stop spamming bad data! |
116 |
print "Invalid issue. Please try again. \n"; |
125 |
print "Invalid issue. Please try again. \n"; |
117 |
exit; |
126 |
exit; |
118 |
} |
127 |
} |
Lines 120-221
if (defined $filterIssue && length $filterIssue > 0) {
Link Here
|
120 |
$filter->{issue} = $filterIssue; |
129 |
$filter->{issue} = $filterIssue; |
121 |
} |
130 |
} |
122 |
} |
131 |
} |
123 |
if (defined $filterFromDate && length $filterFromDate > 0) { |
132 |
if ( defined $filterFromDate && length $filterFromDate > 0 ) { |
124 |
if (!($filterFromDate =~ C4::Dates->regexp( C4::Context->preference('dateformat') )) ) { |
133 |
if ( |
125 |
print $query->header(); #noo not anymore noo! |
134 |
!( |
|
|
135 |
$filterFromDate =~ |
136 |
C4::Dates->regexp( C4::Context->preference('dateformat') ) |
137 |
) |
138 |
) |
139 |
{ |
140 |
print $query->header(); #noo not anymore noo! |
126 |
print "Invalid starting date. Please try again. \n"; |
141 |
print "Invalid starting date. Please try again. \n"; |
127 |
exit; |
142 |
exit; |
128 |
} |
143 |
} |
129 |
else { |
144 |
else { |
130 |
$filter->{fromDate} = C4::Dates::format_date_in_iso( $filterFromDate ); |
145 |
$filter->{fromDate} = C4::Dates::format_date_in_iso($filterFromDate); |
131 |
} |
146 |
} |
132 |
} |
147 |
} |
133 |
if (defined $filterToDate && length $filterToDate > 0) { |
148 |
if ( defined $filterToDate && length $filterToDate > 0 ) { |
134 |
if (!($filterToDate =~ C4::Dates->regexp( C4::Context->preference('dateformat') )) ) { |
149 |
if ( |
135 |
print $query->header(); #take your bad data away! |
150 |
!( |
|
|
151 |
$filterToDate =~ |
152 |
C4::Dates->regexp( C4::Context->preference('dateformat') ) |
153 |
) |
154 |
) |
155 |
{ |
156 |
print $query->header(); #take your bad data away! |
136 |
print "Invalid ending date. Please try again. \n"; |
157 |
print "Invalid ending date. Please try again. \n"; |
137 |
exit; |
158 |
exit; |
138 |
} |
159 |
} |
139 |
else { |
160 |
else { |
140 |
$filter->{toDate} = C4::Dates::format_date_in_iso( $filterToDate ); |
161 |
$filter->{toDate} = C4::Dates::format_date_in_iso($filterToDate); |
141 |
} |
162 |
} |
142 |
} |
163 |
} |
143 |
|
164 |
|
|
|
165 |
$template->param( filter => $filter ); |
166 |
|
167 |
## |
168 |
##<< Serial issues filter parameters handled! ## |
169 |
## |
170 |
|
171 |
# If there are a lot of items, and the user has not decided |
172 |
# to view them all yet, we first warn him |
173 |
my $itemsCount = GetItemsCount($biblionumber); |
174 |
my $lotsofholdingsitems = 0; |
175 |
if ( $itemsCount > C4::Context->preference('OPACmaxItemsOnDetail') |
176 |
&& !( $query->param('viewallitems') ) ) |
177 |
{ |
178 |
|
179 |
$lotsofholdingsitems = 1; |
180 |
$template->param( 'lotsofholdingsitems' => $lotsofholdingsitems ); |
181 |
} |
182 |
|
183 |
my @all_items; |
184 |
if ($lotsofholdingsitems) { |
185 |
|
186 |
#Spare the poor old DB from this possibly excruciatinly huge read operation. |
187 |
if ( !scalar(%$filter) ) { #Is the $filter empty? |
188 |
|
189 |
#Limit the amount of results to the system preference |
190 |
$filter->{limit} = C4::Context->preference('OPACmaxItemsOnDetail'); |
191 |
|
192 |
#Limit display of Items based on the users branch |
193 |
if ( C4::Context->userenv ) { |
194 |
$filter->{branch} = C4::Context->userenv->{branch}; |
195 |
$filterBranchLimiter = |
196 |
$filter->{branch}; #Making the branches loop react to this! |
197 |
|
198 |
@all_items = GetItemsInfo( $biblionumber, $filter ); |
199 |
} |
200 |
|
201 |
#Or if branch cannot be defined or has no items, then display Items only from the past year |
202 |
if ( !( scalar(@all_items) ) ) { |
203 |
delete $filter->{branch} |
204 |
; #Remove the branch filter as it gave no results |
205 |
undef $filterBranchLimiter; |
206 |
|
207 |
my $now = DateTime->now(); |
208 |
$now->set_year( ( $now->year() - 1 ) ); |
209 |
$filter->{fromDate} = Koha::DateUtils::output_pref( |
210 |
{ dt => $now, dateformat => 'iso' } ); |
211 |
$template->param( 'noBranchItems' => 1 ); |
212 |
@all_items = GetItemsInfo( $biblionumber, $filter ); |
213 |
} |
214 |
|
215 |
} |
216 |
} |
217 |
|
218 |
#If we haven't found our items yet, then pull them using whatever we've got. |
219 |
if ( !( scalar(@all_items) ) ) { |
220 |
@all_items = GetItemsInfo( $biblionumber, $filter ); |
221 |
} |
144 |
|
222 |
|
145 |
##Prepare the custom branches loop containing the _ShowAll entry to show issues from all libraries. |
223 |
##Prepare the custom branches loop containing the _ShowAll entry to show issues from all libraries. |
146 |
my $branchloop; |
224 |
my $branchloop; |
147 |
if ( $filterBranchLimiter eq '_ShowAll' || !(defined $filterBranchLimiter) ) { |
225 |
if ( $filterBranchLimiter eq '_ShowAll' || !( defined $filterBranchLimiter ) ) { |
148 |
$branchloop = C4::Branch::GetBranchesLoop('0'); #Using '0' to disable reverting to the users home branch |
226 |
$branchloop = C4::Branch::GetBranchesLoop('0') |
149 |
unshift @$branchloop, { branchcode => '_ShowAll', branchname => 'Show from any library', selected => '1', value => '_ShowAll'}; |
227 |
; #Using '0' to disable reverting to the users home branch |
|
|
228 |
unshift @$branchloop, |
229 |
{ |
230 |
branchcode => '_ShowAll', |
231 |
branchname => 'Show from any library', |
232 |
selected => '1', |
233 |
value => '_ShowAll' |
234 |
}; |
150 |
} |
235 |
} |
151 |
else { |
236 |
else { |
152 |
$branchloop = C4::Branch::GetBranchesLoop($filterBranchLimiter); |
237 |
$branchloop = C4::Branch::GetBranchesLoop($filterBranchLimiter); |
153 |
unshift @$branchloop, { branchcode => '_ShowAll', branchname => 'Show from any library', selected => '0', value => '_ShowAll'}; |
238 |
unshift @$branchloop, |
|
|
239 |
{ |
240 |
branchcode => '_ShowAll', |
241 |
branchname => 'Show from any library', |
242 |
selected => '0', |
243 |
value => '_ShowAll' |
244 |
}; |
154 |
} |
245 |
} |
155 |
$template->param( branchloop => $branchloop ); |
246 |
$template->param( branchloop => $branchloop ); |
156 |
$template->param( filter => $filter ) if defined $filter; |
|
|
157 |
|
158 |
## |
159 |
##<< Serial issues filter parameters handled! ## |
160 |
## |
161 |
|
162 |
|
163 |
my @all_items = GetItemsInfo($biblionumber, $filter); |
164 |
|
247 |
|
165 |
# Now that the filter is no longer needed, we can reuse it to keep the filter modifications in the UI, |
248 |
# Now that the filter is no longer needed, we can reuse it to keep the filter modifications in the UI, |
166 |
# by reverting the dates to the same format as in the UI layer. |
249 |
# by reverting the dates and the branch to the same format as in the UI layer. |
167 |
$filter->{fromDate} = $filterFromDate; |
250 |
$filter->{fromDate} = $filterFromDate if $filterFromDate; |
168 |
$filter->{toDate} = $filterToDate; |
251 |
$filter->{toDate} = $filterToDate if $filterToDate; |
|
|
252 |
$filter->{branch} = $filterBranchLimiter if $filterBranchLimiter; |
253 |
$template->param( 'showFilter' => 1 ) if ( scalar(%$filter) ); |
169 |
|
254 |
|
170 |
my @hiddenitems; |
255 |
my @hiddenitems; |
171 |
if (scalar @all_items >= 1) { |
256 |
if ( scalar @all_items >= 1 ) { |
172 |
push @hiddenitems, GetHiddenItemnumbers(@all_items); |
257 |
push @hiddenitems, GetHiddenItemnumbers(@all_items); |
173 |
|
258 |
|
174 |
if (scalar @hiddenitems == scalar @all_items ) { |
259 |
if ( scalar @hiddenitems == scalar @all_items ) { |
175 |
print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early |
260 |
print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early |
176 |
exit; |
261 |
exit; |
177 |
} |
262 |
} |
178 |
} |
263 |
} |
179 |
|
264 |
|
180 |
my $record = GetMarcBiblio($biblionumber); |
265 |
my $record = GetMarcBiblio($biblionumber); |
181 |
if ( ! $record ) { |
266 |
if ( !$record ) { |
182 |
print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early |
267 |
print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early |
183 |
exit; |
268 |
exit; |
184 |
} |
269 |
} |
185 |
$template->param( biblionumber => $biblionumber ); |
270 |
$template->param( biblionumber => $biblionumber ); |
186 |
|
271 |
|
187 |
#Figure out if we are dealing with a serial! This affects the filter fields in UI |
272 |
#Figure out if we are dealing with a serial! This affects the filter fields in UI |
188 |
if (scalar @all_items > 0) { |
273 |
if ( scalar @all_items > 0 ) { |
189 |
$template->param( isSerial => $all_items[0]->{serial} ); |
274 |
$template->param( isSerial => $all_items[0]->{serial} ); |
190 |
} |
275 |
} |
191 |
else { |
276 |
else { |
192 |
#It could be that a serial has no items to be displayed. This could be because there are none or the filters filter all items |
277 |
#It could be that a serial has no items to be displayed. This could be because there are none or the filters filter all items |
193 |
my $search = C4::SQLHelper::SearchInTable("biblio",{biblionumber => $biblionumber}, undef, undef, ['serial'], undef, "exact"); |
278 |
my $search = |
|
|
279 |
C4::SQLHelper::SearchInTable( "biblio", { biblionumber => $biblionumber }, |
280 |
undef, undef, ['serial'], undef, "exact" ); |
194 |
$template->param( isSerial => $search->[0]->{serial} ); |
281 |
$template->param( isSerial => $search->[0]->{serial} ); |
195 |
} |
282 |
} |
196 |
|
283 |
|
197 |
|
|
|
198 |
|
199 |
|
200 |
# get biblionumbers stored in the cart |
284 |
# get biblionumbers stored in the cart |
201 |
my @cart_list; |
285 |
my @cart_list; |
202 |
|
286 |
|
203 |
if($query->cookie("bib_list")){ |
287 |
if ( $query->cookie("bib_list") ) { |
204 |
my $cart_list = $query->cookie("bib_list"); |
288 |
my $cart_list = $query->cookie("bib_list"); |
205 |
@cart_list = split(/\//, $cart_list); |
289 |
@cart_list = split( /\//, $cart_list ); |
206 |
if ( grep {$_ eq $biblionumber} @cart_list) { |
290 |
if ( grep { $_ eq $biblionumber } @cart_list ) { |
207 |
$template->param( incart => 1 ); |
291 |
$template->param( incart => 1 ); |
208 |
} |
292 |
} |
209 |
} |
293 |
} |
210 |
|
294 |
|
211 |
|
|
|
212 |
SetUTF8Flag($record); |
295 |
SetUTF8Flag($record); |
213 |
my $marcflavour = C4::Context->preference("marcflavour"); |
296 |
my $marcflavour = C4::Context->preference("marcflavour"); |
214 |
my $ean = GetNormalizedEAN( $record, $marcflavour ); |
297 |
my $ean = GetNormalizedEAN( $record, $marcflavour ); |
215 |
|
298 |
|
216 |
# XSLT processing of some stuff |
299 |
# XSLT processing of some stuff |
217 |
if (C4::Context->preference("OPACXSLTDetailsDisplay") ) { |
300 |
if ( C4::Context->preference("OPACXSLTDetailsDisplay") ) { |
218 |
$template->param( 'XSLTBloc' => XSLTParse4Display($biblionumber, $record, "OPACXSLTDetailsDisplay" ) ); |
301 |
$template->param( 'XSLTBloc' => |
|
|
302 |
XSLTParse4Display( $biblionumber, $record, "OPACXSLTDetailsDisplay" ) |
303 |
); |
219 |
} |
304 |
} |
220 |
|
305 |
|
221 |
my $OpacBrowseResults = C4::Context->preference("OpacBrowseResults"); |
306 |
my $OpacBrowseResults = C4::Context->preference("OpacBrowseResults"); |
Lines 223-536
$template->{VARS}->{'OpacBrowseResults'} = $OpacBrowseResults;
Link Here
|
223 |
|
308 |
|
224 |
# We look for the busc param to build the simple paging from the search |
309 |
# We look for the busc param to build the simple paging from the search |
225 |
if ($OpacBrowseResults) { |
310 |
if ($OpacBrowseResults) { |
226 |
my $session = get_session($query->cookie("CGISESSID")); |
311 |
my $session = get_session( $query->cookie("CGISESSID") ); |
227 |
my %paging = (previous => {}, next => {}); |
312 |
my %paging = ( previous => {}, next => {} ); |
228 |
if ($session->param('busc')) { |
313 |
if ( $session->param('busc') ) { |
229 |
use C4::Search; |
314 |
use C4::Search; |
230 |
|
315 |
|
231 |
# Rebuild the string to store on session |
316 |
# Rebuild the string to store on session |
232 |
sub rebuildBuscParam |
317 |
sub rebuildBuscParam { |
233 |
{ |
318 |
my $arrParamsBusc = shift; |
234 |
my $arrParamsBusc = shift; |
319 |
|
235 |
|
320 |
my $pasarParams = ''; |
236 |
my $pasarParams = ''; |
321 |
my $j = 0; |
237 |
my $j = 0; |
322 |
for ( keys %$arrParamsBusc ) { |
238 |
for (keys %$arrParamsBusc) { |
323 |
if ( $_ =~ |
239 |
if ($_ =~ /^(?:query|listBiblios|newlistBiblios|query_type|simple_query|total|offset|offsetSearch|next|previous|count|expand|scan)/) { |
324 |
/^(?:query|listBiblios|newlistBiblios|query_type|simple_query|total|offset|offsetSearch|next|previous|count|expand|scan)/ |
240 |
if (defined($arrParamsBusc->{$_})) { |
325 |
) |
241 |
$pasarParams .= '&' if ($j); |
326 |
{ |
242 |
$pasarParams .= $_ . '=' . $arrParamsBusc->{$_}; |
327 |
if ( defined( $arrParamsBusc->{$_} ) ) { |
243 |
$j++; |
328 |
$pasarParams .= '&' if ($j); |
|
|
329 |
$pasarParams .= $_ . '=' . $arrParamsBusc->{$_}; |
330 |
$j++; |
331 |
} |
244 |
} |
332 |
} |
245 |
} else { |
333 |
else { |
246 |
for my $value (@{$arrParamsBusc->{$_}}) { |
334 |
for my $value ( @{ $arrParamsBusc->{$_} } ) { |
247 |
$pasarParams .= '&' if ($j); |
335 |
$pasarParams .= '&' if ($j); |
248 |
$pasarParams .= $_ . '=' . $value; |
336 |
$pasarParams .= $_ . '=' . $value; |
249 |
$j++; |
337 |
$j++; |
|
|
338 |
} |
250 |
} |
339 |
} |
251 |
} |
340 |
} |
252 |
} |
341 |
return $pasarParams; |
253 |
return $pasarParams; |
342 |
} #rebuildBuscParam |
254 |
}#rebuildBuscParam |
343 |
|
255 |
|
344 |
# Search given the current values from the busc param |
256 |
# Search given the current values from the busc param |
345 |
sub searchAgain { |
257 |
sub searchAgain |
346 |
my ( $arrParamsBusc, $offset, $results_per_page ) = @_; |
258 |
{ |
347 |
|
259 |
my ($arrParamsBusc, $offset, $results_per_page) = @_; |
348 |
my $expanded_facet = $arrParamsBusc->{'expand'}; |
260 |
|
349 |
my $branches = GetBranches(); |
261 |
my $expanded_facet = $arrParamsBusc->{'expand'}; |
350 |
my $itemtypes = GetItemTypes; |
262 |
my $branches = GetBranches(); |
351 |
my @servers; |
263 |
my $itemtypes = GetItemTypes; |
352 |
@servers = @{ $arrParamsBusc->{'server'} } |
264 |
my @servers; |
353 |
if $arrParamsBusc->{'server'}; |
265 |
@servers = @{$arrParamsBusc->{'server'}} if $arrParamsBusc->{'server'}; |
354 |
@servers = ("biblioserver") unless (@servers); |
266 |
@servers = ("biblioserver") unless (@servers); |
355 |
|
267 |
|
356 |
my ( $default_sort_by, @sort_by ); |
268 |
my ($default_sort_by, @sort_by); |
357 |
$default_sort_by = |
269 |
$default_sort_by = C4::Context->preference('OPACdefaultSortField')."_".C4::Context->preference('OPACdefaultSortOrder') if (C4::Context->preference('OPACdefaultSortField') && C4::Context->preference('OPACdefaultSortOrder')); |
358 |
C4::Context->preference('OPACdefaultSortField') . "_" |
270 |
@sort_by = @{$arrParamsBusc->{'sort_by'}} if $arrParamsBusc->{'sort_by'}; |
359 |
. C4::Context->preference('OPACdefaultSortOrder') |
271 |
$sort_by[0] = $default_sort_by if !$sort_by[0] && defined($default_sort_by); |
360 |
if ( C4::Context->preference('OPACdefaultSortField') |
272 |
my ($error, $results_hashref, $facets); |
361 |
&& C4::Context->preference('OPACdefaultSortOrder') ); |
273 |
eval { |
362 |
@sort_by = @{ $arrParamsBusc->{'sort_by'} } |
274 |
($error, $results_hashref, $facets) = getRecords($arrParamsBusc->{'query'},$arrParamsBusc->{'simple_query'},\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$itemtypes,$arrParamsBusc->{'query_type'},$arrParamsBusc->{'scan'}); |
363 |
if $arrParamsBusc->{'sort_by'}; |
275 |
}; |
364 |
$sort_by[0] = $default_sort_by |
276 |
my $hits; |
365 |
if !$sort_by[0] && defined($default_sort_by); |
277 |
my @newresults; |
366 |
my ( $error, $results_hashref, $facets ); |
278 |
for (my $i=0;$i<@servers;$i++) { |
367 |
eval { |
279 |
my $server = $servers[$i]; |
368 |
( $error, $results_hashref, $facets ) = getRecords( |
280 |
$hits = $results_hashref->{$server}->{"hits"}; |
369 |
$arrParamsBusc->{'query'}, |
281 |
@newresults = searchResults('opac', '', $hits, $results_per_page, $offset, $arrParamsBusc->{'scan'}, $results_hashref->{$server}->{"RECORDS"}); |
370 |
$arrParamsBusc->{'simple_query'}, |
282 |
} |
371 |
\@sort_by, |
283 |
return \@newresults; |
372 |
\@servers, |
284 |
}#searchAgain |
373 |
$results_per_page, |
285 |
|
374 |
$offset, |
286 |
# Build the current list of biblionumbers in this search |
375 |
$expanded_facet, |
287 |
sub buildListBiblios |
376 |
$branches, |
288 |
{ |
377 |
$itemtypes, |
289 |
my ($newresultsRef, $results_per_page) = @_; |
378 |
$arrParamsBusc->{'query_type'}, |
290 |
|
379 |
$arrParamsBusc->{'scan'} |
291 |
my $listBiblios = ''; |
380 |
); |
292 |
my $j = 0; |
381 |
}; |
293 |
foreach (@$newresultsRef) { |
382 |
my $hits; |
294 |
my $bibnum = ($_->{biblionumber})?$_->{biblionumber}:0; |
383 |
my @newresults; |
295 |
$listBiblios .= $bibnum . ','; |
384 |
|
296 |
$j++; |
385 |
for ( my $i = 0 ; $i < @servers ; $i++ ) { |
297 |
last if ($j == $results_per_page); |
386 |
my $server = $servers[$i]; |
298 |
} |
387 |
$hits = $results_hashref->{$server}->{"hits"}; |
299 |
chop $listBiblios if ($listBiblios =~ /,$/); |
388 |
@newresults = searchResults( |
300 |
return $listBiblios; |
389 |
'opac', '', $hits, $results_per_page, $offset, |
301 |
}#buildListBiblios |
390 |
$arrParamsBusc->{'scan'}, |
302 |
|
391 |
$results_hashref->{$server}->{"RECORDS"} |
303 |
my $busc = $session->param("busc"); |
392 |
); |
304 |
my @arrBusc = split(/\&(?:amp;)?/, $busc); |
|
|
305 |
my ($key, $value); |
306 |
my %arrParamsBusc = (); |
307 |
for (@arrBusc) { |
308 |
($key, $value) = split(/=/, $_, 2); |
309 |
if ($key =~ /^(?:query|listBiblios|newlistBiblios|query_type|simple_query|next|previous|total|offset|offsetSearch|count|expand|scan)/) { |
310 |
$arrParamsBusc{$key} = $value; |
311 |
} else { |
312 |
unless (exists($arrParamsBusc{$key})) { |
313 |
$arrParamsBusc{$key} = []; |
314 |
} |
393 |
} |
315 |
push @{$arrParamsBusc{$key}}, $value; |
394 |
return \@newresults; |
316 |
} |
395 |
} #searchAgain |
317 |
} |
396 |
|
318 |
my $searchAgain = 0; |
397 |
# Build the current list of biblionumbers in this search |
319 |
my $count = C4::Context->preference('OPACnumSearchResults') || 20; |
398 |
sub buildListBiblios { |
320 |
my $results_per_page = ($arrParamsBusc{'count'} && $arrParamsBusc{'count'} =~ /^[0-9]+?/)?$arrParamsBusc{'count'}:$count; |
399 |
my ( $newresultsRef, $results_per_page ) = @_; |
321 |
$arrParamsBusc{'count'} = $results_per_page; |
400 |
|
322 |
my $offset = ($arrParamsBusc{'offset'} && $arrParamsBusc{'offset'} =~ /^[0-9]+?/)?$arrParamsBusc{'offset'}:0; |
401 |
my $listBiblios = ''; |
323 |
# The value OPACnumSearchResults has changed and the search has to be rebuild |
402 |
my $j = 0; |
324 |
if ($count != $results_per_page) { |
403 |
foreach (@$newresultsRef) { |
325 |
if (exists($arrParamsBusc{'listBiblios'}) && $arrParamsBusc{'listBiblios'} =~ /^[0-9]+(?:,[0-9]+)*$/) { |
404 |
my $bibnum = ( $_->{biblionumber} ) ? $_->{biblionumber} : 0; |
326 |
my $indexBiblio = 0; |
405 |
$listBiblios .= $bibnum . ','; |
327 |
my @arrBibliosAux = split(',', $arrParamsBusc{'listBiblios'}); |
406 |
$j++; |
328 |
for (@arrBibliosAux) { |
407 |
last if ( $j == $results_per_page ); |
329 |
last if ($_ == $biblionumber); |
|
|
330 |
$indexBiblio++; |
331 |
} |
408 |
} |
332 |
$indexBiblio += $offset; |
409 |
chop $listBiblios if ( $listBiblios =~ /,$/ ); |
333 |
$offset = int($indexBiblio / $count) * $count; |
410 |
return $listBiblios; |
334 |
$arrParamsBusc{'offset'} = $offset; |
411 |
} #buildListBiblios |
335 |
} |
412 |
|
336 |
$arrParamsBusc{'count'} = $count; |
413 |
my $busc = $session->param("busc"); |
337 |
$results_per_page = $count; |
414 |
my @arrBusc = split( /\&(?:amp;)?/, $busc ); |
338 |
my $newresultsRef = searchAgain(\%arrParamsBusc, $offset, $results_per_page); |
415 |
my ( $key, $value ); |
339 |
$arrParamsBusc{'listBiblios'} = buildListBiblios($newresultsRef, $results_per_page); |
416 |
my %arrParamsBusc = (); |
340 |
delete $arrParamsBusc{'previous'} if (exists($arrParamsBusc{'previous'})); |
417 |
for (@arrBusc) { |
341 |
delete $arrParamsBusc{'next'} if (exists($arrParamsBusc{'next'})); |
418 |
( $key, $value ) = split( /=/, $_, 2 ); |
342 |
delete $arrParamsBusc{'offsetSearch'} if (exists($arrParamsBusc{'offsetSearch'})); |
419 |
if ( $key =~ |
343 |
delete $arrParamsBusc{'newlistBiblios'} if (exists($arrParamsBusc{'newlistBiblios'})); |
420 |
/^(?:query|listBiblios|newlistBiblios|query_type|simple_query|next|previous|total|offset|offsetSearch|count|expand|scan)/ |
344 |
my $newbusc = rebuildBuscParam(\%arrParamsBusc); |
421 |
) |
345 |
$session->param("busc" => $newbusc); |
422 |
{ |
346 |
@arrBusc = split(/\&(?:amp;)?/, $newbusc); |
423 |
$arrParamsBusc{$key} = $value; |
347 |
} else { |
424 |
} |
348 |
my $modifyListBiblios = 0; |
425 |
else { |
349 |
# We come from a previous click |
426 |
unless ( exists( $arrParamsBusc{$key} ) ) { |
350 |
if (exists($arrParamsBusc{'previous'})) { |
427 |
$arrParamsBusc{$key} = []; |
351 |
$modifyListBiblios = 1 if ($biblionumber == $arrParamsBusc{'previous'}); |
|
|
352 |
delete $arrParamsBusc{'previous'}; |
353 |
} elsif (exists($arrParamsBusc{'next'})) { # We come from a next click |
354 |
$modifyListBiblios = 2 if ($biblionumber == $arrParamsBusc{'next'}); |
355 |
delete $arrParamsBusc{'next'}; |
356 |
} |
357 |
if ($modifyListBiblios) { |
358 |
if (exists($arrParamsBusc{'newlistBiblios'})) { |
359 |
my $listBibliosAux = $arrParamsBusc{'listBiblios'}; |
360 |
$arrParamsBusc{'listBiblios'} = $arrParamsBusc{'newlistBiblios'}; |
361 |
my @arrAux = split(',', $listBibliosAux); |
362 |
$arrParamsBusc{'newlistBiblios'} = $listBibliosAux; |
363 |
if ($modifyListBiblios == 1) { |
364 |
$arrParamsBusc{'next'} = $arrAux[0]; |
365 |
$paging{'next'}->{biblionumber} = $arrAux[0]; |
366 |
}else { |
367 |
$arrParamsBusc{'previous'} = $arrAux[$#arrAux]; |
368 |
$paging{'previous'}->{biblionumber} = $arrAux[$#arrAux]; |
369 |
} |
428 |
} |
370 |
} else { |
429 |
push @{ $arrParamsBusc{$key} }, $value; |
371 |
delete $arrParamsBusc{'listBiblios'}; |
|
|
372 |
} |
430 |
} |
373 |
my $offsetAux = $arrParamsBusc{'offset'}; |
|
|
374 |
$arrParamsBusc{'offset'} = $arrParamsBusc{'offsetSearch'}; |
375 |
$arrParamsBusc{'offsetSearch'} = $offsetAux; |
376 |
$offset = $arrParamsBusc{'offset'}; |
377 |
my $newbusc = rebuildBuscParam(\%arrParamsBusc); |
378 |
$session->param("busc" => $newbusc); |
379 |
@arrBusc = split(/\&(?:amp;)?/, $newbusc); |
380 |
} |
431 |
} |
381 |
} |
432 |
my $searchAgain = 0; |
382 |
my $buscParam = ''; |
433 |
my $count = C4::Context->preference('OPACnumSearchResults') || 20; |
383 |
my $j = 0; |
434 |
my $results_per_page = |
384 |
# Rebuild the query for the button "back to results" |
435 |
( $arrParamsBusc{'count'} && $arrParamsBusc{'count'} =~ /^[0-9]+?/ ) |
385 |
for (@arrBusc) { |
436 |
? $arrParamsBusc{'count'} |
386 |
unless ($_ =~ /^(?:query|listBiblios|newlistBiblios|query_type|simple_query|next|previous|total|count|offsetSearch)/) { |
437 |
: $count; |
387 |
$buscParam .= '&' unless ($j == 0); |
438 |
$arrParamsBusc{'count'} = $results_per_page; |
388 |
$buscParam .= $_; |
439 |
my $offset = |
389 |
$j++; |
440 |
( $arrParamsBusc{'offset'} && $arrParamsBusc{'offset'} =~ /^[0-9]+?/ ) |
|
|
441 |
? $arrParamsBusc{'offset'} |
442 |
: 0; |
443 |
|
444 |
# The value OPACnumSearchResults has changed and the search has to be rebuild |
445 |
if ( $count != $results_per_page ) { |
446 |
if ( exists( $arrParamsBusc{'listBiblios'} ) |
447 |
&& $arrParamsBusc{'listBiblios'} =~ /^[0-9]+(?:,[0-9]+)*$/ ) |
448 |
{ |
449 |
my $indexBiblio = 0; |
450 |
my @arrBibliosAux = split( ',', $arrParamsBusc{'listBiblios'} ); |
451 |
for (@arrBibliosAux) { |
452 |
last if ( $_ == $biblionumber ); |
453 |
$indexBiblio++; |
454 |
} |
455 |
$indexBiblio += $offset; |
456 |
$offset = int( $indexBiblio / $count ) * $count; |
457 |
$arrParamsBusc{'offset'} = $offset; |
458 |
} |
459 |
$arrParamsBusc{'count'} = $count; |
460 |
$results_per_page = $count; |
461 |
my $newresultsRef = |
462 |
searchAgain( \%arrParamsBusc, $offset, $results_per_page ); |
463 |
$arrParamsBusc{'listBiblios'} = |
464 |
buildListBiblios( $newresultsRef, $results_per_page ); |
465 |
delete $arrParamsBusc{'previous'} |
466 |
if ( exists( $arrParamsBusc{'previous'} ) ); |
467 |
delete $arrParamsBusc{'next'} |
468 |
if ( exists( $arrParamsBusc{'next'} ) ); |
469 |
delete $arrParamsBusc{'offsetSearch'} |
470 |
if ( exists( $arrParamsBusc{'offsetSearch'} ) ); |
471 |
delete $arrParamsBusc{'newlistBiblios'} |
472 |
if ( exists( $arrParamsBusc{'newlistBiblios'} ) ); |
473 |
my $newbusc = rebuildBuscParam( \%arrParamsBusc ); |
474 |
$session->param( "busc" => $newbusc ); |
475 |
@arrBusc = split( /\&(?:amp;)?/, $newbusc ); |
390 |
} |
476 |
} |
391 |
} |
477 |
else { |
392 |
$template->param('busc' => $buscParam); |
478 |
my $modifyListBiblios = 0; |
393 |
my $offsetSearch; |
479 |
|
394 |
my @arrBiblios; |
480 |
# We come from a previous click |
395 |
# We are inside the list of biblios and we don't have to search |
481 |
if ( exists( $arrParamsBusc{'previous'} ) ) { |
396 |
if (exists($arrParamsBusc{'listBiblios'}) && $arrParamsBusc{'listBiblios'} =~ /^[0-9]+(?:,[0-9]+)*$/) { |
482 |
$modifyListBiblios = 1 |
397 |
@arrBiblios = split(',', $arrParamsBusc{'listBiblios'}); |
483 |
if ( $biblionumber == $arrParamsBusc{'previous'} ); |
398 |
if (@arrBiblios) { |
484 |
delete $arrParamsBusc{'previous'}; |
399 |
# We are at the first item of the list |
485 |
} |
400 |
if ($arrBiblios[0] == $biblionumber) { |
486 |
elsif ( exists( $arrParamsBusc{'next'} ) ) |
401 |
if (@arrBiblios > 1) { |
487 |
{ # We come from a next click |
402 |
for (my $j = 1; $j < @arrBiblios; $j++) { |
488 |
$modifyListBiblios = 2 |
403 |
next unless ($arrBiblios[$j]); |
489 |
if ( $biblionumber == $arrParamsBusc{'next'} ); |
404 |
$paging{'next'}->{biblionumber} = $arrBiblios[$j]; |
490 |
delete $arrParamsBusc{'next'}; |
405 |
last; |
491 |
} |
|
|
492 |
if ($modifyListBiblios) { |
493 |
if ( exists( $arrParamsBusc{'newlistBiblios'} ) ) { |
494 |
my $listBibliosAux = $arrParamsBusc{'listBiblios'}; |
495 |
$arrParamsBusc{'listBiblios'} = |
496 |
$arrParamsBusc{'newlistBiblios'}; |
497 |
my @arrAux = split( ',', $listBibliosAux ); |
498 |
$arrParamsBusc{'newlistBiblios'} = $listBibliosAux; |
499 |
if ( $modifyListBiblios == 1 ) { |
500 |
$arrParamsBusc{'next'} = $arrAux[0]; |
501 |
$paging{'next'}->{biblionumber} = $arrAux[0]; |
502 |
} |
503 |
else { |
504 |
$arrParamsBusc{'previous'} = $arrAux[$#arrAux]; |
505 |
$paging{'previous'}->{biblionumber} = $arrAux[$#arrAux]; |
406 |
} |
506 |
} |
407 |
} |
507 |
} |
408 |
# search again if we are not at the first searching list |
508 |
else { |
409 |
if ($offset && !$arrParamsBusc{'previous'}) { |
509 |
delete $arrParamsBusc{'listBiblios'}; |
410 |
$searchAgain = 1; |
|
|
411 |
$offsetSearch = $offset - $results_per_page; |
412 |
} |
413 |
# we are at the last item of the list |
414 |
} elsif ($arrBiblios[$#arrBiblios] == $biblionumber) { |
415 |
for (my $j = $#arrBiblios - 1; $j >= 0; $j--) { |
416 |
next unless ($arrBiblios[$j]); |
417 |
$paging{'previous'}->{biblionumber} = $arrBiblios[$j]; |
418 |
last; |
419 |
} |
420 |
if (!$offset) { |
421 |
# search again if we are at the first list and there is more results |
422 |
$searchAgain = 1 if (!$arrParamsBusc{'next'} && $arrParamsBusc{'total'} != @arrBiblios); |
423 |
} else { |
424 |
# search again if we aren't at the first list and there is more results |
425 |
$searchAgain = 1 if (!$arrParamsBusc{'next'} && $arrParamsBusc{'total'} > ($offset + @arrBiblios)); |
426 |
} |
510 |
} |
427 |
$offsetSearch = $offset + $results_per_page if ($searchAgain); |
511 |
my $offsetAux = $arrParamsBusc{'offset'}; |
428 |
} else { |
512 |
$arrParamsBusc{'offset'} = $arrParamsBusc{'offsetSearch'}; |
429 |
for (my $j = 1; $j < $#arrBiblios; $j++) { |
513 |
$arrParamsBusc{'offsetSearch'} = $offsetAux; |
430 |
if ($arrBiblios[$j] == $biblionumber) { |
514 |
$offset = $arrParamsBusc{'offset'}; |
431 |
for (my $z = $j - 1; $z >= 0; $z--) { |
515 |
my $newbusc = rebuildBuscParam( \%arrParamsBusc ); |
432 |
next unless ($arrBiblios[$z]); |
516 |
$session->param( "busc" => $newbusc ); |
433 |
$paging{'previous'}->{biblionumber} = $arrBiblios[$z]; |
517 |
@arrBusc = split( /\&(?:amp;)?/, $newbusc ); |
|
|
518 |
} |
519 |
} |
520 |
my $buscParam = ''; |
521 |
my $j = 0; |
522 |
|
523 |
# Rebuild the query for the button "back to results" |
524 |
for (@arrBusc) { |
525 |
unless ( $_ =~ |
526 |
/^(?:query|listBiblios|newlistBiblios|query_type|simple_query|next|previous|total|count|offsetSearch)/ |
527 |
) |
528 |
{ |
529 |
$buscParam .= '&' unless ( $j == 0 ); |
530 |
$buscParam .= $_; |
531 |
$j++; |
532 |
} |
533 |
} |
534 |
$template->param( 'busc' => $buscParam ); |
535 |
my $offsetSearch; |
536 |
my @arrBiblios; |
537 |
|
538 |
# We are inside the list of biblios and we don't have to search |
539 |
if ( exists( $arrParamsBusc{'listBiblios'} ) |
540 |
&& $arrParamsBusc{'listBiblios'} =~ /^[0-9]+(?:,[0-9]+)*$/ ) |
541 |
{ |
542 |
@arrBiblios = split( ',', $arrParamsBusc{'listBiblios'} ); |
543 |
if (@arrBiblios) { |
544 |
|
545 |
# We are at the first item of the list |
546 |
if ( $arrBiblios[0] == $biblionumber ) { |
547 |
if ( @arrBiblios > 1 ) { |
548 |
for ( my $j = 1 ; $j < @arrBiblios ; $j++ ) { |
549 |
next unless ( $arrBiblios[$j] ); |
550 |
$paging{'next'}->{biblionumber} = $arrBiblios[$j]; |
434 |
last; |
551 |
last; |
435 |
} |
552 |
} |
436 |
for (my $z = $j + 1; $z < @arrBiblios; $z++) { |
553 |
} |
437 |
next unless ($arrBiblios[$z]); |
554 |
|
438 |
$paging{'next'}->{biblionumber} = $arrBiblios[$z]; |
555 |
# search again if we are not at the first searching list |
|
|
556 |
if ( $offset && !$arrParamsBusc{'previous'} ) { |
557 |
$searchAgain = 1; |
558 |
$offsetSearch = $offset - $results_per_page; |
559 |
} |
560 |
|
561 |
# we are at the last item of the list |
562 |
} |
563 |
elsif ( $arrBiblios[$#arrBiblios] == $biblionumber ) { |
564 |
for ( my $j = $#arrBiblios - 1 ; $j >= 0 ; $j-- ) { |
565 |
next unless ( $arrBiblios[$j] ); |
566 |
$paging{'previous'}->{biblionumber} = $arrBiblios[$j]; |
567 |
last; |
568 |
} |
569 |
if ( !$offset ) { |
570 |
|
571 |
# search again if we are at the first list and there is more results |
572 |
$searchAgain = 1 |
573 |
if (!$arrParamsBusc{'next'} |
574 |
&& $arrParamsBusc{'total'} != @arrBiblios ); |
575 |
} |
576 |
else { |
577 |
# search again if we aren't at the first list and there is more results |
578 |
$searchAgain = 1 |
579 |
if (!$arrParamsBusc{'next'} |
580 |
&& $arrParamsBusc{'total'} > |
581 |
( $offset + @arrBiblios ) ); |
582 |
} |
583 |
$offsetSearch = $offset + $results_per_page |
584 |
if ($searchAgain); |
585 |
} |
586 |
else { |
587 |
for ( my $j = 1 ; $j < $#arrBiblios ; $j++ ) { |
588 |
if ( $arrBiblios[$j] == $biblionumber ) { |
589 |
for ( my $z = $j - 1 ; $z >= 0 ; $z-- ) { |
590 |
next unless ( $arrBiblios[$z] ); |
591 |
$paging{'previous'}->{biblionumber} = |
592 |
$arrBiblios[$z]; |
593 |
last; |
594 |
} |
595 |
for ( my $z = $j + 1 ; $z < @arrBiblios ; $z++ ) { |
596 |
next unless ( $arrBiblios[$z] ); |
597 |
$paging{'next'}->{biblionumber} = |
598 |
$arrBiblios[$z]; |
599 |
last; |
600 |
} |
439 |
last; |
601 |
last; |
440 |
} |
602 |
} |
441 |
last; |
|
|
442 |
} |
603 |
} |
443 |
} |
604 |
} |
444 |
} |
605 |
} |
|
|
606 |
$offsetSearch = 0 |
607 |
if ( defined($offsetSearch) && $offsetSearch < 0 ); |
445 |
} |
608 |
} |
446 |
$offsetSearch = 0 if (defined($offsetSearch) && $offsetSearch < 0); |
609 |
if ($searchAgain) { |
447 |
} |
610 |
my $newresultsRef = |
448 |
if ($searchAgain) { |
611 |
searchAgain( \%arrParamsBusc, $offsetSearch, $results_per_page ); |
449 |
my $newresultsRef = searchAgain(\%arrParamsBusc, $offsetSearch, $results_per_page); |
612 |
my @newresults = @$newresultsRef; |
450 |
my @newresults = @$newresultsRef; |
613 |
|
451 |
# build the new listBiblios |
614 |
# build the new listBiblios |
452 |
my $listBiblios = buildListBiblios(\@newresults, $results_per_page); |
615 |
my $listBiblios = |
453 |
unless (exists($arrParamsBusc{'listBiblios'})) { |
616 |
buildListBiblios( \@newresults, $results_per_page ); |
454 |
$arrParamsBusc{'listBiblios'} = $listBiblios; |
617 |
unless ( exists( $arrParamsBusc{'listBiblios'} ) ) { |
455 |
@arrBiblios = split(',', $arrParamsBusc{'listBiblios'}); |
618 |
$arrParamsBusc{'listBiblios'} = $listBiblios; |
456 |
} else { |
619 |
@arrBiblios = split( ',', $arrParamsBusc{'listBiblios'} ); |
457 |
$arrParamsBusc{'newlistBiblios'} = $listBiblios; |
620 |
} |
458 |
} |
621 |
else { |
459 |
# From the new list we build again the next and previous result |
622 |
$arrParamsBusc{'newlistBiblios'} = $listBiblios; |
460 |
if (@arrBiblios) { |
623 |
} |
461 |
if ($arrBiblios[0] == $biblionumber) { |
624 |
|
462 |
for (my $j = $#newresults; $j >= 0; $j--) { |
625 |
# From the new list we build again the next and previous result |
463 |
next unless ($newresults[$j]); |
626 |
if (@arrBiblios) { |
464 |
$paging{'previous'}->{biblionumber} = $newresults[$j]->{biblionumber}; |
627 |
if ( $arrBiblios[0] == $biblionumber ) { |
465 |
$arrParamsBusc{'previous'} = $paging{'previous'}->{biblionumber}; |
628 |
for ( my $j = $#newresults ; $j >= 0 ; $j-- ) { |
466 |
$arrParamsBusc{'offsetSearch'} = $offsetSearch; |
629 |
next unless ( $newresults[$j] ); |
467 |
last; |
630 |
$paging{'previous'}->{biblionumber} = |
|
|
631 |
$newresults[$j]->{biblionumber}; |
632 |
$arrParamsBusc{'previous'} = |
633 |
$paging{'previous'}->{biblionumber}; |
634 |
$arrParamsBusc{'offsetSearch'} = $offsetSearch; |
635 |
last; |
636 |
} |
468 |
} |
637 |
} |
469 |
} elsif ($arrBiblios[$#arrBiblios] == $biblionumber) { |
638 |
elsif ( $arrBiblios[$#arrBiblios] == $biblionumber ) { |
470 |
for (my $j = 0; $j < @newresults; $j++) { |
639 |
for ( my $j = 0 ; $j < @newresults ; $j++ ) { |
471 |
next unless ($newresults[$j]); |
640 |
next unless ( $newresults[$j] ); |
472 |
$paging{'next'}->{biblionumber} = $newresults[$j]->{biblionumber}; |
641 |
$paging{'next'}->{biblionumber} = |
473 |
$arrParamsBusc{'next'} = $paging{'next'}->{biblionumber}; |
642 |
$newresults[$j]->{biblionumber}; |
474 |
$arrParamsBusc{'offsetSearch'} = $offsetSearch; |
643 |
$arrParamsBusc{'next'} = |
475 |
last; |
644 |
$paging{'next'}->{biblionumber}; |
|
|
645 |
$arrParamsBusc{'offsetSearch'} = $offsetSearch; |
646 |
last; |
647 |
} |
476 |
} |
648 |
} |
477 |
} |
649 |
} |
|
|
650 |
|
651 |
# build new busc param |
652 |
my $newbusc = rebuildBuscParam( \%arrParamsBusc ); |
653 |
$session->param( "busc" => $newbusc ); |
478 |
} |
654 |
} |
479 |
# build new busc param |
655 |
my ( $previous, $next, $dataBiblioPaging ); |
480 |
my $newbusc = rebuildBuscParam(\%arrParamsBusc); |
656 |
|
481 |
$session->param("busc" => $newbusc); |
657 |
# Previous biblio |
482 |
} |
658 |
if ( $paging{'previous'}->{biblionumber} ) { |
483 |
my ($previous, $next, $dataBiblioPaging); |
659 |
$previous = |
484 |
# Previous biblio |
660 |
'opac-detail.pl?biblionumber=' |
485 |
if ($paging{'previous'}->{biblionumber}) { |
661 |
. $paging{'previous'}->{biblionumber} |
486 |
$previous = 'opac-detail.pl?biblionumber=' . $paging{'previous'}->{biblionumber} . '&query_desc=' . $query->param('query_desc'); |
662 |
. '&query_desc=' |
487 |
$dataBiblioPaging = GetBiblioData($paging{'previous'}->{biblionumber}); |
663 |
. $query->param('query_desc'); |
488 |
$template->param('previousTitle' => $dataBiblioPaging->{'title'}) if ($dataBiblioPaging); |
664 |
$dataBiblioPaging = |
489 |
} |
665 |
GetBiblioData( $paging{'previous'}->{biblionumber} ); |
490 |
# Next biblio |
666 |
$template->param( 'previousTitle' => $dataBiblioPaging->{'title'} ) |
491 |
if ($paging{'next'}->{biblionumber}) { |
667 |
if ($dataBiblioPaging); |
492 |
$next = 'opac-detail.pl?biblionumber=' . $paging{'next'}->{biblionumber} . '&query_desc=' . $query->param('query_desc'); |
668 |
} |
493 |
$dataBiblioPaging = GetBiblioData($paging{'next'}->{biblionumber}); |
669 |
|
494 |
$template->param('nextTitle' => $dataBiblioPaging->{'title'}) if ($dataBiblioPaging); |
670 |
# Next biblio |
495 |
} |
671 |
if ( $paging{'next'}->{biblionumber} ) { |
496 |
$template->param('previous' => $previous, 'next' => $next); |
672 |
$next = |
497 |
# Partial list of biblio results |
673 |
'opac-detail.pl?biblionumber=' |
498 |
my @listResults; |
674 |
. $paging{'next'}->{biblionumber} |
499 |
for (my $j = 0; $j < @arrBiblios; $j++) { |
675 |
. '&query_desc=' |
500 |
next unless ($arrBiblios[$j]); |
676 |
. $query->param('query_desc'); |
501 |
$dataBiblioPaging = GetBiblioData($arrBiblios[$j]) if ($arrBiblios[$j] != $biblionumber); |
677 |
$dataBiblioPaging = |
502 |
push @listResults, {index => $j + 1 + $offset, biblionumber => $arrBiblios[$j], title => ($arrBiblios[$j] == $biblionumber)?'':$dataBiblioPaging->{title}, author => ($arrBiblios[$j] != $biblionumber && $dataBiblioPaging->{author})?$dataBiblioPaging->{author}:'', url => ($arrBiblios[$j] == $biblionumber)?'':'opac-detail.pl?biblionumber=' . $arrBiblios[$j]}; |
678 |
GetBiblioData( $paging{'next'}->{biblionumber} ); |
|
|
679 |
$template->param( 'nextTitle' => $dataBiblioPaging->{'title'} ) |
680 |
if ($dataBiblioPaging); |
681 |
} |
682 |
$template->param( 'previous' => $previous, 'next' => $next ); |
683 |
|
684 |
# Partial list of biblio results |
685 |
my @listResults; |
686 |
for ( my $j = 0 ; $j < @arrBiblios ; $j++ ) { |
687 |
next unless ( $arrBiblios[$j] ); |
688 |
$dataBiblioPaging = GetBiblioData( $arrBiblios[$j] ) |
689 |
if ( $arrBiblios[$j] != $biblionumber ); |
690 |
push @listResults, |
691 |
{ |
692 |
index => $j + 1 + $offset, |
693 |
biblionumber => $arrBiblios[$j], |
694 |
title => ( $arrBiblios[$j] == $biblionumber ) ? '' |
695 |
: $dataBiblioPaging->{title}, |
696 |
author => ( |
697 |
$arrBiblios[$j] != $biblionumber |
698 |
&& $dataBiblioPaging->{author} |
699 |
) ? $dataBiblioPaging->{author} : '', |
700 |
url => ( $arrBiblios[$j] == $biblionumber ) ? '' |
701 |
: 'opac-detail.pl?biblionumber=' . $arrBiblios[$j] |
702 |
}; |
703 |
} |
704 |
$template->param( 'listResults' => \@listResults ) if (@listResults); |
705 |
$template->param( |
706 |
'indexPag' => 1 + $offset, |
707 |
'totalPag' => $arrParamsBusc{'total'}, |
708 |
'indexPagEnd' => scalar(@arrBiblios) + $offset |
709 |
); |
503 |
} |
710 |
} |
504 |
$template->param('listResults' => \@listResults) if (@listResults); |
|
|
505 |
$template->param('indexPag' => 1 + $offset, 'totalPag' => $arrParamsBusc{'total'}, 'indexPagEnd' => scalar(@arrBiblios) + $offset); |
506 |
} |
507 |
} |
711 |
} |
508 |
|
712 |
|
|
|
713 |
$template->param( |
714 |
'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') ); |
715 |
$template->param( 'ItemsIssued' => CountItemsIssued($biblionumber) ); |
509 |
|
716 |
|
510 |
|
717 |
$template->param( |
511 |
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') ); |
718 |
'OPACShowCheckoutName' => C4::Context->preference("OPACShowCheckoutName") ); |
512 |
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) ); |
719 |
$template->param( |
513 |
|
720 |
'OPACShowBarcode' => C4::Context->preference("OPACShowBarcode") ); |
514 |
|
|
|
515 |
|
516 |
$template->param('OPACShowCheckoutName' => C4::Context->preference("OPACShowCheckoutName") ); |
517 |
$template->param('OPACShowBarcode' => C4::Context->preference("OPACShowBarcode") ); |
518 |
|
721 |
|
519 |
# adding items linked via host biblios |
722 |
# adding items linked via host biblios |
520 |
|
723 |
|
521 |
my $analyticfield = '773'; |
724 |
my $analyticfield = '773'; |
522 |
if ($marcflavour eq 'MARC21' || $marcflavour eq 'NORMARC'){ |
725 |
if ( $marcflavour eq 'MARC21' || $marcflavour eq 'NORMARC' ) { |
523 |
$analyticfield = '773'; |
726 |
$analyticfield = '773'; |
524 |
} elsif ($marcflavour eq 'UNIMARC') { |
727 |
} |
|
|
728 |
elsif ( $marcflavour eq 'UNIMARC' ) { |
525 |
$analyticfield = '461'; |
729 |
$analyticfield = '461'; |
526 |
} |
730 |
} |
527 |
foreach my $hostfield ( $record->field($analyticfield)) { |
731 |
foreach my $hostfield ( $record->field($analyticfield) ) { |
528 |
my $hostbiblionumber = $hostfield->subfield("0"); |
732 |
my $hostbiblionumber = $hostfield->subfield("0"); |
529 |
my $linkeditemnumber = $hostfield->subfield("9"); |
733 |
my $linkeditemnumber = $hostfield->subfield("9"); |
530 |
my @hostitemInfos = GetItemsInfo($hostbiblionumber); |
734 |
my @hostitemInfos = GetItemsInfo($hostbiblionumber); |
531 |
foreach my $hostitemInfo (@hostitemInfos){ |
735 |
foreach my $hostitemInfo (@hostitemInfos) { |
532 |
if ($hostitemInfo->{itemnumber} eq $linkeditemnumber){ |
736 |
if ( $hostitemInfo->{itemnumber} eq $linkeditemnumber ) { |
533 |
push(@all_items, $hostitemInfo); |
737 |
push( @all_items, $hostitemInfo ); |
534 |
} |
738 |
} |
535 |
} |
739 |
} |
536 |
} |
740 |
} |
Lines 539-589
my @items;
Link Here
|
539 |
|
743 |
|
540 |
# Are there items to hide? |
744 |
# Are there items to hide? |
541 |
my $hideitems; |
745 |
my $hideitems; |
542 |
$hideitems = 1 if C4::Context->preference('hidelostitems') or scalar(@hiddenitems) > 0; |
746 |
$hideitems = 1 |
|
|
747 |
if C4::Context->preference('hidelostitems') |
748 |
or scalar(@hiddenitems) > 0; |
543 |
|
749 |
|
544 |
# Hide items |
750 |
# Hide items |
545 |
if ($hideitems) { |
751 |
if ($hideitems) { |
546 |
for my $itm (@all_items) { |
752 |
for my $itm (@all_items) { |
547 |
if ( C4::Context->preference('hidelostitems') ) { |
753 |
if ( C4::Context->preference('hidelostitems') ) { |
548 |
push @items, $itm unless $itm->{itemlost} or any { $itm->{'itemnumber'} eq $_ } @hiddenitems; |
754 |
push @items, $itm |
549 |
} else { |
755 |
unless $itm->{itemlost} |
550 |
push @items, $itm unless any { $itm->{'itemnumber'} eq $_ } @hiddenitems; |
756 |
or any { $itm->{'itemnumber'} eq $_ } @hiddenitems; |
|
|
757 |
} |
758 |
else { |
759 |
push @items, $itm |
760 |
unless any { $itm->{'itemnumber'} eq $_ } @hiddenitems; |
761 |
} |
551 |
} |
762 |
} |
552 |
} |
763 |
} |
553 |
} else { |
764 |
else { |
554 |
# Or not |
765 |
# Or not |
555 |
@items = @all_items; |
766 |
@items = @all_items; |
556 |
} |
767 |
} |
557 |
|
768 |
|
558 |
my $branches = GetBranches(); |
769 |
my $branches = GetBranches(); |
559 |
my $branch = ''; |
770 |
my $branch = ''; |
560 |
if (C4::Context->userenv){ |
771 |
if ( C4::Context->userenv ) { |
561 |
$branch = C4::Context->userenv->{branch}; |
772 |
$branch = C4::Context->userenv->{branch}; |
562 |
} |
773 |
} |
563 |
if ( C4::Context->preference('HighlightOwnItemsOnOPAC') ) { |
774 |
if ( C4::Context->preference('HighlightOwnItemsOnOPAC') ) { |
564 |
if ( |
775 |
if ( |
565 |
( ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'PatronBranch' ) && $branch ) |
776 |
( |
566 |
|| |
777 |
( |
567 |
C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'OpacURLBranch' |
778 |
C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq |
568 |
) { |
779 |
'PatronBranch' |
|
|
780 |
) |
781 |
&& $branch |
782 |
) |
783 |
|| C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq |
784 |
'OpacURLBranch' |
785 |
) |
786 |
{ |
569 |
my $branchname; |
787 |
my $branchname; |
570 |
if ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'PatronBranch' ) { |
788 |
if ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq |
|
|
789 |
'PatronBranch' ) |
790 |
{ |
571 |
$branchname = $branches->{$branch}->{'branchname'}; |
791 |
$branchname = $branches->{$branch}->{'branchname'}; |
572 |
} |
792 |
} |
573 |
elsif ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'OpacURLBranch' ) { |
793 |
elsif ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq |
|
|
794 |
'OpacURLBranch' ) |
795 |
{ |
574 |
$branchname = $branches->{ $ENV{'BRANCHCODE'} }->{'branchname'}; |
796 |
$branchname = $branches->{ $ENV{'BRANCHCODE'} }->{'branchname'}; |
575 |
} |
797 |
} |
576 |
|
798 |
|
577 |
my @our_items; |
799 |
my @our_items; |
578 |
my @other_items; |
800 |
my @other_items; |
579 |
|
801 |
|
580 |
foreach my $item ( @items ) { |
802 |
foreach my $item (@items) { |
581 |
if ( $item->{'branchname'} eq $branchname ) { |
803 |
if ( $item->{'branchname'} eq $branchname ) { |
582 |
$item->{'this_branch'} = 1; |
804 |
$item->{'this_branch'} = 1; |
583 |
push( @our_items, $item ); |
805 |
push( @our_items, $item ); |
584 |
} else { |
806 |
} |
585 |
push( @other_items, $item ); |
807 |
else { |
586 |
} |
808 |
push( @other_items, $item ); |
|
|
809 |
} |
587 |
} |
810 |
} |
588 |
|
811 |
|
589 |
@items = ( @our_items, @other_items ); |
812 |
@items = ( @our_items, @other_items ); |
Lines 593-614
if ( C4::Context->preference('HighlightOwnItemsOnOPAC') ) {
Link Here
|
593 |
my $dat = &GetBiblioData($biblionumber); |
816 |
my $dat = &GetBiblioData($biblionumber); |
594 |
|
817 |
|
595 |
my $itemtypes = GetItemTypes(); |
818 |
my $itemtypes = GetItemTypes(); |
|
|
819 |
|
596 |
# imageurl: |
820 |
# imageurl: |
597 |
my $itemtype = $dat->{'itemtype'}; |
821 |
my $itemtype = $dat->{'itemtype'}; |
598 |
if ( $itemtype ) { |
822 |
if ($itemtype) { |
599 |
$dat->{'imageurl'} = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} ); |
823 |
$dat->{'imageurl'} = |
|
|
824 |
getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} ); |
600 |
$dat->{'description'} = $itemtypes->{$itemtype}->{'description'}; |
825 |
$dat->{'description'} = $itemtypes->{$itemtype}->{'description'}; |
601 |
} |
826 |
} |
602 |
my $shelflocations =GetKohaAuthorisedValues('items.location',$dat->{'frameworkcode'}, 'opac'); |
827 |
my $shelflocations = |
603 |
my $collections = GetKohaAuthorisedValues('items.ccode',$dat->{'frameworkcode'}, 'opac'); |
828 |
GetKohaAuthorisedValues( 'items.location', $dat->{'frameworkcode'}, 'opac' ); |
604 |
my $copynumbers = GetKohaAuthorisedValues('items.copynumber',$dat->{'frameworkcode'}, 'opac'); |
829 |
my $collections = |
|
|
830 |
GetKohaAuthorisedValues( 'items.ccode', $dat->{'frameworkcode'}, 'opac' ); |
831 |
my $copynumbers = |
832 |
GetKohaAuthorisedValues( 'items.copynumber', $dat->{'frameworkcode'}, |
833 |
'opac' ); |
605 |
|
834 |
|
606 |
#coping with subscriptions |
835 |
#coping with subscriptions |
607 |
my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber); |
836 |
my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber); |
608 |
my @subscriptions = GetSubscriptions($dat->{'title'}, $dat->{'issn'}, $ean, $biblionumber ); |
837 |
my @subscriptions = |
|
|
838 |
GetSubscriptions( $dat->{'title'}, $dat->{'issn'}, $ean, $biblionumber ); |
609 |
|
839 |
|
610 |
my @subs; |
840 |
my @subs; |
611 |
$dat->{'serial'}=1 if $subscriptionsnumber; |
841 |
$dat->{'serial'} = 1 if $subscriptionsnumber; |
612 |
foreach my $subscription (@subscriptions) { |
842 |
foreach my $subscription (@subscriptions) { |
613 |
my $serials_to_display; |
843 |
my $serials_to_display; |
614 |
my %cell; |
844 |
my %cell; |
Lines 619-632
foreach my $subscription (@subscriptions) {
Link Here
|
619 |
$cell{histstartdate} = $subscription->{histstartdate}; |
849 |
$cell{histstartdate} = $subscription->{histstartdate}; |
620 |
$cell{histenddate} = $subscription->{histenddate}; |
850 |
$cell{histenddate} = $subscription->{histenddate}; |
621 |
$cell{branchcode} = $subscription->{branchcode}; |
851 |
$cell{branchcode} = $subscription->{branchcode}; |
622 |
$cell{branchname} = GetBranchName($subscription->{branchcode}); |
852 |
$cell{branchname} = GetBranchName( $subscription->{branchcode} ); |
623 |
$cell{hasalert} = $subscription->{hasalert}; |
853 |
$cell{hasalert} = $subscription->{hasalert}; |
624 |
$cell{callnumber} = $subscription->{callnumber}; |
854 |
$cell{callnumber} = $subscription->{callnumber}; |
625 |
$cell{closed} = $subscription->{closed}; |
855 |
$cell{closed} = $subscription->{closed}; |
|
|
856 |
|
626 |
#get the three latest serials. |
857 |
#get the three latest serials. |
627 |
$serials_to_display = $subscription->{opacdisplaycount}; |
858 |
$serials_to_display = $subscription->{opacdisplaycount}; |
628 |
$serials_to_display = C4::Context->preference('OPACSerialIssueDisplayCount') unless $serials_to_display; |
859 |
$serials_to_display = C4::Context->preference('OPACSerialIssueDisplayCount') |
629 |
$cell{opacdisplaycount} = $serials_to_display; |
860 |
unless $serials_to_display; |
|
|
861 |
$cell{opacdisplaycount} = $serials_to_display; |
630 |
$cell{latestserials} = |
862 |
$cell{latestserials} = |
631 |
GetLatestSerials( $subscription->{subscriptionid}, $serials_to_display ); |
863 |
GetLatestSerials( $subscription->{subscriptionid}, $serials_to_display ); |
632 |
push @subs, \%cell; |
864 |
push @subs, \%cell; |
Lines 634-804
foreach my $subscription (@subscriptions) {
Link Here
|
634 |
|
866 |
|
635 |
$dat->{'count'} = scalar(@items); |
867 |
$dat->{'count'} = scalar(@items); |
636 |
|
868 |
|
|
|
869 |
my $biblio_authorised_value_images = |
870 |
C4::Items::get_authorised_value_images( |
871 |
C4::Biblio::get_biblio_authorised_values( $biblionumber, $record ) ); |
637 |
|
872 |
|
638 |
my $biblio_authorised_value_images = C4::Items::get_authorised_value_images( C4::Biblio::get_biblio_authorised_values( $biblionumber, $record ) ); |
873 |
my ( %item_reserves, %priority ); |
639 |
|
874 |
my ( $show_holds_count, $show_priority ); |
640 |
my (%item_reserves, %priority); |
|
|
641 |
my ($show_holds_count, $show_priority); |
642 |
for ( C4::Context->preference("OPACShowHoldQueueDetails") ) { |
875 |
for ( C4::Context->preference("OPACShowHoldQueueDetails") ) { |
643 |
m/holds/o and $show_holds_count = 1; |
876 |
m/holds/o and $show_holds_count = 1; |
644 |
m/priority/ and $show_priority = 1; |
877 |
m/priority/ and $show_priority = 1; |
645 |
} |
878 |
} |
646 |
my $has_hold; |
879 |
my $has_hold; |
647 |
if ( $show_holds_count || $show_priority) { |
880 |
if ( $show_holds_count || $show_priority ) { |
648 |
my ($reserve_count,$reserves) = GetReservesFromBiblionumber($biblionumber); |
881 |
my ( $reserve_count, $reserves ) = |
649 |
$template->param( holds_count => $reserve_count ) if $show_holds_count; |
882 |
GetReservesFromBiblionumber($biblionumber); |
|
|
883 |
$template->param( holds_count => $reserve_count ) if $show_holds_count; |
650 |
foreach (@$reserves) { |
884 |
foreach (@$reserves) { |
651 |
$item_reserves{ $_->{itemnumber} }++ if $_->{itemnumber}; |
885 |
$item_reserves{ $_->{itemnumber} }++ if $_->{itemnumber}; |
652 |
if ($show_priority && $_->{borrowernumber} == $borrowernumber) { |
886 |
if ( $show_priority && $_->{borrowernumber} == $borrowernumber ) { |
653 |
$has_hold = 1; |
887 |
$has_hold = 1; |
654 |
$_->{itemnumber} |
888 |
$_->{itemnumber} |
655 |
? ($priority{ $_->{itemnumber} } = $_->{priority}) |
889 |
? ( $priority{ $_->{itemnumber} } = $_->{priority} ) |
656 |
: ($template->param( priority => $_->{priority} )); |
890 |
: ( $template->param( priority => $_->{priority} ) ); |
657 |
} |
891 |
} |
658 |
} |
892 |
} |
659 |
} |
893 |
} |
660 |
$template->param( show_priority => $has_hold ) ; |
894 |
$template->param( show_priority => $has_hold ); |
661 |
|
895 |
|
662 |
my $norequests = 1; |
896 |
my $norequests = 1; |
663 |
my %itemfields; |
897 |
my %itemfields; |
664 |
my (@itemloop, @otheritemloop); |
898 |
my ( @itemloop, @otheritemloop ); |
665 |
my $currentbranch = C4::Context->userenv ? C4::Context->userenv->{branch} : undef; |
899 |
my $currentbranch = |
666 |
if ($currentbranch and C4::Context->preference('OpacSeparateHoldings')) { |
900 |
C4::Context->userenv ? C4::Context->userenv->{branch} : undef; |
667 |
$template->param(SeparateHoldings => 1); |
901 |
if ( $currentbranch and C4::Context->preference('OpacSeparateHoldings') ) { |
|
|
902 |
$template->param( SeparateHoldings => 1 ); |
668 |
} |
903 |
} |
669 |
my $separatebranch = C4::Context->preference('OpacSeparateHoldingsBranch'); |
904 |
my $separatebranch = C4::Context->preference('OpacSeparateHoldingsBranch'); |
670 |
for my $itm (@items) { |
905 |
for my $itm (@items) { |
671 |
$itm->{holds_count} = $item_reserves{ $itm->{itemnumber} }; |
906 |
$itm->{holds_count} = $item_reserves{ $itm->{itemnumber} }; |
672 |
$itm->{priority} = $priority{ $itm->{itemnumber} }; |
907 |
$itm->{priority} = $priority{ $itm->{itemnumber} }; |
673 |
$norequests = 0 |
908 |
$norequests = 0 |
674 |
if ( (not $itm->{'withdrawn'} ) |
909 |
if ( ( not $itm->{'withdrawn'} ) |
675 |
&& (not $itm->{'itemlost'} ) |
910 |
&& ( not $itm->{'itemlost'} ) |
676 |
&& ($itm->{'itemnotforloan'}<0 || not $itm->{'itemnotforloan'} ) |
911 |
&& ( $itm->{'itemnotforloan'} < 0 || not $itm->{'itemnotforloan'} ) |
677 |
&& (not $itemtypes->{$itm->{'itype'}}->{notforloan} ) |
912 |
&& ( not $itemtypes->{ $itm->{'itype'} }->{notforloan} ) |
678 |
&& ($itm->{'itemnumber'} ) ); |
913 |
&& ( $itm->{'itemnumber'} ) ); |
679 |
|
914 |
|
680 |
# get collection code description, too |
915 |
# get collection code description, too |
681 |
my $ccode = $itm->{'ccode'}; |
916 |
my $ccode = $itm->{'ccode'}; |
682 |
$itm->{'ccode'} = $collections->{$ccode} if ( defined($collections) && exists( $collections->{$ccode} ) ); |
917 |
$itm->{'ccode'} = $collections->{$ccode} |
|
|
918 |
if ( defined($collections) && exists( $collections->{$ccode} ) ); |
683 |
my $copynumber = $itm->{'copynumber'}; |
919 |
my $copynumber = $itm->{'copynumber'}; |
684 |
$itm->{'copynumber'} = $copynumbers->{$copynumber} if ( defined($copynumbers) && defined($copynumber) && exists( $copynumbers->{$copynumber} ) ); |
920 |
$itm->{'copynumber'} = $copynumbers->{$copynumber} |
|
|
921 |
if ( defined($copynumbers) |
922 |
&& defined($copynumber) |
923 |
&& exists( $copynumbers->{$copynumber} ) ); |
685 |
if ( defined $itm->{'location'} ) { |
924 |
if ( defined $itm->{'location'} ) { |
686 |
$itm->{'location_description'} = $shelflocations->{ $itm->{'location'} }; |
925 |
$itm->{'location_description'} = |
|
|
926 |
$shelflocations->{ $itm->{'location'} }; |
687 |
} |
927 |
} |
688 |
if (exists $itm->{itype} && defined($itm->{itype}) && exists $itemtypes->{ $itm->{itype} }) { |
928 |
if ( exists $itm->{itype} |
689 |
$itm->{'imageurl'} = getitemtypeimagelocation( 'opac', $itemtypes->{ $itm->{itype} }->{'imageurl'} ); |
929 |
&& defined( $itm->{itype} ) |
|
|
930 |
&& exists $itemtypes->{ $itm->{itype} } ) |
931 |
{ |
932 |
$itm->{'imageurl'} = getitemtypeimagelocation( 'opac', |
933 |
$itemtypes->{ $itm->{itype} }->{'imageurl'} ); |
690 |
$itm->{'description'} = $itemtypes->{ $itm->{itype} }->{'description'}; |
934 |
$itm->{'description'} = $itemtypes->{ $itm->{itype} }->{'description'}; |
691 |
} |
935 |
} |
692 |
foreach (qw(ccode enumchron copynumber itemnotes uri)) { |
936 |
foreach (qw(ccode enumchron copynumber itemnotes uri)) { |
693 |
$itemfields{$_} = 1 if ($itm->{$_}); |
937 |
$itemfields{$_} = 1 if ( $itm->{$_} ); |
|
|
938 |
} |
939 |
|
940 |
# walk through the item-level authorised values and populate some images |
941 |
my $item_authorised_value_images = |
942 |
C4::Items::get_authorised_value_images( |
943 |
C4::Items::get_item_authorised_values( $itm->{'itemnumber'} ) ); |
944 |
|
945 |
# warn( Data::Dumper->Dump( [ $item_authorised_value_images ], [ 'item_authorised_value_images' ] ) ); |
946 |
|
947 |
if ( $itm->{'itemlost'} ) { |
948 |
my $lostimageinfo = List::Util::first { $_->{'category'} eq 'LOST' } |
949 |
@$item_authorised_value_images; |
950 |
$itm->{'lostimageurl'} = $lostimageinfo->{'imageurl'}; |
951 |
$itm->{'lostimagelabel'} = $lostimageinfo->{'label'}; |
694 |
} |
952 |
} |
|
|
953 |
my $reserve_status = C4::Reserves::GetReserveStatus( $itm->{itemnumber} ); |
954 |
if ( $reserve_status eq "Waiting" ) { $itm->{'waiting'} = 1; } |
955 |
if ( $reserve_status eq "Reserved" ) { $itm->{'onhold'} = 1; } |
695 |
|
956 |
|
696 |
# walk through the item-level authorised values and populate some images |
957 |
my ( $transfertwhen, $transfertfrom, $transfertto ) = |
697 |
my $item_authorised_value_images = C4::Items::get_authorised_value_images( C4::Items::get_item_authorised_values( $itm->{'itemnumber'} ) ); |
958 |
GetTransfers( $itm->{itemnumber} ); |
698 |
# warn( Data::Dumper->Dump( [ $item_authorised_value_images ], [ 'item_authorised_value_images' ] ) ); |
959 |
if ( defined($transfertwhen) && $transfertwhen ne '' ) { |
699 |
|
|
|
700 |
if ( $itm->{'itemlost'} ) { |
701 |
my $lostimageinfo = List::Util::first { $_->{'category'} eq 'LOST' } @$item_authorised_value_images; |
702 |
$itm->{'lostimageurl'} = $lostimageinfo->{ 'imageurl' }; |
703 |
$itm->{'lostimagelabel'} = $lostimageinfo->{ 'label' }; |
704 |
} |
705 |
my $reserve_status = C4::Reserves::GetReserveStatus($itm->{itemnumber}); |
706 |
if( $reserve_status eq "Waiting"){ $itm->{'waiting'} = 1; } |
707 |
if( $reserve_status eq "Reserved"){ $itm->{'onhold'} = 1; } |
708 |
|
709 |
my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers($itm->{itemnumber}); |
710 |
if ( defined( $transfertwhen ) && $transfertwhen ne '' ) { |
711 |
$itm->{transfertwhen} = $transfertwhen; |
960 |
$itm->{transfertwhen} = $transfertwhen; |
712 |
$itm->{transfertfrom} = $branches->{$transfertfrom}{branchname}; |
961 |
$itm->{transfertfrom} = $branches->{$transfertfrom}{branchname}; |
713 |
$itm->{transfertto} = $branches->{$transfertto}{branchname}; |
962 |
$itm->{transfertto} = $branches->{$transfertto}{branchname}; |
714 |
} |
963 |
} |
715 |
my $itembranch = $itm->{$separatebranch}; |
964 |
my $itembranch = $itm->{$separatebranch}; |
716 |
if ($currentbranch and C4::Context->preference('OpacSeparateHoldings')) { |
965 |
if ( $currentbranch and C4::Context->preference('OpacSeparateHoldings') ) { |
717 |
if ($itembranch and $itembranch eq $currentbranch) { |
966 |
if ( $itembranch and $itembranch eq $currentbranch ) { |
718 |
push @itemloop, $itm; |
967 |
push @itemloop, $itm; |
719 |
} else { |
968 |
} |
|
|
969 |
else { |
720 |
push @otheritemloop, $itm; |
970 |
push @otheritemloop, $itm; |
721 |
} |
971 |
} |
722 |
} else { |
972 |
} |
|
|
973 |
else { |
723 |
push @itemloop, $itm; |
974 |
push @itemloop, $itm; |
724 |
} |
975 |
} |
725 |
} |
976 |
} |
726 |
|
977 |
|
727 |
# Display only one tab if one items list is empty |
978 |
# Display only one tab if one items list is empty |
728 |
if (scalar(@itemloop) == 0 || scalar(@otheritemloop) == 0) { |
979 |
if ( scalar(@itemloop) == 0 || scalar(@otheritemloop) == 0 ) { |
729 |
$template->param(SeparateHoldings => 0); |
980 |
$template->param( SeparateHoldings => 0 ); |
730 |
if (scalar(@itemloop) == 0) { |
981 |
if ( scalar(@itemloop) == 0 ) { |
731 |
@itemloop = @otheritemloop; |
982 |
@itemloop = @otheritemloop; |
732 |
} |
983 |
} |
733 |
} |
984 |
} |
734 |
|
985 |
|
735 |
# If there is a lot of items, and the user has not decided |
|
|
736 |
# to view them all yet, we first warn him |
737 |
# TODO: The limit of 50 could be a syspref |
738 |
my $viewallitems = $query->param('viewallitems'); |
739 |
if (scalar(@itemloop) >= 50 && !$viewallitems) { |
740 |
$template->param('lotsofholdingsitems' => 1); |
741 |
} |
742 |
if (scalar(@otheritemloop) >= 50 && !$viewallitems) { |
743 |
$template->param('lotsofothersholdingsitems' => 1); |
744 |
} |
745 |
|
746 |
## get notes and subjects from MARC record |
986 |
## get notes and subjects from MARC record |
747 |
my $dbh = C4::Context->dbh; |
987 |
my $dbh = C4::Context->dbh; |
748 |
my $marcnotesarray = GetMarcNotes ($record,$marcflavour); |
988 |
my $marcnotesarray = GetMarcNotes( $record, $marcflavour ); |
749 |
my $marcisbnsarray = GetMarcISBN ($record,$marcflavour); |
989 |
my $marcisbnsarray = GetMarcISBN( $record, $marcflavour ); |
750 |
my $marcauthorsarray = GetMarcAuthors ($record,$marcflavour); |
990 |
my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour ); |
751 |
my $marcsubjctsarray = GetMarcSubjects($record,$marcflavour); |
991 |
my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); |
752 |
my $marcseriesarray = GetMarcSeries ($record,$marcflavour); |
992 |
my $marcseriesarray = GetMarcSeries( $record, $marcflavour ); |
753 |
my $marcurlsarray = GetMarcUrls ($record,$marcflavour); |
993 |
my $marcurlsarray = GetMarcUrls( $record, $marcflavour ); |
754 |
my $marchostsarray = GetMarcHosts($record,$marcflavour); |
994 |
my $marchostsarray = GetMarcHosts( $record, $marcflavour ); |
755 |
my $subtitle = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber)); |
995 |
my $subtitle = |
|
|
996 |
GetRecordValue( 'subtitle', $record, GetFrameworkCode($biblionumber) ); |
756 |
|
997 |
|
757 |
$template->param( |
998 |
$template->param( |
758 |
MARCNOTES => $marcnotesarray, |
999 |
MARCNOTES => $marcnotesarray, |
759 |
MARCSUBJCTS => $marcsubjctsarray, |
1000 |
MARCSUBJCTS => $marcsubjctsarray, |
760 |
MARCAUTHORS => $marcauthorsarray, |
1001 |
MARCAUTHORS => $marcauthorsarray, |
761 |
MARCSERIES => $marcseriesarray, |
1002 |
MARCSERIES => $marcseriesarray, |
762 |
MARCURLS => $marcurlsarray, |
1003 |
MARCURLS => $marcurlsarray, |
763 |
MARCISBNS => $marcisbnsarray, |
1004 |
MARCISBNS => $marcisbnsarray, |
764 |
MARCHOSTS => $marchostsarray, |
1005 |
MARCHOSTS => $marchostsarray, |
765 |
norequests => $norequests, |
1006 |
norequests => $norequests, |
766 |
RequestOnOpac => C4::Context->preference("RequestOnOpac"), |
1007 |
RequestOnOpac => C4::Context->preference("RequestOnOpac"), |
767 |
itemdata_ccode => $itemfields{ccode}, |
1008 |
itemdata_ccode => $itemfields{ccode}, |
768 |
itemdata_enumchron => $itemfields{enumchron}, |
1009 |
itemdata_enumchron => $itemfields{enumchron}, |
769 |
itemdata_uri => $itemfields{uri}, |
1010 |
itemdata_uri => $itemfields{uri}, |
770 |
itemdata_copynumber => $itemfields{copynumber}, |
1011 |
itemdata_copynumber => $itemfields{copynumber}, |
771 |
itemdata_itemnotes => $itemfields{itemnotes}, |
1012 |
itemdata_itemnotes => $itemfields{itemnotes}, |
772 |
authorised_value_images => $biblio_authorised_value_images, |
1013 |
authorised_value_images => $biblio_authorised_value_images, |
773 |
subtitle => $subtitle, |
1014 |
subtitle => $subtitle, |
774 |
OpacStarRatings => C4::Context->preference("OpacStarRatings"), |
1015 |
OpacStarRatings => C4::Context->preference("OpacStarRatings"), |
775 |
); |
1016 |
); |
776 |
|
1017 |
|
777 |
if (C4::Context->preference("AlternateHoldingsField") && scalar @items == 0) { |
1018 |
if ( C4::Context->preference("AlternateHoldingsField") && scalar @items == 0 ) { |
778 |
my $fieldspec = C4::Context->preference("AlternateHoldingsField"); |
1019 |
my $fieldspec = C4::Context->preference("AlternateHoldingsField"); |
779 |
my $subfields = substr $fieldspec, 3; |
1020 |
my $subfields = substr $fieldspec, 3; |
780 |
my $holdingsep = C4::Context->preference("AlternateHoldingsSeparator") || ' '; |
1021 |
my $holdingsep = |
|
|
1022 |
C4::Context->preference("AlternateHoldingsSeparator") || ' '; |
781 |
my @alternateholdingsinfo = (); |
1023 |
my @alternateholdingsinfo = (); |
782 |
my @holdingsfields = $record->field(substr $fieldspec, 0, 3); |
1024 |
my @holdingsfields = $record->field( substr $fieldspec, 0, 3 ); |
783 |
|
1025 |
|
784 |
for my $field (@holdingsfields) { |
1026 |
for my $field (@holdingsfields) { |
785 |
my %holding = ( holding => '' ); |
1027 |
my %holding = ( holding => '' ); |
786 |
my $havesubfield = 0; |
1028 |
my $havesubfield = 0; |
787 |
for my $subfield ($field->subfields()) { |
1029 |
for my $subfield ( $field->subfields() ) { |
788 |
if ((index $subfields, $$subfield[0]) >= 0) { |
1030 |
if ( ( index $subfields, $$subfield[0] ) >= 0 ) { |
789 |
$holding{'holding'} .= $holdingsep if (length $holding{'holding'} > 0); |
1031 |
$holding{'holding'} .= $holdingsep |
|
|
1032 |
if ( length $holding{'holding'} > 0 ); |
790 |
$holding{'holding'} .= $$subfield[1]; |
1033 |
$holding{'holding'} .= $$subfield[1]; |
791 |
$havesubfield++; |
1034 |
$havesubfield++; |
792 |
} |
1035 |
} |
793 |
} |
1036 |
} |
794 |
if ($havesubfield) { |
1037 |
if ($havesubfield) { |
795 |
push(@alternateholdingsinfo, \%holding); |
1038 |
push( @alternateholdingsinfo, \%holding ); |
796 |
} |
1039 |
} |
797 |
} |
1040 |
} |
798 |
|
1041 |
|
799 |
$template->param( |
1042 |
$template->param( ALTERNATEHOLDINGS => \@alternateholdingsinfo, ); |
800 |
ALTERNATEHOLDINGS => \@alternateholdingsinfo, |
|
|
801 |
); |
802 |
} |
1043 |
} |
803 |
|
1044 |
|
804 |
foreach ( keys %{$dat} ) { |
1045 |
foreach ( keys %{$dat} ) { |
Lines 808-840
foreach ( keys %{$dat} ) {
Link Here
|
808 |
# some useful variables for enhanced content; |
1049 |
# some useful variables for enhanced content; |
809 |
# in each case, we're grabbing the first value we find in |
1050 |
# in each case, we're grabbing the first value we find in |
810 |
# the record and normalizing it |
1051 |
# the record and normalizing it |
811 |
my $upc = GetNormalizedUPC($record,$marcflavour); |
1052 |
my $upc = GetNormalizedUPC( $record, $marcflavour ); |
812 |
my $oclc = GetNormalizedOCLCNumber($record,$marcflavour); |
1053 |
my $oclc = GetNormalizedOCLCNumber( $record, $marcflavour ); |
813 |
my $isbn = GetNormalizedISBN(undef,$record,$marcflavour); |
1054 |
my $isbn = GetNormalizedISBN( undef, $record, $marcflavour ); |
814 |
my $content_identifier_exists; |
1055 |
my $content_identifier_exists; |
815 |
if ( $isbn or $ean or $oclc or $upc ) { |
1056 |
if ( $isbn or $ean or $oclc or $upc ) { |
816 |
$content_identifier_exists = 1; |
1057 |
$content_identifier_exists = 1; |
817 |
} |
1058 |
} |
818 |
$template->param( |
1059 |
$template->param( |
819 |
normalized_upc => $upc, |
1060 |
normalized_upc => $upc, |
820 |
normalized_ean => $ean, |
1061 |
normalized_ean => $ean, |
821 |
normalized_oclc => $oclc, |
1062 |
normalized_oclc => $oclc, |
822 |
normalized_isbn => $isbn, |
1063 |
normalized_isbn => $isbn, |
823 |
content_identifier_exists => $content_identifier_exists, |
1064 |
content_identifier_exists => $content_identifier_exists, |
824 |
); |
1065 |
); |
825 |
|
1066 |
|
826 |
# COinS format FIXME: for books Only |
1067 |
# COinS format FIXME: for books Only |
827 |
$template->param( |
1068 |
$template->param( ocoins => GetCOinSBiblio($record), ); |
828 |
ocoins => GetCOinSBiblio($record), |
|
|
829 |
); |
830 |
|
1069 |
|
831 |
my $libravatar_enabled = 0; |
1070 |
my $libravatar_enabled = 0; |
832 |
if ( C4::Context->preference('ShowReviewer') and C4::Context->preference('ShowReviewerPhoto')) { |
1071 |
if ( C4::Context->preference('ShowReviewer') |
|
|
1072 |
and C4::Context->preference('ShowReviewerPhoto') ) |
1073 |
{ |
833 |
eval { |
1074 |
eval { |
834 |
require Libravatar::URL; |
1075 |
require Libravatar::URL; |
835 |
Libravatar::URL->import(); |
1076 |
Libravatar::URL->import(); |
836 |
}; |
1077 |
}; |
837 |
if (!$@ ) { |
1078 |
if ( !$@ ) { |
838 |
$libravatar_enabled = 1; |
1079 |
$libravatar_enabled = 1; |
839 |
} |
1080 |
} |
840 |
} |
1081 |
} |
Lines 842-871
if ( C4::Context->preference('ShowReviewer') and C4::Context->preference('ShowRe
Link Here
|
842 |
my $reviews = getreviews( $biblionumber, 1 ); |
1083 |
my $reviews = getreviews( $biblionumber, 1 ); |
843 |
my $loggedincommenter; |
1084 |
my $loggedincommenter; |
844 |
|
1085 |
|
|
|
1086 |
foreach (@$reviews) { |
1087 |
my $borrowerData = GetMember( 'borrowernumber' => $_->{borrowernumber} ); |
845 |
|
1088 |
|
846 |
|
|
|
847 |
|
848 |
foreach ( @$reviews ) { |
849 |
my $borrowerData = GetMember('borrowernumber' => $_->{borrowernumber}); |
850 |
# setting some borrower info into this hash |
1089 |
# setting some borrower info into this hash |
851 |
$_->{title} = $borrowerData->{'title'}; |
1090 |
$_->{title} = $borrowerData->{'title'}; |
852 |
$_->{surname} = $borrowerData->{'surname'}; |
1091 |
$_->{surname} = $borrowerData->{'surname'}; |
853 |
$_->{firstname} = $borrowerData->{'firstname'}; |
1092 |
$_->{firstname} = $borrowerData->{'firstname'}; |
854 |
if ($libravatar_enabled and $borrowerData->{'email'}) { |
1093 |
if ( $libravatar_enabled and $borrowerData->{'email'} ) { |
855 |
$_->{avatarurl} = libravatar_url(email => $borrowerData->{'email'}, https => $ENV{HTTPS}); |
1094 |
$_->{avatarurl} = libravatar_url( |
|
|
1095 |
email => $borrowerData->{'email'}, |
1096 |
https => $ENV{HTTPS} |
1097 |
); |
856 |
} |
1098 |
} |
857 |
$_->{userid} = $borrowerData->{'userid'}; |
1099 |
$_->{userid} = $borrowerData->{'userid'}; |
858 |
$_->{cardnumber} = $borrowerData->{'cardnumber'}; |
1100 |
$_->{cardnumber} = $borrowerData->{'cardnumber'}; |
859 |
|
1101 |
|
860 |
if ($borrowerData->{'borrowernumber'} eq $borrowernumber) { |
1102 |
if ( $borrowerData->{'borrowernumber'} eq $borrowernumber ) { |
861 |
$_->{your_comment} = 1; |
1103 |
$_->{your_comment} = 1; |
862 |
$loggedincommenter = 1; |
1104 |
$loggedincommenter = 1; |
863 |
} |
1105 |
} |
864 |
} |
1106 |
} |
865 |
|
1107 |
|
866 |
|
1108 |
if ( C4::Context->preference("ISBD") ) { |
867 |
if(C4::Context->preference("ISBD")) { |
1109 |
$template->param( ISBD => 1 ); |
868 |
$template->param(ISBD => 1); |
|
|
869 |
} |
1110 |
} |
870 |
|
1111 |
|
871 |
$template->param( |
1112 |
$template->param( |
Lines 881-1108
$template->param(
Link Here
|
881 |
|
1122 |
|
882 |
# Lists |
1123 |
# Lists |
883 |
|
1124 |
|
884 |
if (C4::Context->preference("virtualshelves") ) { |
1125 |
if ( C4::Context->preference("virtualshelves") ) { |
885 |
$template->param( 'GetShelves' => GetBibliosShelves( $biblionumber ) ); |
1126 |
$template->param( 'GetShelves' => GetBibliosShelves($biblionumber) ); |
886 |
} |
1127 |
} |
887 |
|
1128 |
|
888 |
|
|
|
889 |
# XISBN Stuff |
1129 |
# XISBN Stuff |
890 |
if (C4::Context->preference("OPACFRBRizeEditions")==1) { |
1130 |
if ( C4::Context->preference("OPACFRBRizeEditions") == 1 ) { |
891 |
eval { |
1131 |
eval { $template->param( XISBNS => get_xisbns($isbn) ); }; |
892 |
$template->param( |
|
|
893 |
XISBNS => get_xisbns($isbn) |
894 |
); |
895 |
}; |
896 |
if ($@) { warn "XISBN Failed $@"; } |
1132 |
if ($@) { warn "XISBN Failed $@"; } |
897 |
} |
1133 |
} |
898 |
|
1134 |
|
899 |
# Serial Collection |
1135 |
# Serial Collection |
900 |
my @sc_fields = $record->field(955); |
1136 |
my @sc_fields = $record->field(955); |
901 |
my @lc_fields = $marcflavour eq 'UNIMARC' |
1137 |
my @lc_fields = |
902 |
? $record->field(930) |
1138 |
$marcflavour eq 'UNIMARC' |
903 |
: $record->field(852); |
1139 |
? $record->field(930) |
|
|
1140 |
: $record->field(852); |
904 |
my @serialcollections = (); |
1141 |
my @serialcollections = (); |
905 |
|
1142 |
|
906 |
foreach my $sc_field (@sc_fields) { |
1143 |
foreach my $sc_field (@sc_fields) { |
907 |
my %row_data; |
1144 |
my %row_data; |
908 |
|
1145 |
|
909 |
$row_data{text} = $sc_field->subfield('r'); |
1146 |
$row_data{text} = $sc_field->subfield('r'); |
910 |
$row_data{branch} = $sc_field->subfield('9'); |
1147 |
$row_data{branch} = $sc_field->subfield('9'); |
911 |
foreach my $lc_field (@lc_fields) { |
1148 |
foreach my $lc_field (@lc_fields) { |
912 |
$row_data{itemcallnumber} = $marcflavour eq 'UNIMARC' |
1149 |
$row_data{itemcallnumber} = $marcflavour eq 'UNIMARC' |
913 |
? $lc_field->subfield('a') # 930$a |
1150 |
? $lc_field->subfield('a') # 930$a |
914 |
: $lc_field->subfield('h') # 852$h |
1151 |
: $lc_field->subfield('h') # 852$h |
915 |
if ($sc_field->subfield('5') eq $lc_field->subfield('5')); |
1152 |
if ( $sc_field->subfield('5') eq $lc_field->subfield('5') ); |
916 |
} |
1153 |
} |
917 |
|
1154 |
|
918 |
if ($row_data{text} && $row_data{branch}) { |
1155 |
if ( $row_data{text} && $row_data{branch} ) { |
919 |
push (@serialcollections, \%row_data); |
1156 |
push( @serialcollections, \%row_data ); |
920 |
} |
1157 |
} |
921 |
} |
1158 |
} |
922 |
|
1159 |
|
923 |
if (scalar(@serialcollections) > 0) { |
1160 |
if ( scalar(@serialcollections) > 0 ) { |
924 |
$template->param( |
1161 |
$template->param( |
925 |
serialcollection => 1, |
1162 |
serialcollection => 1, |
926 |
serialcollections => \@serialcollections); |
1163 |
serialcollections => \@serialcollections |
|
|
1164 |
); |
927 |
} |
1165 |
} |
928 |
|
1166 |
|
929 |
# Local cover Images stuff |
1167 |
# Local cover Images stuff |
930 |
if (C4::Context->preference("OPACLocalCoverImages")){ |
1168 |
if ( C4::Context->preference("OPACLocalCoverImages") ) { |
931 |
$template->param(OPACLocalCoverImages => 1); |
1169 |
$template->param( OPACLocalCoverImages => 1 ); |
932 |
} |
1170 |
} |
933 |
|
1171 |
|
934 |
# HTML5 Media |
1172 |
# HTML5 Media |
935 |
if ( (C4::Context->preference("HTML5MediaEnabled") eq 'both') or (C4::Context->preference("HTML5MediaEnabled") eq 'opac') ) { |
1173 |
if ( ( C4::Context->preference("HTML5MediaEnabled") eq 'both' ) |
936 |
$template->param( C4::HTML5Media->gethtml5media($record)); |
1174 |
or ( C4::Context->preference("HTML5MediaEnabled") eq 'opac' ) ) |
|
|
1175 |
{ |
1176 |
$template->param( C4::HTML5Media->gethtml5media($record) ); |
937 |
} |
1177 |
} |
938 |
|
1178 |
|
939 |
my $syndetics_elements; |
1179 |
my $syndetics_elements; |
940 |
|
1180 |
|
941 |
if ( C4::Context->preference("SyndeticsEnabled") ) { |
1181 |
if ( C4::Context->preference("SyndeticsEnabled") ) { |
942 |
$template->param("SyndeticsEnabled" => 1); |
1182 |
$template->param( "SyndeticsEnabled" => 1 ); |
943 |
$template->param("SyndeticsClientCode" => C4::Context->preference("SyndeticsClientCode")); |
1183 |
$template->param( |
944 |
eval { |
1184 |
"SyndeticsClientCode" => C4::Context->preference("SyndeticsClientCode") |
945 |
$syndetics_elements = &get_syndetics_index($isbn,$upc,$oclc); |
1185 |
); |
946 |
for my $element (values %$syndetics_elements) { |
1186 |
eval { |
947 |
$template->param("Syndetics$element"."Exists" => 1 ); |
1187 |
$syndetics_elements = &get_syndetics_index( $isbn, $upc, $oclc ); |
948 |
#warn "Exists: "."Syndetics$element"."Exists"; |
1188 |
for my $element ( values %$syndetics_elements ) { |
949 |
} |
1189 |
$template->param( "Syndetics$element" . "Exists" => 1 ); |
|
|
1190 |
|
1191 |
#warn "Exists: "."Syndetics$element"."Exists"; |
1192 |
} |
950 |
}; |
1193 |
}; |
951 |
warn $@ if $@; |
1194 |
warn $@ if $@; |
952 |
} |
1195 |
} |
953 |
|
1196 |
|
954 |
if ( C4::Context->preference("SyndeticsEnabled") |
1197 |
if ( |
955 |
&& C4::Context->preference("SyndeticsSummary") |
1198 |
C4::Context->preference("SyndeticsEnabled") |
956 |
&& ( exists($syndetics_elements->{'SUMMARY'}) || exists($syndetics_elements->{'AVSUMMARY'}) ) ) { |
1199 |
&& C4::Context->preference("SyndeticsSummary") |
957 |
eval { |
1200 |
&& ( exists( $syndetics_elements->{'SUMMARY'} ) |
958 |
my $syndetics_summary = &get_syndetics_summary($isbn,$upc,$oclc, $syndetics_elements); |
1201 |
|| exists( $syndetics_elements->{'AVSUMMARY'} ) ) |
959 |
$template->param( SYNDETICS_SUMMARY => $syndetics_summary ); |
1202 |
) |
960 |
}; |
1203 |
{ |
961 |
warn $@ if $@; |
1204 |
eval { |
|
|
1205 |
my $syndetics_summary = |
1206 |
&get_syndetics_summary( $isbn, $upc, $oclc, $syndetics_elements ); |
1207 |
$template->param( SYNDETICS_SUMMARY => $syndetics_summary ); |
1208 |
}; |
1209 |
warn $@ if $@; |
962 |
|
1210 |
|
963 |
} |
1211 |
} |
964 |
|
1212 |
|
965 |
if ( C4::Context->preference("SyndeticsEnabled") |
1213 |
if ( C4::Context->preference("SyndeticsEnabled") |
966 |
&& C4::Context->preference("SyndeticsTOC") |
1214 |
&& C4::Context->preference("SyndeticsTOC") |
967 |
&& exists($syndetics_elements->{'TOC'}) ) { |
1215 |
&& exists( $syndetics_elements->{'TOC'} ) ) |
968 |
eval { |
1216 |
{ |
969 |
my $syndetics_toc = &get_syndetics_toc($isbn,$upc,$oclc); |
1217 |
eval { |
970 |
$template->param( SYNDETICS_TOC => $syndetics_toc ); |
1218 |
my $syndetics_toc = &get_syndetics_toc( $isbn, $upc, $oclc ); |
971 |
}; |
1219 |
$template->param( SYNDETICS_TOC => $syndetics_toc ); |
972 |
warn $@ if $@; |
1220 |
}; |
|
|
1221 |
warn $@ if $@; |
973 |
} |
1222 |
} |
974 |
|
1223 |
|
975 |
if ( C4::Context->preference("SyndeticsEnabled") |
1224 |
if ( C4::Context->preference("SyndeticsEnabled") |
976 |
&& C4::Context->preference("SyndeticsExcerpt") |
1225 |
&& C4::Context->preference("SyndeticsExcerpt") |
977 |
&& exists($syndetics_elements->{'DBCHAPTER'}) ) { |
1226 |
&& exists( $syndetics_elements->{'DBCHAPTER'} ) ) |
|
|
1227 |
{ |
978 |
eval { |
1228 |
eval { |
979 |
my $syndetics_excerpt = &get_syndetics_excerpt($isbn,$upc,$oclc); |
1229 |
my $syndetics_excerpt = &get_syndetics_excerpt( $isbn, $upc, $oclc ); |
980 |
$template->param( SYNDETICS_EXCERPT => $syndetics_excerpt ); |
1230 |
$template->param( SYNDETICS_EXCERPT => $syndetics_excerpt ); |
981 |
}; |
1231 |
}; |
982 |
warn $@ if $@; |
1232 |
warn $@ if $@; |
983 |
} |
1233 |
} |
984 |
|
1234 |
|
985 |
if ( C4::Context->preference("SyndeticsEnabled") |
1235 |
if ( C4::Context->preference("SyndeticsEnabled") |
986 |
&& C4::Context->preference("SyndeticsReviews")) { |
1236 |
&& C4::Context->preference("SyndeticsReviews") ) |
|
|
1237 |
{ |
987 |
eval { |
1238 |
eval { |
988 |
my $syndetics_reviews = &get_syndetics_reviews($isbn,$upc,$oclc,$syndetics_elements); |
1239 |
my $syndetics_reviews = |
989 |
$template->param( SYNDETICS_REVIEWS => $syndetics_reviews ); |
1240 |
&get_syndetics_reviews( $isbn, $upc, $oclc, $syndetics_elements ); |
|
|
1241 |
$template->param( SYNDETICS_REVIEWS => $syndetics_reviews ); |
990 |
}; |
1242 |
}; |
991 |
warn $@ if $@; |
1243 |
warn $@ if $@; |
992 |
} |
1244 |
} |
993 |
|
1245 |
|
994 |
if ( C4::Context->preference("SyndeticsEnabled") |
1246 |
if ( C4::Context->preference("SyndeticsEnabled") |
995 |
&& C4::Context->preference("SyndeticsAuthorNotes") |
1247 |
&& C4::Context->preference("SyndeticsAuthorNotes") |
996 |
&& exists($syndetics_elements->{'ANOTES'}) ) { |
1248 |
&& exists( $syndetics_elements->{'ANOTES'} ) ) |
|
|
1249 |
{ |
997 |
eval { |
1250 |
eval { |
998 |
my $syndetics_anotes = &get_syndetics_anotes($isbn,$upc,$oclc); |
1251 |
my $syndetics_anotes = &get_syndetics_anotes( $isbn, $upc, $oclc ); |
999 |
$template->param( SYNDETICS_ANOTES => $syndetics_anotes ); |
1252 |
$template->param( SYNDETICS_ANOTES => $syndetics_anotes ); |
1000 |
}; |
1253 |
}; |
1001 |
warn $@ if $@; |
1254 |
warn $@ if $@; |
1002 |
} |
1255 |
} |
1003 |
|
1256 |
|
1004 |
# LibraryThingForLibraries ID Code and Tabbed View Option |
1257 |
# LibraryThingForLibraries ID Code and Tabbed View Option |
1005 |
if( C4::Context->preference('LibraryThingForLibrariesEnabled') ) |
1258 |
if ( C4::Context->preference('LibraryThingForLibrariesEnabled') ) { |
1006 |
{ |
1259 |
$template->param( LibraryThingForLibrariesID => |
1007 |
$template->param(LibraryThingForLibrariesID => |
1260 |
C4::Context->preference('LibraryThingForLibrariesID') ); |
1008 |
C4::Context->preference('LibraryThingForLibrariesID') ); |
1261 |
$template->param( LibraryThingForLibrariesTabbedView => |
1009 |
$template->param(LibraryThingForLibrariesTabbedView => |
1262 |
C4::Context->preference('LibraryThingForLibrariesTabbedView') ); |
1010 |
C4::Context->preference('LibraryThingForLibrariesTabbedView') ); |
1263 |
} |
1011 |
} |
|
|
1012 |
|
1264 |
|
1013 |
# Novelist Select |
1265 |
# Novelist Select |
1014 |
if( C4::Context->preference('NovelistSelectEnabled') ) |
1266 |
if ( C4::Context->preference('NovelistSelectEnabled') ) { |
1015 |
{ |
1267 |
$template->param( NovelistSelectProfile => |
1016 |
$template->param(NovelistSelectProfile => C4::Context->preference('NovelistSelectProfile') ); |
1268 |
C4::Context->preference('NovelistSelectProfile') ); |
1017 |
$template->param(NovelistSelectPassword => C4::Context->preference('NovelistSelectPassword') ); |
1269 |
$template->param( NovelistSelectPassword => |
1018 |
$template->param(NovelistSelectView => C4::Context->preference('NovelistSelectView') ); |
1270 |
C4::Context->preference('NovelistSelectPassword') ); |
1019 |
} |
1271 |
$template->param( |
1020 |
|
1272 |
NovelistSelectView => C4::Context->preference('NovelistSelectView') ); |
|
|
1273 |
} |
1021 |
|
1274 |
|
1022 |
# Babelthèque |
1275 |
# Babelthèque |
1023 |
if ( C4::Context->preference("Babeltheque") ) { |
1276 |
if ( C4::Context->preference("Babeltheque") ) { |
1024 |
$template->param( |
1277 |
$template->param( |
1025 |
Babeltheque => 1, |
1278 |
Babeltheque => 1, |
1026 |
Babeltheque_url_js => C4::Context->preference("Babeltheque_url_js"), |
1279 |
Babeltheque_url_js => C4::Context->preference("Babeltheque_url_js"), |
1027 |
); |
1280 |
); |
1028 |
} |
1281 |
} |
1029 |
|
1282 |
|
1030 |
# Social Networks |
1283 |
# Social Networks |
1031 |
if ( C4::Context->preference( "SocialNetworks" ) ) { |
1284 |
if ( C4::Context->preference("SocialNetworks") ) { |
1032 |
$template->param( current_url => C4::Context->preference('OPACBaseURL') . "/cgi-bin/koha/opac-detail.pl?biblionumber=$biblionumber" ); |
1285 |
$template->param( current_url => C4::Context->preference('OPACBaseURL') |
|
|
1286 |
. "/cgi-bin/koha/opac-detail.pl?biblionumber=$biblionumber" ); |
1033 |
$template->param( SocialNetworks => 1 ); |
1287 |
$template->param( SocialNetworks => 1 ); |
1034 |
} |
1288 |
} |
1035 |
|
1289 |
|
1036 |
# Shelf Browser Stuff |
1290 |
# Shelf Browser Stuff |
1037 |
if (C4::Context->preference("OPACShelfBrowser")) { |
1291 |
if ( C4::Context->preference("OPACShelfBrowser") ) { |
1038 |
my $starting_itemnumber = $query->param('shelfbrowse_itemnumber'); |
1292 |
my $starting_itemnumber = $query->param('shelfbrowse_itemnumber'); |
1039 |
if (defined($starting_itemnumber)) { |
1293 |
if ( defined($starting_itemnumber) ) { |
1040 |
$template->param( OpenOPACShelfBrowser => 1) if $starting_itemnumber; |
1294 |
$template->param( OpenOPACShelfBrowser => 1 ) if $starting_itemnumber; |
1041 |
my $nearby = GetNearbyItems($starting_itemnumber); |
1295 |
my $nearby = GetNearbyItems($starting_itemnumber); |
1042 |
|
1296 |
|
1043 |
$template->param( |
1297 |
$template->param( |
1044 |
starting_itemnumber => $starting_itemnumber, |
1298 |
starting_itemnumber => $starting_itemnumber, |
1045 |
starting_homebranch => $nearby->{starting_homebranch}->{description}, |
1299 |
starting_homebranch => |
|
|
1300 |
$nearby->{starting_homebranch}->{description}, |
1046 |
starting_location => $nearby->{starting_location}->{description}, |
1301 |
starting_location => $nearby->{starting_location}->{description}, |
1047 |
starting_ccode => $nearby->{starting_ccode}->{description}, |
1302 |
starting_ccode => $nearby->{starting_ccode}->{description}, |
1048 |
shelfbrowser_prev_item => $nearby->{prev_item}, |
1303 |
shelfbrowser_prev_item => $nearby->{prev_item}, |
1049 |
shelfbrowser_next_item => $nearby->{next_item}, |
1304 |
shelfbrowser_next_item => $nearby->{next_item}, |
1050 |
shelfbrowser_items => $nearby->{items}, |
1305 |
shelfbrowser_items => $nearby->{items}, |
1051 |
); |
1306 |
); |
1052 |
|
1307 |
|
1053 |
# in which tab shelf browser should open ? |
1308 |
# in which tab shelf browser should open ? |
1054 |
if (grep { $starting_itemnumber == $_->{itemnumber} } @itemloop) { |
1309 |
if ( grep { $starting_itemnumber == $_->{itemnumber} } @itemloop ) { |
1055 |
$template->param(shelfbrowser_tab => 'holdings'); |
1310 |
$template->param( shelfbrowser_tab => 'holdings' ); |
1056 |
} else { |
1311 |
} |
1057 |
$template->param(shelfbrowser_tab => 'otherholdings'); |
1312 |
else { |
|
|
1313 |
$template->param( shelfbrowser_tab => 'otherholdings' ); |
1058 |
} |
1314 |
} |
1059 |
} |
1315 |
} |
1060 |
} |
1316 |
} |
1061 |
|
1317 |
|
1062 |
$template->param( AmazonTld => get_amazon_tld() ) if ( C4::Context->preference("OPACAmazonCoverImages")); |
1318 |
$template->param( AmazonTld => get_amazon_tld() ) |
1063 |
|
1319 |
if ( C4::Context->preference("OPACAmazonCoverImages") ); |
1064 |
if (C4::Context->preference("BakerTaylorEnabled")) { |
1320 |
|
1065 |
$template->param( |
1321 |
if ( C4::Context->preference("BakerTaylorEnabled") ) { |
1066 |
BakerTaylorEnabled => 1, |
1322 |
$template->param( |
1067 |
BakerTaylorImageURL => &image_url(), |
1323 |
BakerTaylorEnabled => 1, |
1068 |
BakerTaylorLinkURL => &link_url(), |
1324 |
BakerTaylorImageURL => &image_url(), |
1069 |
BakerTaylorBookstoreURL => C4::Context->preference('BakerTaylorBookstoreURL'), |
1325 |
BakerTaylorLinkURL => &link_url(), |
1070 |
); |
1326 |
BakerTaylorBookstoreURL => |
1071 |
my ($bt_user, $bt_pass); |
1327 |
C4::Context->preference('BakerTaylorBookstoreURL'), |
1072 |
if ($isbn and |
1328 |
); |
1073 |
$bt_user = C4::Context->preference('BakerTaylorUsername') and |
1329 |
my ( $bt_user, $bt_pass ); |
1074 |
$bt_pass = C4::Context->preference('BakerTaylorPassword') ) |
1330 |
if ( $isbn |
1075 |
{ |
1331 |
and $bt_user = C4::Context->preference('BakerTaylorUsername') |
1076 |
$template->param( |
1332 |
and $bt_pass = C4::Context->preference('BakerTaylorPassword') ) |
1077 |
BakerTaylorContentURL => |
1333 |
{ |
1078 |
sprintf("http://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=%s&Password=%s&ItemKey=%s&Options=Y", |
1334 |
$template->param( |
1079 |
$bt_user,$bt_pass,$isbn) |
1335 |
BakerTaylorContentURL => sprintf( |
1080 |
); |
1336 |
"http://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=%s&Password=%s&ItemKey=%s&Options=Y", |
1081 |
} |
1337 |
$bt_user, $bt_pass, $isbn |
|
|
1338 |
) |
1339 |
); |
1340 |
} |
1082 |
} |
1341 |
} |
1083 |
|
1342 |
|
1084 |
my $tag_quantity; |
1343 |
my $tag_quantity; |
1085 |
if (C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->preference('TagsShowOnDetail')) { |
1344 |
if ( C4::Context->preference('TagsEnabled') |
1086 |
$template->param( |
1345 |
and $tag_quantity = C4::Context->preference('TagsShowOnDetail') ) |
1087 |
TagsEnabled => 1, |
1346 |
{ |
1088 |
TagsShowOnDetail => $tag_quantity, |
1347 |
$template->param( |
1089 |
TagsInputOnDetail => C4::Context->preference('TagsInputOnDetail') |
1348 |
TagsEnabled => 1, |
1090 |
); |
1349 |
TagsShowOnDetail => $tag_quantity, |
1091 |
$template->param(TagLoop => get_tags({biblionumber=>$biblionumber, approved=>1, |
1350 |
TagsInputOnDetail => C4::Context->preference('TagsInputOnDetail') |
1092 |
'sort'=>'-weight', limit=>$tag_quantity})); |
1351 |
); |
|
|
1352 |
$template->param( |
1353 |
TagLoop => get_tags( |
1354 |
{ |
1355 |
biblionumber => $biblionumber, |
1356 |
approved => 1, |
1357 |
'sort' => '-weight', |
1358 |
limit => $tag_quantity |
1359 |
} |
1360 |
) |
1361 |
); |
1093 |
} |
1362 |
} |
1094 |
|
1363 |
|
1095 |
if (C4::Context->preference("OPACURLOpenInNewWindow")) { |
1364 |
if ( C4::Context->preference("OPACURLOpenInNewWindow") ) { |
|
|
1365 |
|
1096 |
# These values are going to be read by Javascript, at least in the case |
1366 |
# These values are going to be read by Javascript, at least in the case |
1097 |
# of the google covers |
1367 |
# of the google covers |
1098 |
$template->param(covernewwindow => 'true'); |
1368 |
$template->param( covernewwindow => 'true' ); |
1099 |
} else { |
1369 |
} |
1100 |
$template->param(covernewwindow => 'false'); |
1370 |
else { |
|
|
1371 |
$template->param( covernewwindow => 'false' ); |
1101 |
} |
1372 |
} |
1102 |
|
1373 |
|
1103 |
#Export options |
1374 |
#Export options |
1104 |
my $OpacExportOptions=C4::Context->preference("OpacExportOptions"); |
1375 |
my $OpacExportOptions = C4::Context->preference("OpacExportOptions"); |
1105 |
my @export_options = split(/\|/,$OpacExportOptions); |
1376 |
my @export_options = split( /\|/, $OpacExportOptions ); |
1106 |
$template->{VARS}->{'export_options'} = \@export_options; |
1377 |
$template->{VARS}->{'export_options'} = \@export_options; |
1107 |
|
1378 |
|
1108 |
if ( C4::Context->preference('OpacStarRatings') !~ /disable/ ) { |
1379 |
if ( C4::Context->preference('OpacStarRatings') !~ /disable/ ) { |
Lines 1117-1129
if ( C4::Context->preference('OpacStarRatings') !~ /disable/ ) {
Link Here
|
1117 |
} |
1388 |
} |
1118 |
|
1389 |
|
1119 |
#Search for title in links |
1390 |
#Search for title in links |
1120 |
my $marccontrolnumber = GetMarcControlnumber ($record, $marcflavour); |
1391 |
my $marccontrolnumber = GetMarcControlnumber( $record, $marcflavour ); |
1121 |
my $marcissns = GetMarcISSN ( $record, $marcflavour ); |
1392 |
my $marcissns = GetMarcISSN( $record, $marcflavour ); |
1122 |
my $issn = $marcissns->[0] || ''; |
1393 |
my $issn = $marcissns->[0] || ''; |
1123 |
|
1394 |
|
1124 |
if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){ |
1395 |
if ( my $search_for_title = C4::Context->preference('OPACSearchForTitleIn') ) { |
1125 |
$dat->{title} =~ s/\/+$//; # remove trailing slash |
1396 |
$dat->{title} =~ s/\/+$//; # remove trailing slash |
1126 |
$dat->{title} =~ s/\s+$//; # remove trailing space |
1397 |
$dat->{title} =~ s/\s+$//; # remove trailing space |
1127 |
$search_for_title = parametrized_url( |
1398 |
$search_for_title = parametrized_url( |
1128 |
$search_for_title, |
1399 |
$search_for_title, |
1129 |
{ |
1400 |
{ |
Lines 1135-1177
if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
Link Here
|
1135 |
BIBLIONUMBER => $biblionumber, |
1406 |
BIBLIONUMBER => $biblionumber, |
1136 |
} |
1407 |
} |
1137 |
); |
1408 |
); |
1138 |
$template->param('OPACSearchForTitleIn' => $search_for_title); |
1409 |
$template->param( 'OPACSearchForTitleIn' => $search_for_title ); |
1139 |
} |
1410 |
} |
1140 |
|
1411 |
|
1141 |
# We try to select the best default tab to show, according to what |
1412 |
# We try to select the best default tab to show, according to what |
1142 |
# the user wants, and what's available for display |
1413 |
# the user wants, and what's available for display |
1143 |
my $opac_serial_default = C4::Context->preference('opacSerialDefaultTab'); |
1414 |
my $opac_serial_default = C4::Context->preference('opacSerialDefaultTab'); |
1144 |
my $defaulttab = |
1415 |
my $defaulttab = |
1145 |
$opac_serial_default eq 'subscriptions' && $subscriptionsnumber |
1416 |
$opac_serial_default eq 'subscriptions' |
1146 |
? 'subscriptions' : |
1417 |
&& $subscriptionsnumber ? 'subscriptions' |
1147 |
$opac_serial_default eq 'serialcollection' && @serialcollections > 0 |
1418 |
: $opac_serial_default eq 'serialcollection' |
1148 |
? 'serialcollection' : |
1419 |
&& @serialcollections > 0 ? 'serialcollection' |
1149 |
$opac_serial_default eq 'holdings' && scalar (@itemloop) > 0 |
1420 |
: $opac_serial_default eq 'holdings' && scalar(@itemloop) > 0 ? 'holdings' |
1150 |
? 'holdings' : |
1421 |
: $subscriptionsnumber ? 'subscriptions' |
1151 |
$subscriptionsnumber |
1422 |
: @serialcollections > 0 ? 'serialcollection' |
1152 |
? 'subscriptions' : |
1423 |
: 'subscriptions'; |
1153 |
@serialcollections > 0 |
1424 |
$template->param( 'defaulttab' => $defaulttab ); |
1154 |
? 'serialcollection' : 'subscriptions'; |
1425 |
|
1155 |
$template->param('defaulttab' => $defaulttab); |
1426 |
if ( C4::Context->preference('OPACLocalCoverImages') == 1 ) { |
1156 |
|
|
|
1157 |
if (C4::Context->preference('OPACLocalCoverImages') == 1) { |
1158 |
my @images = ListImagesForBiblio($biblionumber); |
1427 |
my @images = ListImagesForBiblio($biblionumber); |
1159 |
$template->{VARS}->{localimages} = \@images; |
1428 |
$template->{VARS}->{localimages} = \@images; |
1160 |
} |
1429 |
} |
1161 |
|
1430 |
|
1162 |
$template->{VARS}->{IDreamBooksReviews} = C4::Context->preference('IDreamBooksReviews'); |
1431 |
$template->{VARS}->{IDreamBooksReviews} = |
1163 |
$template->{VARS}->{IDreamBooksReadometer} = C4::Context->preference('IDreamBooksReadometer'); |
1432 |
C4::Context->preference('IDreamBooksReviews'); |
1164 |
$template->{VARS}->{IDreamBooksResults} = C4::Context->preference('IDreamBooksResults'); |
1433 |
$template->{VARS}->{IDreamBooksReadometer} = |
1165 |
$template->{VARS}->{OPACPopupAuthorsSearch} = C4::Context->preference('OPACPopupAuthorsSearch'); |
1434 |
C4::Context->preference('IDreamBooksReadometer'); |
|
|
1435 |
$template->{VARS}->{IDreamBooksResults} = |
1436 |
C4::Context->preference('IDreamBooksResults'); |
1437 |
$template->{VARS}->{OPACPopupAuthorsSearch} = |
1438 |
C4::Context->preference('OPACPopupAuthorsSearch'); |
1166 |
|
1439 |
|
1167 |
if (C4::Context->preference('OpacHighlightedWords')) { |
1440 |
if ( C4::Context->preference('OpacHighlightedWords') ) { |
1168 |
$template->{VARS}->{query_desc} = $query->param('query_desc'); |
1441 |
$template->{VARS}->{query_desc} = $query->param('query_desc'); |
1169 |
} |
1442 |
} |
1170 |
$template->{VARS}->{'trackclicks'} = C4::Context->preference('TrackClicks'); |
1443 |
$template->{VARS}->{'trackclicks'} = C4::Context->preference('TrackClicks'); |
1171 |
|
1444 |
|
1172 |
if ( C4::Context->preference('UseCourseReserves') ) { |
1445 |
if ( C4::Context->preference('UseCourseReserves') ) { |
1173 |
foreach my $i ( @items ) { |
1446 |
foreach my $i (@items) { |
1174 |
$i->{'course_reserves'} = GetItemCourseReservesInfo( itemnumber => $i->{'itemnumber'} ); |
1447 |
$i->{'course_reserves'} = |
|
|
1448 |
GetItemCourseReservesInfo( itemnumber => $i->{'itemnumber'} ); |
1175 |
} |
1449 |
} |
1176 |
} |
1450 |
} |
1177 |
## Defining general Serial issue filter related system preferences |
1451 |
## Defining general Serial issue filter related system preferences |
Lines 1179-1184
if ( C4::Context->preference('UseCourseReserves') ) {
Link Here
|
1179 |
if ( length C4::Context->preference('NumberingFormulaParsingRegexp') < 3 ) { |
1453 |
if ( length C4::Context->preference('NumberingFormulaParsingRegexp') < 3 ) { |
1180 |
$template->{VARS}->{notDefined_NumberingFormulaParsingRegexp} = 1; |
1454 |
$template->{VARS}->{notDefined_NumberingFormulaParsingRegexp} = 1; |
1181 |
} |
1455 |
} |
1182 |
$template->{VARS}->{useFilterIssueInput} = 1 if (C4::Context->preference('FilterSerialsByIssue')); |
1456 |
$template->{VARS}->{useFilterIssueInput} = 1 |
|
|
1457 |
if ( C4::Context->preference('FilterSerialsByIssue') ); |
1183 |
|
1458 |
|
1184 |
output_html_with_http_headers $query, $cookie, $template->output; |
1459 |
output_html_with_http_headers $query, $cookie, $template->output; |