use strict;
use warnings;
-use CGI;
+use CGI qw ( -utf8 );
use C4::Acquisition qw( SearchOrders );
use C4::Auth qw(:DEFAULT get_session);
use C4::Branch;
my $query = new CGI;
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
{
- template_name => "opac-detail.tmpl",
+ template_name => "opac-detail.tt",
query => $query,
type => "opac",
authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
my %paging = (previous => {}, next => {});
if ($session->param('busc')) {
use C4::Search;
+ use URI::Escape;
# Rebuild the string to store on session
+ # param value is URI encoded and params separator is HTML encode (&)
sub rebuildBuscParam
{
my $arrParamsBusc = shift;
if ($_ =~ /^(?:query|listBiblios|newlistBiblios|query_type|simple_query|total|offset|offsetSearch|next|previous|count|expand|scan)/) {
if (defined($arrParamsBusc->{$_})) {
$pasarParams .= '&' if ($j);
- $pasarParams .= $_ . '=' . $arrParamsBusc->{$_};
+ $pasarParams .= $_ . '=' . Encode::decode('UTF-8', uri_escape_utf8( $arrParamsBusc->{$_} ));
$j++;
}
} else {
for my $value (@{$arrParamsBusc->{$_}}) {
$pasarParams .= '&' if ($j);
- $pasarParams .= $_ . '=' . $value;
+ $pasarParams .= $_ . '=' . Encode::decode('UTF-8', uri_escape_utf8($value));
$j++;
}
}
for (@arrBusc) {
($key, $value) = split(/=/, $_, 2);
if ($key =~ /^(?:query|listBiblios|newlistBiblios|query_type|simple_query|next|previous|total|offset|offsetSearch|count|expand|scan)/) {
- $arrParamsBusc{$key} = $value;
+ $arrParamsBusc{$key} = uri_unescape($value);
} else {
unless (exists($arrParamsBusc{$key})) {
$arrParamsBusc{$key} = [];
}
- push @{$arrParamsBusc{$key}}, $value;
+ push @{$arrParamsBusc{$key}}, uri_unescape($value);
}
}
my $searchAgain = 0;
for (@arrBusc) {
unless ($_ =~ /^(?:query|listBiblios|newlistBiblios|query_type|simple_query|next|previous|total|count|offsetSearch)/) {
$buscParam .= '&' unless ($j == 0);
- $buscParam .= $_;
+ $buscParam .= $_; # string already URI encoded
$j++;
}
}
}
-
-$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
-
-
-
$template->param('OPACShowCheckoutName' => C4::Context->preference("OPACShowCheckoutName") );
$template->param('OPACShowBarcode' => C4::Context->preference("OPACShowBarcode") );
items_count => scalar( @items ),
);
} else {
+ my $allow_onshelf_holds;
+ my $borrower = GetMember( 'borrowernumber' => $borrowernumber );
for my $itm (@items) {
$itm->{holds_count} = $item_reserves{ $itm->{itemnumber} };
$itm->{priority} = $priority{ $itm->{itemnumber} };
$norequests = 0
- if ( (not $itm->{'withdrawn'} )
- && (not $itm->{'itemlost'} )
- && ($itm->{'itemnotforloan'}<0 || not $itm->{'itemnotforloan'} )
- && (not $itemtypes->{$itm->{'itype'}}->{notforloan} )
- && ($itm->{'itemnumber'} ) );
+ if $norequests
+ && !$itm->{'withdrawn'}
+ && !$itm->{'itemlost'}
+ && ($itm->{'itemnotforloan'}<0 || not $itm->{'itemnotforloan'})
+ && !$itemtypes->{$itm->{'itype'}}->{notforloan}
+ && $itm->{'itemnumber'};
+
+ $allow_onshelf_holds = C4::Reserves::OnShelfHoldsAllowed($itm, $borrower)
+ unless $allow_onshelf_holds;
# get collection code description, too
my $ccode = $itm->{'ccode'};
push @itemloop, $itm;
}
}
+ $template->param( 'AllowOnShelfHolds' => $allow_onshelf_holds );
}
# Display only one tab if one items list is empty
$template->param(covernewwindow => 'false');
}
-#Export options
-my $OpacExportOptions=C4::Context->preference("OpacExportOptions");
-my @export_options = split(/\|/,$OpacExportOptions);
-$template->{VARS}->{'export_options'} = \@export_options;
-
if ( C4::Context->preference('OpacStarRatings') !~ /disable/ ) {
my $rating = GetRating( $biblionumber, $borrowernumber );
$template->param(