Lines 77-83
$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') : undef; |
80 |
my $filterBranchLimiter = $query->param('filterBranchLimiter') ? $query->param('filterBranchLimiter') : '_ShowAll'; |
81 |
my $filterVolume = $query->param('filterVolume') ? $query->param('filterVolume') : undef; |
81 |
my $filterVolume = $query->param('filterVolume') ? $query->param('filterVolume') : undef; |
82 |
my $filterNumber = $query->param('filterNumber') ? $query->param('filterNumber') : undef; |
82 |
my $filterNumber = $query->param('filterNumber') ? $query->param('filterNumber') : undef; |
83 |
my $filterIssue = $query->param('filterIssue') ? $query->param('filterIssue') : undef; |
83 |
my $filterIssue = $query->param('filterIssue') ? $query->param('filterIssue') : undef; |
Lines 162-196
my @all_items;
Link Here
|
162 |
if ($lotsofitems) { |
162 |
if ($lotsofitems) { |
163 |
#Spare the poor old DB from this possibly excruciatinly huge read operation. |
163 |
#Spare the poor old DB from this possibly excruciatinly huge read operation. |
164 |
if (! scalar(%$filter)) { #Is the $filter empty? |
164 |
if (! scalar(%$filter)) { #Is the $filter empty? |
165 |
|
|
|
166 |
#Limit the amount of results to the system preference |
167 |
$filter->{limit} = C4::Context->preference('OPACmaxItemsOnDetail'); |
168 |
|
169 |
#Limit display of Items based on the users branch |
165 |
#Limit display of Items based on the users branch |
170 |
if (C4::Context->userenv){ |
166 |
if (C4::Context->userenv){ |
171 |
$filter->{branch} = C4::Context->userenv->{branch}; |
167 |
$filter->{branch} = C4::Context->userenv->{branch}; |
172 |
$filterBranchLimiter = $filter->{branch}; #Making the branches loop react to this! |
168 |
$filterBranchLimiter = $filter->{branch}; #Making the branches loop react to this! |
173 |
|
|
|
174 |
@all_items = GetItemsInfo($biblionumber, $filter); |
175 |
} |
169 |
} |
176 |
#Or if branch cannot be defined or has no items, then display Items only from the past year |
170 |
#Or if branch cannot be defined, then display Items only from the past year |
177 |
if( ! (scalar(@all_items)) ) { |
171 |
else { |
178 |
delete $filter->{branch}; #Remove the branch filter as it gave no results |
|
|
179 |
undef $filterBranchLimiter; |
180 |
|
181 |
my $now = DateTime->now(); |
172 |
my $now = DateTime->now(); |
182 |
$now->set_year( ($now->year() - 1) ); |
173 |
$now->set_year( ($now->year() - 1) ); |
183 |
$filter->{fromDate} = Koha::DateUtils::output_pref({ dt => $now, dateformat => 'iso'}); |
174 |
$filter->{fromDate} = Koha::DateUtils::output_pref({ dt => $now, dateformat => 'iso'}); |
184 |
$template->param('noBranchItems' => 1); |
175 |
$template->param('userBranchNotDefined' => 1); |
185 |
@all_items = GetItemsInfo($biblionumber, $filter); |
|
|
186 |
} |
176 |
} |
187 |
|
177 |
$filter->{limit} = C4::Context->preference('OPACmaxItemsOnDetail'); |
188 |
} |
178 |
} |
189 |
} |
179 |
} |
190 |
#If we haven't found our items yet, then pull them using whatever we've got. |
180 |
@all_items = GetItemsInfo($biblionumber, $filter); |
191 |
if( ! (scalar(@all_items)) ) { |
|
|
192 |
@all_items = GetItemsInfo($biblionumber, $filter); |
193 |
} |
194 |
|
181 |
|
195 |
|
182 |
|
196 |
##Prepare the custom branches loop containing the _ShowAll entry to show issues from all libraries. |
183 |
##Prepare the custom branches loop containing the _ShowAll entry to show issues from all libraries. |
Lines 306-312
if ($session->param('busc')) {
Link Here
|
306 |
|
293 |
|
307 |
my $expanded_facet = $arrParamsBusc->{'expand'}; |
294 |
my $expanded_facet = $arrParamsBusc->{'expand'}; |
308 |
my $branches = GetBranches(); |
295 |
my $branches = GetBranches(); |
309 |
my $itemtypes = GetItemTypes; |
|
|
310 |
my @servers; |
296 |
my @servers; |
311 |
@servers = @{$arrParamsBusc->{'server'}} if $arrParamsBusc->{'server'}; |
297 |
@servers = @{$arrParamsBusc->{'server'}} if $arrParamsBusc->{'server'}; |
312 |
@servers = ("biblioserver") unless (@servers); |
298 |
@servers = ("biblioserver") unless (@servers); |
Lines 317-323
if ($session->param('busc')) {
Link Here
|
317 |
$sort_by[0] = $default_sort_by if !$sort_by[0] && defined($default_sort_by); |
303 |
$sort_by[0] = $default_sort_by if !$sort_by[0] && defined($default_sort_by); |
318 |
my ($error, $results_hashref, $facets); |
304 |
my ($error, $results_hashref, $facets); |
319 |
eval { |
305 |
eval { |
320 |
($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'}); |
306 |
($error, $results_hashref, $facets) = getRecords($arrParamsBusc->{'query'},$arrParamsBusc->{'simple_query'},\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$arrParamsBusc->{'query_type'},$arrParamsBusc->{'scan'}); |
321 |
}; |
307 |
}; |
322 |
my $hits; |
308 |
my $hits; |
323 |
my @newresults; |
309 |
my @newresults; |
Lines 705-711
if ( $show_holds_count || $show_priority) {
Link Here
|
705 |
} |
691 |
} |
706 |
$template->param( show_priority => $has_hold ) ; |
692 |
$template->param( show_priority => $has_hold ) ; |
707 |
|
693 |
|
708 |
my $norequests = 1; |
694 |
my $norequests = 1; #"No requests"-flag hides the "Place hold"-link in opac-detail-sidebar.inc |
709 |
my %itemfields; |
695 |
my %itemfields; |
710 |
my (@itemloop, @otheritemloop); |
696 |
my (@itemloop, @otheritemloop); |
711 |
my $currentbranch = C4::Context->userenv ? C4::Context->userenv->{branch} : undef; |
697 |
my $currentbranch = C4::Context->userenv ? C4::Context->userenv->{branch} : undef; |
Lines 770-775
for my $itm (@items) {
Link Here
|
770 |
} |
756 |
} |
771 |
} |
757 |
} |
772 |
|
758 |
|
|
|
759 |
#There is no point in enabling "Place hold" for Serials. |
760 |
# Placing a title-level hold for a Serial is crazy since we don't want "any" item but instead the specific volume and number. |
761 |
# Also choosing an item-level hold from opac-reserve.pl is problematic since there could be thousands of items. |
762 |
$norequests = 1 if $template->{VARS}->{'isSerial'}; |
763 |
|
773 |
# Display only one tab if one items list is empty |
764 |
# Display only one tab if one items list is empty |
774 |
if (scalar(@itemloop) == 0 || scalar(@otheritemloop) == 0) { |
765 |
if (scalar(@itemloop) == 0 || scalar(@otheritemloop) == 0) { |
775 |
$template->param(SeparateHoldings => 0); |
766 |
$template->param(SeparateHoldings => 0); |
Lines 1217-1220
if ( length C4::Context->preference('NumberingFormulaParsingRegexp') < 3 ) {
Link Here
|
1217 |
} |
1208 |
} |
1218 |
$template->{VARS}->{useFilterIssueInput} = 1 if (C4::Context->preference('FilterSerialsByIssue')); |
1209 |
$template->{VARS}->{useFilterIssueInput} = 1 if (C4::Context->preference('FilterSerialsByIssue')); |
1219 |
|
1210 |
|
|
|
1211 |
$template->param('OPACShowPlaceItemLevelHold', C4::Context->preference('OPACShowPlaceItemLevelHold')); |
1212 |
|
1220 |
output_html_with_http_headers $query, $cookie, $template->output; |
1213 |
output_html_with_http_headers $query, $cookie, $template->output; |