#!/usr/bin/perl

#use utf8;
use strict;
use CGI;
use Opals::Template_ajax qw(
    tmpl_read
    tmpl_write
    tmpl_preference
);
use Opals::Context;
use Opals::Constant;
use Opals::Locale qw(
    loc_getMsgFile
    loc_write
);
use Opals::Ebook qw(
    eb_deleteLicense
);
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        => 'ajax/util/delPurchaseInfo.tmpl',
            reqPermission   => 'ebook_mgmt',
        }
);

my $uid       = $template->param('curUserId');
my $licId       = $input->{'licId'};
if ($permission && $permission->{'ebook_mgmt'}) {
   if($licId){
       my $rs =eb_deleteLicense($dbh,$licId);
           $template->param(
                licId        =>$licId,
                errorCode    =>$rs
                );
    }

}

        
tmpl_write($dbh, $cgi, $cookie, $template);


