#
# This code has been modified by Trendsetters (originally from opac-user.pl)
# This code has been modified by rch
+# Parts Copyright 2010-2011, ByWater Solutions (those related to username/password auth)
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
# We're going to authenticate a self-check user. we'll add a flag to borrowers 'selfcheck'
#
# We're in a controlled environment; we trust the user.
use C4::Auth qw(get_template_and_user checkpw);
use C4::Koha;
-use C4::Dates qw/format_date/;
use C4::Circulation;
use C4::Reserves;
use C4::Output;
use C4::Members;
-use C4::Dates;
use C4::Biblio;
use C4::Items;
if (C4::Context->preference('AutoSelfCheckAllowed'))
{
- my $AutoSelfCheckID = C4::Context->preference('AutoSelfCheckID');
- my $AutoSelfCheckPass = C4::Context->preference('AutoSelfCheckPass');
- $query->param(-name=>'userid',-values=>[$AutoSelfCheckID]);
- $query->param(-name=>'password',-values=>[$AutoSelfCheckPass]);
+ my $AutoSelfCheckID = C4::Context->preference('AutoSelfCheckID');
+ my $AutoSelfCheckPass = C4::Context->preference('AutoSelfCheckPass');
+ $query->param(-name=>'userid',-values=>[$AutoSelfCheckID]);
+ $query->param(-name=>'password',-values=>[$AutoSelfCheckPass]);
$query->param(-name=>'koha_login_context',-values=>['sco']);
}
my ($template, $loggedinuser, $cookie) = get_template_and_user({
template_name => "sco/sco-main.tmpl",
authnotrequired => 0,
- flagsrequired => { circulate => "circulate_remaining_permissions" },
+ flagsrequired => { circulate => "circulate_remaining_permissions" },
query => $query,
type => "opac",
debug => 1,
my $issuerid = $loggedinuser;
-my ($op, $patronid, $patronlogin, $patronpw, $barcode, $confirmed, $timedout) = (
+my ($op, $patronid, $patronlogin, $patronpw, $barcode, $confirmed) = (
$query->param("op") || '',
$query->param("patronid") || '',
$query->param("patronlogin")|| '',
$query->param("patronpw") || '',
$query->param("barcode") || '',
$query->param("confirmed") || '',
- $query->param("timedout") || '', #not actually using this...
);
my $issuenoconfirm = 1; #don't need to confirm on issue.
my $item = GetItem(undef,$barcode);
if (C4::Context->preference('SelfCheckoutByLogin') && !$patronid) {
my $dbh = C4::Context->dbh;
- my $resval, $patronid = checkpw($dbh, $patronlogin, $patronpw);
+ my $resval;
+ ($resval, $patronid) = checkpw($dbh, $patronlogin, $patronpw);
}
my $borrower = GetMemberDetails(undef,$patronid);
+my $currencySymbol = "";
+if ( defined C4::Budgets->GetCurrency() ) {
+ $currencySymbol = C4::Budgets->GetCurrency()->{symbol};
+}
my $branch = $issuer->{branchcode};
my $confirm_required = 0;
my $impossible = {};
my $needconfirm = {};
if ( !$confirmed ) {
- ( $impossible, $needconfirm ) = CanBookBeIssued( $borrower, $barcode );
+ ( $impossible, $needconfirm ) = CanBookBeIssued(
+ $borrower,
+ $barcode,
+ undef,
+ 0,
+ C4::Context->preference("AllowItemsOnHoldCheckout")
+ );
}
$confirm_required = scalar keys %$needconfirm;
hide_main => 1,
);
if ($issue_error eq 'DEBT') {
- $template->param(amount => $impossible->{DEBT});
+ $template->param(amount => $currencySymbol.$impossible->{DEBT});
}
#warn "issue_error: " . $issue_error ;
if ( $issue_error eq "NO_MORE_RENEWALS" ) {
"circ_error_$issue_error" => 1,
hide_main => 1,
);
+ if ($issue_error eq 'DEBT') {
+ $template->param(amount => $currencySymbol.$needconfirm->{DEBT});
+ }
} else {
if ( $confirmed || $issuenoconfirm ) { # we'll want to call getpatroninfo again to get updated issues.
# warn "issuing book?";
my @issues;
my ($issueslist) = GetPendingIssues( $borrower->{'borrowernumber'} );
foreach my $it (@$issueslist) {
- $it->{date_due_display} = format_date($it->{date_due});
- my ($renewokay, $renewerror) = CanBookBeIssued($borrower, $it->{'barcode'},'','');
+ my ($renewokay, $renewerror) = CanBookBeIssued(
+ $borrower,
+ $it->{'barcode'},
+ undef,
+ 0,
+ C4::Context->preference("AllowItemsOnHoldCheckout")
+ );
$it->{'norenew'} = 1 if $renewokay->{'NO_MORE_RENEWALS'};
push @issues, $it;
}
patronlogin => $patronlogin,
patronpw => $patronpw,
noitemlinks => 1 ,
+ borrowernumber => $borrower->{'borrowernumber'},
);
my $inputfocus = ($return_only == 1) ? 'returnbook' :
($confirm_required == 1) ? 'confirm' : 'barcode' ;
$template->param(
inputfocus => $inputfocus,
- nofines => 1,
- "dateformat_" . C4::Context->preference('dateformat') => 1,
+ nofines => 1,
+
);
if (C4::Context->preference('ShowPatronImageInWebBasedSelfCheck')) {
- my ($image, $dberror) = GetPatronImage($borrower->{cardnumber});
+ my ($image, $dberror) = GetPatronImage($borrower->{borrowernumber});
if ($image) {
$template->param(
display_patron_image => 1,
);
}
-output_html_with_http_headers $query, $cookie, $template->output;
+$template->param(
+ SCOUserJS => C4::Context->preference('SCOUserJS'),
+ SCOUserCSS => C4::Context->preference('SCOUserCSS'),
+);
+
+output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };