use DateTime::Duration;
use Scalar::Util qw( looks_like_number );
use C4::Output;
-use C4::Print;
use C4::Auth qw/:DEFAULT get_session haspermission/;
-use C4::Koha; # GetPrinter
+use C4::Koha;
use C4::Circulation;
use C4::Utils::DataTables::Members;
use C4::Members;
my $sessionID = $query->cookie("CGISESSID") ;
my $session = get_session($sessionID);
-if (!C4::Context->userenv){
- if ($session->param('branch') eq 'NO_LIBRARY_SET'){
- # no branch set we can't issue
- print $query->redirect("/cgi-bin/koha/circ/selectbranchprinter.pl");
- exit;
- }
-}
my $barcodes = [];
my $barcode = $query->param('barcode');
$template_name = q|circ/circulation_batch_checkouts.tt|;
my @batch_category_codes = split '\|', C4::Context->preference('BatchCheckoutsValidCategories');
my $categorycode = $patron->categorycode;
- if ( $categorycode && grep {/^$categorycode$/} @batch_category_codes ) {
+ if ( $categorycode && grep { $_ eq $categorycode } @batch_category_codes ) {
$batch_allowed = 1;
} else {
$barcodes = [];
flagsrequired => { circulate => 'circulate_remaining_permissions' },
}
);
-my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
+my $logged_in_user = Koha::Patrons->find( $loggedinuser );
my $force_allow_issue = $query->param('forceallow') || 0;
if (!C4::Auth::haspermission( C4::Context->userenv->{id} , { circulate => 'force_checkout' } )) {
$force_allow_issue = 0;
}
-
my $onsite_checkout = $query->param('onsite_checkout');
+if (C4::Context->preference("OnSiteCheckoutAutoCheck") && $onsite_checkout eq "on") {
+ $template->param(onsite_checkout => $onsite_checkout);
+}
+
my @failedrenews = $query->multi_param('failedrenew'); # expected to be itemnumbers
our %renew_failed = ();
for (@failedrenews) { $renew_failed{$_} = 1; }
my $stickyduedate = $query->param('stickyduedate') || $session->param('stickyduedate');
my $duedatespec = $query->param('duedatespec') || $session->param('stickyduedate');
-$duedatespec = eval { output_pref( { dt => dt_from_string( $duedatespec ), dateformat => 'iso', timeformat => '24hr' }); }
+$duedatespec = eval { output_pref( { dt => dt_from_string( $duedatespec ), dateformat => 'iso' }); }
if ( $duedatespec );
my $restoreduedatespec = $query->param('restoreduedatespec') || $duedatespec || $session->param('stickyduedate');
if ( $restoreduedatespec && $restoreduedatespec eq "highholds_empty" ) {
}
my $issueconfirmed = $query->param('issueconfirmed');
my $cancelreserve = $query->param('cancelreserve');
-my $print = $query->param('print') || q{};
my $debt_confirmed = $query->param('debt_confirmed') || 0; # Don't show the debt error dialog twice
my $charges = $query->param('charges') || q{};
$session->clear('auto_renew');
}
+$template->param( auto_renew => $session->param('auto_renew') );
+
my ($datedue,$invalidduedate);
my $duedatespec_allow = C4::Context->preference('SpecifyDueDate');
}
}
-# check and see if we should print
-if ( @$barcodes == 0 && $print eq 'maybe' ) {
- $print = 'yes';
-}
-
my $inprocess = (@$barcodes == 0) ? '' : $query->param('inprocess');
if ( @$barcodes == 0 && $charges eq 'yes' ) {
$template->param(
);
}
-if ( $print eq 'yes' && $borrowernumber ne '' ) {
- if ( C4::Context->boolean_preference('printcirculationslips') ) {
- my $letter = IssueSlip($branch, $borrowernumber, "QUICK");
- NetworkPrint($letter->{content});
- }
- $query->param( 'borrowernumber', '' );
- $borrowernumber = '';
- undef $patron;
-}
-
#
# STEP 2 : FIND BORROWER
# if there is a list of find borrowers....
}
}
+ # Calculate and display patron's age
+ if ( !$patron->is_valid_age ) {
+ $template->param( age_limitations => 1 );
+ $template->param( age_low => $patron->category->dateofbirthrequired );
+ $template->param( age_high => $patron->category->upperagelimit );
+ }
+
}
#
my $checkout_infos;
for my $barcode ( @$barcodes ) {
- my $template_params = { barcode => $barcode };
- $template_params->{onsite_checkout} = $onsite_checkout;
+ my $template_params = {
+ barcode => $barcode,
+ onsite_checkout => $onsite_checkout,
+ };
# always check for blockers on issuing
my ( $error, $question, $alerts, $messages ) = CanBookBeIssued(
$template_params->{getTitleMessageIteminfo} = $biblio->title;
$template_params->{getBarcodeMessageIteminfo} = $item->barcode;
$template_params->{NEEDSCONFIRMATION} = 1;
- $template_params->{auto_renew} = $session->param('auto_renew');
$confirm_required = 1;
}
}
if ($question->{RESERVE_WAITING} or $question->{RESERVED}){
$template->param(
- reserveborrowernumber => $question->{'resborrowernumber'}
+ reserveborrowernumber => $question->{'resborrowernumber'},
+ reserve_id => $question->{reserve_id},
);
}
$no_issues_charge_guarantees = undef unless looks_like_number( $no_issues_charge_guarantees );
if ( defined $no_issues_charge_guarantees ) {
my $guarantees_non_issues_charges = 0;
- my $guarantees = $patron->guarantees;
+ my $guarantees = $patron->guarantee_relationships->guarantees;
while ( my $g = $guarantees->next ) {
$guarantees_non_issues_charges += $g->account->non_issues_charges;
}
: 'circview';
my @relatives;
-if ( $borrowernumber ) {
- if ( $patron ) {
- if ( my $guarantor = $patron->guarantor ) {
- push @relatives, $guarantor->borrowernumber;
- push @relatives, $_->borrowernumber for $patron->siblings;
- } else {
- push @relatives, $_->borrowernumber for $patron->guarantees;
- }
+if ( $patron ) {
+ if ( my @guarantors = $patron->guarantor_relationships()->guarantors() ) {
+ push( @relatives, $_->id ) for @guarantors;
+ push( @relatives, $_->id ) for $patron->siblings();
+ } else {
+ push( @relatives, $_->id ) for $patron->guarantee_relationships()->guarantees();
}
}
my $relatives_issues_count =
$template->param(
debt_confirmed => $debt_confirmed,
SpecifyDueDate => $duedatespec_allow,
- CircAutocompl => C4::Context->preference("CircAutocompl"),
+ PatronAutoComplete => C4::Context->preference("PatronAutoComplete"),
debarments => scalar GetDebarments({ borrowernumber => $borrowernumber }),
todaysdate => output_pref( { dt => dt_from_string()->set(hour => 23)->set(minute => 59), dateformat => 'sql' } ),
has_modifications => $has_modifications,
override_high_holds => $override_high_holds,
nopermission => scalar $query->param('nopermission'),
autoswitched => $autoswitched,
+ logged_in_user => $logged_in_user,
);
output_html_with_http_headers $query, $cookie, $template->output;