#!/usr/bin/perl

#use utf8;
use strict;
use CGI;

use Opals::Context;
use Date::Calc::Object qw(
    :all
);
use POSIX qw(
    floor
);
use Time::localtime;

use Opals::Template qw(
    tmpl_read
    tmpl_write
    tmpl_preference
    tmpl_redirect
);
use Opals::Constant;
use Opals::Date qw(
    date_parse
    date_today
    date_text
    date_validateWorkday
    date_deltaWorkDay
    date_addDeltaWorkday
    date_f005
    date_getDeadLineDate
);
use Opals::User qw(
    user_LoadCategory
    user_category
    user_list
    user_getInformationById
    user_balance
    user_isUserBc
);



################################################################################
my $dbh = Opals::Context->dbh();
END { $dbh->disconnect(); }

my $cgi = CGI->new;
my $input = $cgi->Vars();
my ($permission, $cookie, $template) = tmpl_read(
        {
            dbh             => $dbh,
            cgi             => $cgi,
            tmplFile        => 'circ/return_ajax.tmpl',
            reqPermission   => 'circ_loan',
        }
);
my $syspref          = tmpl_preference($dbh);
my $chargeFine       = $syspref->{'charge_overdue'};
my $chargeDamage     = $syspref->{'charge_damage'};
my $chargeLost       = $syspref->{'charge_lost'};
my $validateBc       = $syspref->{'validateBarcode'}; 
my $barcodeType      = $syspref->{'barcodeType'}; 
my $circulationSound = $syspref->{'circulationSound'};
my $loginuid         = $template->param('curUserId');

my @cookieList = (@$cookie);

my $tm = localtime;
my $todayStr = sprintf("%04d-%02d-%02d", $tm->year+1900, ($tm->mon)+1, $tm->mday);
my $dFirst = Opals::Context->preference('dateFirst');
my $dLast  = Opals::Context->preference('dateLast');


if ($permission && $permission->{'circ_loan'}) 
{   
         
}#if ($permission && $permission->{'circ_loan'})


$template->param(
                 checkid     => 1,
                 circulation => 1,
                 loan        => 1);
tmpl_write($dbh, $cgi, \@cookieList, $template);


################################################################################

