# my $flagsrequired;
# $flagsrequired->{circulation}=1;
my ($template, $loggedinuser, $cookie)
- = get_template_and_user({template_name => "parameters/issuingrules.tmpl",
+ = get_template_and_user({template_name => "admin/issuingrules.tmpl",
query => $input,
type => "intranet",
authnotrequired => 0,
- flagsrequired => {parameters => 1},
+ flagsrequired => {parameters => 1, management => 1},
debug => 1,
});
# save the values entered
my $sth_Fupdate=$dbh->prepare("Update issuingrules set fine=?,firstremind=?,chargeperiod=? where branchcode=? and categorycode=? and itemtype=?");
my $sth_Fdelete=$dbh->prepare("delete from issuingrules where branchcode=? and categorycode=? and itemtype=? and issuelength=0");
- my $sth_Iinsert = $dbh->prepare("insert into issuingrules (branchcode,categorycode,itemtype,maxissueqty,issuelength) values (?,?,?,?,?)");
- my $sth_Iupdate=$dbh->prepare("Update issuingrules set maxissueqty=?, issuelength=? where branchcode=? and categorycode=? and itemtype=?");
+ my $sth_Iinsert = $dbh->prepare("insert into issuingrules (branchcode,categorycode,itemtype,maxissueqty,issuelength,rentaldiscount) values (?,?,?,?,?,?)");
+ my $sth_Iupdate=$dbh->prepare("Update issuingrules set maxissueqty=?, issuelength=?, rentaldiscount=? where branchcode=? and categorycode=? and itemtype=?");
my $sth_Idelete=$dbh->prepare("delete from issuingrules where branchcode=? and categorycode=? and itemtype=? and fine=0");
foreach my $key (@names){
# ISSUES
my $bor = $2; # borrower category
my $cat = $3; # item type
my $data=$input->param($key);
- my ($issuelength,$maxissueqty)=split(',',$data);
- if ($maxissueqty >0) {
+ my ($issuelength,$maxissueqty,$rentaldiscount)=split(',',$data);
+# if ($maxissueqty >0) {
$sth_search->execute($br,$bor,$cat);
my $res = $sth_search->fetchrow_hashref();
if ($res->{total}) {
- $sth_Iupdate->execute($maxissueqty,$issuelength,$br,$bor,$cat);
+ $sth_Iupdate->execute($maxissueqty,$issuelength,$rentaldiscount,$br,$bor,$cat);
} else {
- $sth_Iinsert->execute($br,$bor,$cat,$maxissueqty,$issuelength);
+ $sth_Iinsert->execute($br,$bor,$cat,$maxissueqty,$issuelength,$rentaldiscount);
}
- } else {
- $sth_Idelete->execute($br,$bor,$cat);
- }
+# } else {
+# $sth_Idelete->execute($br,$bor,$cat);
+# }
}
# FINES
if ($key =~ /F-(.*)-(.*)\.(.*)/) {
my $cat = $3; # item type
my $data=$input->param($key);
my ($fine,$firstremind,$chargeperiod)=split(',',$data);
- if ($fine >0) {
+# if ($fine >0) {
$sth_search->execute($br,$bor,$cat);
my $res = $sth_search->fetchrow_hashref();
if ($res->{total}) {
} else {
$sth_Finsert->execute($br,$bor,$cat,$fine,$firstremind,$chargeperiod);
}
- } else {
- $sth_Fdelete->execute($br,$bor,$cat);
- }
+# } else {
+# $sth_Fdelete->execute($br,$bor,$cat);
+# }
}
}
my $sth=$dbh->prepare("Select description,categorycode from categories order by description");
$sth->execute;
- my @trow3;
+my @trow3;
my @title_loop;
# my $i=0;
while (my $data=$sth->fetchrow_hashref){
$sth=$dbh->prepare("Select description,itemtype from itemtypes order by description");
$sth->execute;
# $i=0;
-my $toggle="white";
+my $toggle= 1;
my @row_loop;
my @itemtypes;
while (my $row=$sth->fetchrow_hashref){
foreach my $data (@itemtypes) {
my @trow2;
my @cell_loop;
- if ( $toggle eq 'white' ) {
- $toggle = '#ffffcc';
+ if ( $toggle eq 1 ) {
+ $toggle = 0;
} else {
- $toggle = 'white';
+ $toggle = 1;
}
for (my $i=0;$i<=$#trow3;$i++){
my $sth2=$dbh->prepare("select * from issuingrules where branchcode=? and categorycode=? and itemtype=?");
my $fine=$dat->{'fine'}+0;
my $maxissueqty = $dat->{'maxissueqty'}+0;
my $issuelength = $dat->{'issuelength'}+0;
+ my $rentaldiscount = $dat->{'rentaldiscount'}+0;
my $finesvalue;
- $finesvalue= "$fine,$dat->{'firstremind'},$dat->{'chargeperiod'}" if $fine>0;
+ $finesvalue= "$fine,$dat->{'firstremind'},$dat->{'chargeperiod'}" if $fine+$dat->{'firstremind'}+$dat->{'chargeperiod'}>0;
my $issuingvalue;
- $issuingvalue = "$issuelength,$maxissueqty" if ($maxissueqty>0);
+# if ($maxissueqty>0) {
+ $issuingvalue = "$issuelength,$maxissueqty,$rentaldiscount" if $issuelength+$maxissueqty>0;
+# }
+# else {
+# $issuingvalue = "$issuelength, 5";
+# $maxissueqty = 5;
+# }
my %row = (finesname=> "F-$branch-$trow3[$i].$$data->{'itemtype'}",
finesvalue => $finesvalue,
- issuingname => "I-$branch-$trow3[$1].$$data->{itemtype}",
+ issuingname => "I-$branch-$trow3[$i].$$data->{itemtype}",
issuingvalue => $issuingvalue,
toggle => $toggle,
);