my $query = new CGI;
-if (!C4::Context->userenv){
- my $sessionID = $query->cookie("CGISESSID");
- my $session = get_session($sessionID);
- if ($session->param('branch') eq 'NO_LIBRARY_SET'){
- # no branch set we can't return
- print $query->redirect("/cgi-bin/koha/circ/selectbranchprinter.pl");
- exit;
- }
-}
-
#getting the template
my ( $template, $librarian, $cookie ) = get_template_and_user(
{
}
);
+my $sessionID = $query->cookie("CGISESSID");
+my $session = get_session($sessionID);
+if ($session->param('branch') eq 'NO_LIBRARY_SET'){
+ # no branch set we can't return
+ print $query->redirect("/cgi-bin/koha/circ/selectbranchprinter.pl");
+ exit;
+}
+
#####################
#Global vars
my $branches = GetBranches();
my $printers = GetPrinters();
+my $userenv = C4::Context->userenv;
+my $userenv_branch = $userenv->{'branch'} // '';
+my $printer = $userenv->{'branchprinter'} // '';
-my $printer = C4::Context->userenv ? C4::Context->userenv->{'branchprinter'} : "";
my $overduecharges = (C4::Context->preference('finesMode') && C4::Context->preference('finesMode') ne 'off');
-
-my $userenv_branch = C4::Context->userenv->{'branch'} || '';
#
# Some code to handle the error if there is no branch or printer setting.....
#
#dropbox: get last open day (today - 1)
my $today = DateTime->now( time_zone => C4::Context->tz());
my $dropboxdate = $calendar->addDate($today, -1);
+
+my $return_date_override = $query->param('return_date_override');
+my $return_date_override_remember =
+ $query->param('return_date_override_remember');
+if ($return_date_override) {
+ if ( C4::Context->preference('SpecifyReturnDate') ) {
+ # FIXME we really need to stop adding more uses of C4::Dates
+ if ( $return_date_override =~ C4::Dates->regexp('syspref') ) {
+
+ # note that we've overriden the return date
+ $template->param( return_date_was_overriden => 1);
+ # Save the original format if we are remembering for this series
+ $template->param(
+ return_date_override => $return_date_override,
+ return_date_override_remember => 1
+ ) if ($return_date_override_remember);
+
+ my $dt = dt_from_string($return_date_override);
+ $return_date_override =
+ DateTime::Format::MySQL->format_datetime($dt);
+ }
+ }
+ else {
+ $return_date_override = q{};
+ }
+}
+
if ($dotransfer){
# An item has been returned to a branch other than the homebranch, and the librarian has chosen to initiate a transfer
my $transferitem = $query->param('transferitem');
# save the return
#
( $returned, $messages, $issueinformation, $borrower ) =
- AddReturn( $barcode, $userenv_branch, $exemptfine, $dropboxmode); # do the return
+ AddReturn( $barcode, $userenv_branch, $exemptfine, $dropboxmode, $return_date_override );
my $homeorholdingbranchreturn = C4::Context->preference('HomeOrHoldingBranchReturn');
$homeorholdingbranchreturn ||= 'homebranch';
itemtype => $biblio->{'itemtype'},
ccode => $biblio->{'ccode'},
itembiblionumber => $biblio->{'biblionumber'},
- additional_materials => $biblio->{'materials'}
+ borrower => $borrower,
+ additional_materials => $biblio->{'materials'},
);
my %input = (
if ( C4::Context->preference("FineNotifyAtCheckin") ) {
my ( $od, $issue, $fines ) = GetMemberIssuesAndFines( $borrower->{'borrowernumber'} );
- if ($fines > 0) {
+ if ($fines && $fines > 0) {
$template->param( fines => sprintf("%.2f",$fines) );
$template->param( fineborrowernumber => $borrower->{'borrowernumber'} );
}
wbortitle => $borr->{'title'},
wborphone => $borr->{'phone'},
wboremail => $borr->{'email'},
+ wborstnum => $borr->{streetnumber},
wboraddress => $borr->{'address'},
wboraddress2 => $borr->{'address2'},
wborcity => $borr->{'city'},
boremail => $borr->{'email'},
boraddress => $borr->{'address'},
boraddress2 => $borr->{'address2'},
+ borstnum => $borr->{streetnumber},
borcity => $borr->{'city'},
borzip => $borr->{'zipcode'},
borcnum => $borr->{'cardnumber'},
$err{debarborrowernumber} = $borrower->{borrowernumber};
$err{debarname} = "$borrower->{firstname} $borrower->{surname}";
}
+ elsif ( $code eq 'PrevDebarred' ) {
+ $err{prevdebarred} = $messages->{'PrevDebarred'};
+ }
+ elsif ( $code eq 'NotForLoanStatusUpdated' ) {
+ $err{NotForLoanStatusUpdated} = $messages->{NotForLoanStatusUpdated};
+ }
else {
die "Unknown error code $code"; # note we need all the (empty) elsif's above, or we die.
# This forces the issue of staying in sync w/ Circulation.pm
}
push @riloop, \%ri;
}
+my ($genbrname, $genprname);
+if (my $b = $branches->{$userenv_branch}) {
+ $genbrname = $b->{'branchname'};
+}
+if (my $p = $printers->{$printer}) {
+ $genprname = $p->{'printername'};
+}
$template->param(
riloop => \@riloop,
- genbrname => $branches->{$userenv_branch}->{'branchname'},
- genprname => $printers->{$printer}->{'printername'},
- branchname => $branches->{$userenv_branch}->{'branchname'},
+ genbrname => $genbrname,
+ genprname => $genprname,
+ branchname => $genbrname,
printer => $printer,
errmsgloop => \@errmsgloop,
exemptfine => $exemptfine,