use CGI qw ( -utf8 );
-use C4::Auth;
-use C4::Koha;
-use C4::Circulation;
+use C4::Auth qw( get_template_and_user );
+use C4::Koha qw(
+ getitemtypeimagelocation
+ GetNormalizedISBN
+ GetNormalizedUPC
+);
+use C4::Circulation qw( CanBookBeRenewed GetRenewCount GetIssuingCharges GetSoonestRenewDate );
use C4::External::BakerTaylor qw( image_url link_url );
-use C4::Reserves;
+use C4::Reserves qw( GetReserveStatus );
use C4::Members;
-use C4::Output;
-use C4::Biblio;
-use C4::Items;
-use C4::Letters;
+use C4::Output qw( output_html_with_http_headers );
+use C4::Biblio qw( GetMarcBiblio );
use Koha::Account::Lines;
use Koha::Biblios;
use Koha::Libraries;
-use Koha::DateUtils;
+use Koha::DateUtils qw( output_pref );
use Koha::Holds;
use Koha::Database;
use Koha::ItemTypes;
use Koha::Patron::Discharge;
use Koha::Patrons;
use Koha::Ratings;
+use Koha::Recalls;
use Koha::Token;
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
-use Scalar::Util qw(looks_like_number);
-use Date::Calc qw(
- Today
- Add_Delta_Days
- Date_to_Days
-);
+use Scalar::Util qw( looks_like_number );
+use Date::Calc qw( Date_to_Days Today );
-my $query = new CGI;
+my $query = CGI->new;
# CAS single logout handling
# Will print header and exit
-C4::Context->preference('casAuthentication') and C4::Auth_with_cas::logout_if_required($query);
+if ( C4::Context->preference('casAuthentication') ) {
+ require C4::Auth_with_cas;
+ C4::Auth_with_cas::logout_if_required($query);
+}
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
{
template_name => "opac-user.tt",
query => $query,
type => "opac",
- debug => 1,
}
);
# check if item is renewable
my ($status,$renewerror) = CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'} );
- ($issue->{'renewcount'},$issue->{'renewsallowed'},$issue->{'renewsleft'}) = GetRenewCount($borrowernumber, $issue->{'itemnumber'});
+ (
+ $issue->{'renewcount'},
+ $issue->{'renewsallowed'},
+ $issue->{'renewsleft'},
+ $issue->{'unseencount'},
+ $issue->{'unseenallowed'},
+ $issue->{'unseenleft'}
+ ) = GetRenewCount($borrowernumber, $issue->{'itemnumber'});
( $issue->{'renewalfee'}, $issue->{'renewalitemtype'} ) = GetIssuingCharges( $issue->{'itemnumber'}, $borrowernumber );
$issue->{itemtype_object} = Koha::ItemTypes->find( Koha::Items->find( $issue->{itemnumber} )->effective_itemtype );
if($status && C4::Context->preference("OpacRenewalAllowed")){
if ($renewerror) {
$issue->{'too_many'} = 1 if $renewerror eq 'too_many';
+ $issue->{'too_unseen'} = 1 if $renewerror eq 'too_unseen';
$issue->{'on_reserve'} = 1 if $renewerror eq 'on_reserve';
$issue->{'norenew_overdue'} = 1 if $renewerror eq 'overdue';
$issue->{'auto_renew'} = 1 if $renewerror eq 'auto_renew';
$issue->{biblionumber} ? $my_summary_html =~ s/{BIBLIONUMBER}/$issue->{biblionumber}/g : $my_summary_html =~ s/{BIBLIONUMBER}//g;
$issue->{MySummaryHTML} = $my_summary_html;
}
+
+ if ( C4::Context->preference('UseRecalls') ) {
+ my $maybe_recalls = Koha::Recalls->search({ biblionumber => $issue->{biblionumber}, itemnumber => [ undef, $issue->{itemnumber} ], old => 0 });
+ while( my $recall = $maybe_recalls->next ) {
+ if ( $recall->checkout and $recall->checkout->issue_id == $issue->{issue_id} ) {
+ $issue->{recall} = 1;
+ last;
+ }
+ }
+ }
}
}
my $overduesblockrenewing = C4::Context->preference('OverduesBlockRenewing');
showpriority => $show_priority,
);
+if ( C4::Context->preference('UseRecalls') ) {
+ my $recalls = Koha::Recalls->search( { borrowernumber => $borrowernumber, old => 0 } );
+ $template->param( RECALLS => $recalls );
+}
+
if (C4::Context->preference('BakerTaylorEnabled')) {
$template->param(
BakerTaylorEnabled => 1,
{
my @relatives;
# Filter out guarantees that don't want guarantor to see checkouts
- foreach my $gr ( $patron->guarantee_relationships() ) {
+ foreach my $gr ( $patron->guarantee_relationships->as_list ) {
my $g = $gr->guarantee;
push( @relatives, $g ) if $g->privacy_guarantor_checkouts;
}
{
my @relatives_with_fines;
# Filter out guarantees that don't want guarantor to see checkouts
- foreach my $gr ( $patron->guarantee_relationships() ) {
+ foreach my $gr ( $patron->guarantee_relationships->as_list ) {
my $g = $gr->guarantee;
push( @relatives_with_fines, $g ) if $g->privacy_guarantor_fines;
}
$template->param( relatives_with_fines => \@relatives_with_fines );
}
+if ( C4::Context->preference("ArticleRequests") ) {
+ $template->param(
+ current_article_requests => [$patron->article_requests->filter_by_current->as_list],
+ );
+}
$template->param(
patron_messages => $patron_messages,